Skip to content
DwarfLinesBuildFromElf

DwarfLinesBuildFromElf

Description

Parse the .debug_line section of a previously-opened ElfFile.

Parameters

Name Direction Description
out out Populated on success.
elf in ELF file to read from. Borrowed; not retained.
alloc in Allocator for the resulting tables + string pool.

Success

Returns true. out->entries.length may be 0 if the binary has no .debug_line section (stripped or built without -g).

Failure

Returns false; logs the failing step. out is left zeroed.

Usage example (Cross-references)

Usage examples (Cross-references)
    
        DwarfLines lines;
        bool       built = DwarfLinesBuildFromElf(&lines, &elf, ALLOCATOR_OF(&alloc));
        bool       ok    = built && lines.entries.length > 0;
    
        DwarfLines lines;
        bool       built = DwarfLinesBuildFromElf(&lines, &elf, base);
        bool       ok    = false;
        if (built) {
        if (!cache_entry->dwarf_built) {
            cache_entry->dwarf_built = true;
            cache_entry->dwarf_ok    = DwarfLinesBuildFromElf(&cache_entry->dwarf, &cache_entry->elf, self->allocator);
        }
        if (cache_entry->dwarf_ok) {
    // ---------------------------------------------------------------------------
    
    bool DwarfLinesBuildFromElf(DwarfLines *out, const ElfFile *elf, Allocator *alloc) {
        if (!out || !elf || !alloc) {
            LOG_ERROR("DwarfLinesBuildFromElf: NULL argument");
    bool DwarfLinesBuildFromElf(DwarfLines *out, const ElfFile *elf, Allocator *alloc) {
        if (!out || !elf || !alloc) {
            LOG_ERROR("DwarfLinesBuildFromElf: NULL argument");
            return false;
        }
Last updated on