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 › cpu_context › X86_64 › dwarfRegisterBytes Public Function dwarfRegisterBytes Doc Source Public Function std.debug.cpu_context.X86_64.dwarfRegisterBytes
pub fn dwarfRegisterBytes (ctx : *X86_64 , register_num : u16 ) DwarfRegisterError ![]u8 Params ctx : *X86_64 register_num : u16 Errors InvalidRegister UnsupportedRegister File debug/cpu_context.zig: 1900
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924 pub fn dwarfRegisterBytes (ctx : *X86_64 , register_num : u16 ) DwarfRegisterError ![]u8 {
// System V Application Binary Interface AMD64 Architecture Processor Supplement
// § 3.6.2 "DWARF Register Number Mapping"
switch (register_num ) {
// The order of `Gpr` intentionally matches DWARF's mappings.
0 ...16 => return @ptrCast (&ctx .gprs .values [register_num ]),
17 ...32 => return error .UnsupportedRegister , // xmm0 - xmm15
33 ...40 => return error .UnsupportedRegister , // st0 - st7
41 ...48 => return error .UnsupportedRegister , // mm0 - mm7
49 => return error .UnsupportedRegister , // rflags
50 ...55 => return error .UnsupportedRegister , // es, cs, ss, ds, fs, gs
58 ...59 => return error .UnsupportedRegister , // fs.base, gs.base
62 => return error .UnsupportedRegister , // tr
63 => return error .UnsupportedRegister , // ldtr
64 => return error .UnsupportedRegister , // mxcsr
65 => return error .UnsupportedRegister , // fcw
66 => return error .UnsupportedRegister , // fsw
67 ...82 => return error .UnsupportedRegister , // xmm16 - xmm31 (AVX-512)
118 ...125 => return error .UnsupportedRegister , // k0 - k7 (AVX-512)
130 ...145 => return error .UnsupportedRegister , // r16 - r31 (APX)
else => return error .InvalidRegister ,
}
}