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.

getSymbols

Dwarf.getSymbols
pub fn getSymbols(
    di: *Dwarf,
    symbol_allocator: Allocator,
    text_arena: Allocator,
    endian: Endian,
    address: u64,
    resolve_inline_callers: bool,
    symbols: *std.ArrayList(std.debug.Symbol),
) std.debug.SelfInfoError!void

File

lib/std/debug/Dwarf.zig:1558

Code

pub fn getSymbols(
    di: *Dwarf,
    symbol_allocator: Allocator,
    text_arena: Allocator,
    endian: Endian,
    address: u64,
    resolve_inline_callers: bool,
    symbols: *std.ArrayList(std.debug.Symbol),
) std.debug.SelfInfoError!void {
    _ = resolve_inline_callers;
    const gpa = std.debug.getDebugInfoAllocator();

    const compile_unit = di.findCompileUnit(endian, address) catch |err| switch (err) {
        error.EndOfStream => return error.MissingDebugInfo,
        error.Overflow => return error.InvalidDebugInfo,
        error.ReadFailed, error.InvalidDebugInfo, error.MissingDebugInfo => |e| return e,
    };
    try symbols.append(symbol_allocator, .{
        .name = di.getSymbolName(address),
        .compile_unit_name = compile_unit.die.getAttrString(di, endian, std.dwarf.AT.name, di.section(.debug_str), compile_unit) catch |err| switch (err) {
            error.MissingDebugInfo, error.InvalidDebugInfo => null,
        },
        .source_location = di.getLineNumberInfo(gpa, text_arena, endian, compile_unit, address) catch |err| switch (err) {
            error.MissingDebugInfo, error.InvalidDebugInfo => null,
            error.ReadFailed,
            error.EndOfStream,
            error.Overflow,
            error.StreamTooLong,
            => return error.InvalidDebugInfo,
            else => |e| return e,
        },
    });
}