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)
                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 dwarf_functions_build_from_elf(DwarfFunctions *out, const Elf *elf, Allocator *alloc) {
        if (!out || !elf || !alloc) {
            LOG_FATAL("DwarfFunctionsBuildFromElf: NULL argument");
        }
        const ElfSection *info_sec   = ElfFindSection(elf, ".debug_info");
        // (4) DwarfFunctions on the stripped copy MUST find the name.
        DwarfFunctions fns;
        bool           built = DwarfFunctionsBuildFromElf(&fns, &stripped, base);
        bool           ok    = false;
        if (built && VecLen(&fns.entries) > 0) {
    
        DwarfFunctions fns;
        bool           built = DwarfFunctionsBuildFromElf(&fns, &elf, base);
        bool           ok    = false;
        if (built && VecLen(&fns.entries) > 0) {
Last updated on