Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › debug › Dwarf › Unwind › readEhPointer Private Function readEhPointer Doc Source Private Function std.debug.Dwarf.Unwind.readEhPointer
fn readEhPointer (r : *Reader , enc : EH .PE , addr_size_bytes : u8 , ctx : EhPointerContext , endian : Endian ) !u64 Params File debug/Dwarf/Unwind.zig: 670
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689 fn readEhPointer (r : *Reader , enc : EH .PE , addr_size_bytes : u8 , ctx : EhPointerContext , endian : Endian ) !u64 {
const offset = try readEhPointerAbs (r , enc .type , addr_size_bytes , endian );
if (enc .indirect ) return bad (); // GCC extension; not supported
const base : u64 = switch (enc .rel ) {
.abs , .aligned => 0 ,
.pcrel => ctx .pc_rel_base ,
.textrel => ctx .text_rel_base orelse return bad (),
.datarel => ctx .data_rel_base orelse return bad (),
.funcrel => ctx .function_rel_base orelse return bad (),
_ => return bad (),
};
return switch (offset ) {
.signed => |s | if (s >= 0 )
try std .math .add (u64 , base , @intCast (s ))
else
try std .math .sub (u64 , base , @intCast (-s )),
// absptr can actually contain signed values in some cases (aarch64 MachO)
.unsigned => |u | u +% base ,
};
}
Returns
error.InvalidDebugInfoif the encoding isEH.PE.omit.