union FormValue [src]
Fields
addr: u64
addrx: usize
block: []const u8
udata: u64
data16: *const [16]u8
sdata: i64
exprloc: []const u8
flag: bool
sec_offset: u64
ref: u64
ref_addr: u64
string: [:0]const u8
strp: u64
strx: usize
line_strp: u64
loclistx: u64
rnglistx: u64
Source
pub const FormValue = union(enum) {
addr: u64,
addrx: usize,
block: []const u8,
udata: u64,
data16: *const [16]u8,
sdata: i64,
exprloc: []const u8,
flag: bool,
sec_offset: u64,
ref: u64,
ref_addr: u64,
string: [:0]const u8,
strp: u64,
strx: usize,
line_strp: u64,
loclistx: u64,
rnglistx: u64,
fn getString(fv: FormValue, di: Dwarf) ![:0]const u8 {
switch (fv) {
.string => |s| return s,
.strp => |off| return di.getString(off),
.line_strp => |off| return di.getLineString(off),
else => return bad(),
}
}
fn getUInt(fv: FormValue, comptime U: type) !U {
return switch (fv) {
inline .udata,
.sdata,
.sec_offset,
=> |c| cast(U, c) orelse bad(),
else => bad(),
};
}
}