DwarfCfiBuildFromElf
Description
Parse the .eh_frame section of an already-opened Elf.
Parameters
| Name | Direction | Description |
|---|---|---|
out |
out | Populated on success. |
elf |
in | ELF file to read from. Borrowed. |
alloc |
in | Allocator backing the CIE / FDE vectors. |
Success
Returns true. out->fdes.length may be 0 if the binary lacks a .eh_frame section (very unusual on modern Linux).
Failure
Returns false; logs the failing step. out is left zeroed.
Usage example (Cross-references)
Usage examples (Cross-references)
if (!cache_entry->cfi_built) {
cache_entry->cfi_built = true;
cache_entry->cfi_ok = DwarfCfiBuildFromElf(&cache_entry->cfi, &cache_entry->elf, self->allocator);
}
if (!cache_entry->cfi_ok) bool dwarf_cfi_build_from_elf(DwarfCfi *out, const Elf *elf, Allocator *alloc) {
if (!out || !elf || !alloc) {
LOG_FATAL("DwarfCfiBuildFromElf: NULL argument");
}
MemSet(out, 0, sizeof(*out));
DwarfCfi cfi;
bool ok = DwarfCfiBuildFromElf(&cfi, &elf, base);
if (ok) {
const DwarfFde *fde = DwarfCfiFindFde(&cfi, target_pc); }
DwarfCfi cfi;
bool ok = DwarfCfiBuildFromElf(&cfi, &elf, base);
if (ok) {
const DwarfFde *fde = DwarfCfiFindFde(&cfi, target_pc); }
DwarfCfi cfi;
bool ok = DwarfCfiBuildFromElf(&cfi, &elf, base);
if (ok) {
const DwarfFde *fde = DwarfCfiFindFde(&cfi, target_pc); }
DwarfCfi cfi;
bool ok = DwarfCfiBuildFromElf(&cfi, &elf, base);
if (ok) {
const DwarfFde *fde = DwarfCfiFindFde(&cfi, target_pc); if (ElfOpenFromMemoryCopy(&elf, elfbuf, (size)elf_len, base)) {
DwarfCfi cfi;
if (DwarfCfiBuildFromElf(&cfi, &elf, base)) {
const DwarfFde *fde = DwarfCfiFindFde(&cfi, 0x5000);
DwarfUnwindRow row; if (ElfOpenFromMemoryCopy(&elf, elfbuf, (size)elf_len, base)) {
DwarfCfi cfi;
if (DwarfCfiBuildFromElf(&cfi, &elf, base)) {
ok = DwarfCfiFindFde(&cfi, 0x10ff) != NULL // last in-range address
&& DwarfCfiFindFde(&cfi, 0x1100) == NULL; // == end: exclusive -> miss
if (ElfOpenFromMemoryCopy(&elf, elfbuf, (size)elf_len, base)) {
DwarfCfi cfi;
if (DwarfCfiBuildFromElf(&cfi, &elf, base)) {
const DwarfFde *fde = DwarfCfiFindFde(&cfi, 0x1000);
DwarfUnwindRow row; if (ElfOpenFromMemoryCopy(&elf, elfbuf, (size)elf_len, base)) {
DwarfCfi cfi;
if (DwarfCfiBuildFromElf(&cfi, &elf, base)) {
const DwarfCie *cie = DwarfCfiFindCie(&cfi, 0);
ok = cie != NULL && cie->version == 1 && cie->has_augmentation == 1 && cie->offset == 0 && if (ElfOpenFromMemoryCopy(&elf, elfbuf, (size)elf_len, base)) {
DwarfCfi cfi;
if (DwarfCfiBuildFromElf(&cfi, &elf, base)) {
const DwarfFde *fde = DwarfCfiFindFde(&cfi, 0x1000);
ok = fde != NULL && fde->offset == fde_off;- In
Dwarf.c:115:
DwarfCfi cfi;
bool built = DwarfCfiBuildFromElf(&cfi, &elf, base);
// Contract (strict): the parse must succeed AND an FDE must cover this
// function. A -g test build always carries CFI for it -- via .eh_frame
Last updated on