Skip to content
DwarfFunctionsBuildFromElf

DwarfFunctionsBuildFromElf

Description

Parse .debug_info and build the function-name index.

Parameters

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

Success

Returns true. out->entries.length is 0 if the binary has no .debug_info (stripped + no sidecar) — still success.

Failure

Returns false on malformed DWARF or unsupported version / 64-bit length form. out is left zeroed.

Usage example (Cross-references)

Usage examples (Cross-references)
        // (4) DwarfFunctions on the stripped copy MUST find the name.
        DwarfFunctions fns;
        bool           built = DwarfFunctionsBuildFromElf(&fns, &stripped, base);
        bool           ok    = false;
        if (built && fns.entries.length > 0) {
    
        DwarfFunctions fns;
        bool           built = DwarfFunctionsBuildFromElf(&fns, &elf, base);
        bool           ok    = false;
        if (built && fns.entries.length > 0) {
                cache_entry->functions_built = true;
                cache_entry->functions_ok =
                    DwarfFunctionsBuildFromElf(&cache_entry->functions, &cache_entry->elf, self->allocator);
            }
            const DwarfFunction *f = NULL;
                    cache_entry->sidecar_functions_built = true;
                    cache_entry->sidecar_functions_ok =
                        DwarfFunctionsBuildFromElf(&cache_entry->sidecar_functions, &cache_entry->sidecar, self->allocator);
                }
                if (cache_entry->sidecar_functions_ok) {
    }
    
    bool DwarfFunctionsBuildFromElf(DwarfFunctions *out, const ElfFile *elf, Allocator *alloc) {
        if (!out || !elf || !alloc) {
            LOG_ERROR("DwarfFunctionsBuildFromElf: NULL argument");
    bool DwarfFunctionsBuildFromElf(DwarfFunctions *out, const ElfFile *elf, Allocator *alloc) {
        if (!out || !elf || !alloc) {
            LOG_ERROR("DwarfFunctionsBuildFromElf: NULL argument");
            return false;
        }
Last updated on