Skip to content

ElfBuf

Description

Borrowed handle to the parser’s owned byte buffer. Cross-namespace readers (Dwarf*BuildFromElf, …) need section bytes off the loaded file; this is the public seam they go through instead of reaching at self->data directly.

Usage example (Cross-references)

Usage examples (Cross-references)
        const ElfSection *str_sec    = ElfFindSection(elf, ".debug_str");
    
        const u8 *info_b   = info_sec ? BufData(ElfBuf(elf)) + info_sec->offset : NULL;
        u64       info_n   = info_sec ? info_sec->size : 0;
        const u8 *abbrev_b = abbrev_sec ? BufData(ElfBuf(elf)) + abbrev_sec->offset : NULL;
        const u8 *info_b   = info_sec ? BufData(ElfBuf(elf)) + info_sec->offset : NULL;
        u64       info_n   = info_sec ? info_sec->size : 0;
        const u8 *abbrev_b = abbrev_sec ? BufData(ElfBuf(elf)) + abbrev_sec->offset : NULL;
        u64       abbrev_n = abbrev_sec ? abbrev_sec->size : 0;
        const u8 *str_b    = str_sec ? BufData(ElfBuf(elf)) + str_sec->offset : NULL;
        const u8 *abbrev_b = abbrev_sec ? BufData(ElfBuf(elf)) + abbrev_sec->offset : NULL;
        u64       abbrev_n = abbrev_sec ? abbrev_sec->size : 0;
        const u8 *str_b    = str_sec ? BufData(ElfBuf(elf)) + str_sec->offset : NULL;
        u64       str_n    = str_sec ? str_sec->size : 0;
        return DwarfFunctionsBuildFromSlices(out, info_b, info_n, abbrev_b, abbrev_n, str_b, str_n, alloc);
        if (eh && eh->size > 0) {
            out->eh_frame_addr = eh->addr;
            ok                 = cfi_parse_section(out, BufData(ElfBuf(elf)) + eh->offset, eh->addr, eh->size, false);
        } else {
            const ElfSection *df = ElfFindSection(elf, ".debug_frame");
            }
            out->eh_frame_addr = df->addr;
            ok                 = cfi_parse_section(out, BufData(ElfBuf(elf)) + df->offset, df->addr, df->size, true);
        }
        if (!ok) {
        U64Vec pending_dir_offsets  = VecInitT(pending_dir_offsets, alloc);
    
        BufIter section_cur = BufIterFromMemory(BufData(ElfBuf(elf)) + line_section->offset, line_section->size);
    
        bool ok = true;
Last updated on