Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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. Public Function

getLineNumberInfo

Public Function
std.debug.Dwarf.getLineNumberInfo
pub fn getLineNumberInfo(
    d: *Dwarf,
    gpa: Allocator,
    text_arena: Allocator,
    endian: Endian,
    compile_unit: *CompileUnit,
    target_address: u64,
) !std.debug.SourceLocation

Params

File

debug/Dwarf.zig:1297
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
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,
    };
}