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 library itself.
Zig › std/ › debug/ › Dwarf.zig › getLineNumberInfo
getLineNumberInfo
Dwarf.getLineNumberInfo
pub fn getLineNumberInfo (
d : *Dwarf ,
gpa : Allocator ,
text_arena : Allocator ,
endian : Endian ,
compile_unit : *CompileUnit ,
target_address : u64 ,
) !std .debug .SourceLocation
File
Code
pub fn getLineNumberInfo (
d : *Dwarf ,
gpa : Allocator ,
text_arena : Allocator ,
endian : Endian ,
compile_unit : *CompileUnit ,
target_address : u64 ,
) !std .debug .SourceLocation {
try d .populateSrcLocCache (gpa , endian , compile_unit );
const slc = &compile_unit .src_loc_cache .?;
const entry = try slc .findSource (target_address );
const file_index = entry .file - @intFromBool (slc .version < 5 );
if (file_index >= slc .files .len ) return bad ();
const file_entry = &slc .files [file_index ];
if (file_entry .dir_index >= slc .directories .len ) return bad ();
const dir_name = slc .directories [file_entry .dir_index ].path ;
const file_name = try std .fs .path .join (text_arena , &.{ dir_name , file_entry .path });
return .{
.line = entry .line ,
.column = entry .column ,
.file_name = file_name ,
};
}