ElfDeinit
Description
Release storage owned by an Elf. Frees the byte buffer through the data Buf’s carried allocator and tears down the section / symbol vectors. All three ElfOpen* constructors leave the parser as the sole owner of data, so this is unconditional. Safe to call on a zeroed struct.
Success
Returns to the caller. *self is zeroed.
Failure
Function cannot fail. NULL self is a no-op.
Usage example (Cross-references)
Usage examples (Cross-references)
return true;
}
ElfDeinit(out);
}
} return true;
}
ElfDeinit(out);
} return true;
}
ElfDeinit(out);
} return true;
}
ElfDeinit(out);
}
} if (!VecPushBackR(&self->cache, entry)) {
if (entry.has_sidecar)
ElfDeinit(&entry.sidecar);
ElfDeinit(&entry.elf);
return NULL; if (entry.has_sidecar)
ElfDeinit(&entry.sidecar);
ElfDeinit(&entry.elf);
return NULL;
} #endif
if (e->has_sidecar) {
ElfDeinit(&e->sidecar);
}
ElfDeinit(&e->elf); ElfDeinit(&e->sidecar);
}
ElfDeinit(&e->elf);
}
VecDeinit(&self->cache);- In
Elf.c:504:
fail:
ElfDeinit(out);
return false;
}- In
Elf.c:538:
}
void ElfDeinit(Elf *self) {
if (!self)
return;- In
Elf.c:270:
ok = ok && VecLen(&elf.symbols) > 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:288:
bool ok = text != NULL && text->size > 0 && (text->flags & 0x4); // SHF_EXECINSTR = 0x4
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:308:
}
bool ok = elf.build_id != NULL && elf.build_id_size > 0 && elf.build_id_size <= 64;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:331:
}
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:379:
ok = ok && found_func;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:407:
s1->vaddr != s1->offset; // distinct vaddr/offset survives decode
}
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc);- In
Elf.c:445:
ok = ok && s == NULL;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:461:
}
bool ok = ElfFindSection(&elf, ".nosuchsection") == NULL && ElfFindSection(&elf, ".text") != NULL;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:474:
bool opened = ElfOpenFromMemoryCopy(&elf, bytes, len, ALLOCATOR_OF(&alloc));
if (opened)
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return !opened;- In
Elf.c:722:
elf.debuglink_crc == DEBUGLINK_CRC;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:761:
last->offset == STRTAB_OFF && last->size == STRTAB_SZ;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:782:
t->size == TEXT_SIZE && (t->flags & 0x4) != 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:805:
bool ok = sym != NULL && sym->info == SYMTAB_INFO && txt != NULL && txt->info == 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:865:
// Names resolved through the in-range shstrtab.
ok = ElfFindSection(&elf, ".shstrtab") != NULL && ElfFindSection(&elf, ".text") != NULL;
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc);- In
Elf.c:889:
// Empty shstrtab => every section name decodes to "".
ok = VecLen(&elf.sections) == N_SECTIONS;
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc);- In
Elf.c:912:
if (ok) {
ok = VecLen(&elf.sections) == N_SECTIONS;
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc);- In
Elf.c:998:
bool ok = VecLen(&elf.sections) == 2 && s1->name != NULL && s1->name[0] == '\0';
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1056:
bool ok = VecLen(&elf.sections) == 2 && s1->name != NULL && s1->name[0] == '\0';
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1115:
bool ok = VecLen(&elf.sections) == 2 && s1->name != NULL && ZstrCompare(s1->name, "XYZ") == 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1139:
s != NULL && ZstrCompare(s->name, ".strtab") == 0 && sym != NULL && ZstrCompare(sym->name, ".symtab") == 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1168:
ok = ok && ElfFindSection(&elf, ".no_such_section_xyz") == NULL;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1196:
ok = ok && VecLen(&elf.sections) == elf.header.shnum;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1226:
ok = ok && VecLen(&elf.sections) == N_SECTIONS;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1270:
bool ok = opened && elf.header.shnum == 1 && VecLen(&elf.sections) == 1;
if (opened)
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1289:
bool opened = ElfOpenFromMemoryCopy(&elf, elf_blob, sizeof(elf_blob), ALLOCATOR_OF(&alloc));
if (opened)
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return opened;- In
Elf.c:1419:
if (opened) {
// Should not happen on real code; clean up and fail the test.
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return false;- In
Elf.c:1441:
bool ok = opened && elf.header.machine == ELF_MACHINE_HOST && VecLen(&elf.sections) > 0;
if (opened)
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1690:
}
bool ok = VecLen(&elf.symbols) == 5;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1709:
bool ok = a->name && ZstrCompare(a->name, "alpha") == 0 && b->name && ZstrCompare(b->name, "beta") == 0 &&
l->name && ZstrCompare(l->name, "local") == 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1725:
bool ok = a->value == SF_ALPHA_VADDR && a->size == SF_ALPHA_SIZE && a->type == ELF_SYMBOL_TYPE_FUNC &&
a->bind == ELF_SYMBOL_BIND_GLOBAL && a->section_index == SF_SEC_TEXT;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1745:
ok = d->name && ZstrCompare(d->name, "dyn_sym") == 0 && d->value == SF_DYN_VADDR;
}
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1764:
bool opened = ElfOpenFromMemoryCopy(&elf, sym_blob, sizeof(sym_blob), ALLOCATOR_OF(&alloc));
if (opened)
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return !opened; // must be rejected
- In
Elf.c:1788:
ok = ok && (s == NULL || ZstrCompare(s->name, "alpha") != 0);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1805:
const ElfSymbol *miss = ElfResolveAddress(&elf, SF_BETA_VADDR + 1);
bool ok = hit && hit->name && ZstrCompare(hit->name, "beta") == 0 && miss == NULL;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1823:
const ElfSymbol *s = ElfResolveAddress(&elf, SF_BETA_VADDR);
bool ok = s && s->name && ZstrCompare(s->name, "beta") == 0 && s->bind == ELF_SYMBOL_BIND_GLOBAL;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1844:
const ElfSymbol *s = ElfResolveAddress(&elf, SF_ALPHA_VADDR + 4);
bool ok = s && s->name && ZstrCompare(s->name, "alpha") == 0 && s->bind == ELF_SYMBOL_BIND_GLOBAL;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1926:
bool ok =
elf.build_id != NULL && elf.build_id_size == sizeof(desc) && MemCompare(elf.build_id, desc, sizeof(desc)) == 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1946:
}
bool ok = elf.build_id != NULL && elf.build_id_size == 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1968:
}
bool ok = elf.build_id == NULL && elf.build_id_size == 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:1989:
}
bool ok = elf.build_id == NULL && elf.build_id_size == 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:2011:
}
bool ok = elf.build_id == NULL && elf.build_id_size == 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:2078:
bool ok = elf.debuglink_name != NULL && ZstrCompare(elf.debuglink_name, "abc.debug") == 0 &&
elf.debuglink_crc == 0x0a0b0c0du;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:2105:
}
bool ok = elf.debuglink_name == NULL;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:2125:
}
bool ok = elf.debuglink_name == NULL;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:2148:
}
bool ok = elf.debuglink_name == NULL;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:2215:
bool opened = ElfOpenFromMemoryCopy(&elf, blob, sizeof(blob), ALLOCATOR_OF(&alloc));
if (opened)
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
// Real code: range check on 128 fails -> rejected. Mutant: 42 passes,
- In
Elf.c:2289:
ok = ok && elf.debuglink_name != NULL && ZstrCompare(elf.debuglink_name, "foo.debug") == 0 &&
elf.debuglink_crc == DEBUGLINK_CRC;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:2322:
// but we only assert build-id here.)
bool ok = elf.build_id == NULL && elf.build_id_size == 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:2349:
}
bool ok = elf.debuglink_name == NULL && elf.debuglink_crc == 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Elf.c:2472:
bool opened = ElfOpenFromMemoryCopy(&elf, buf, sizeof(buf), ALLOCATOR_OF(&alloc));
if (opened)
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return !opened; // real rejects an out-of-range symtab link
- In
Stripped.c:88:
}
ElfDeinit(&stripped);
DefaultAllocatorDeinit(&alloc);
return ok && sym_missing_or_unnamed; DwarfCfiDeinit(&cfi);
}
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok; DwarfCfiDeinit(&cfi);
}
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok; DwarfCfiDeinit(&cfi);
}
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok; DwarfCfiDeinit(&cfi);
}
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok; DwarfCfiDeinit(&cfi);
}
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc); DwarfCfiDeinit(&cfi);
}
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc); DwarfCfiDeinit(&cfi);
}
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc); DwarfCfiDeinit(&cfi);
}
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc); DwarfCfiDeinit(&cfi);
}
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc);- In
Dwarf.c:35:
if (built)
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:80:
}
ElfDeinit(&elf);
SymbolResolverDeinit(&res);
DefaultAllocatorDeinit(&alloc);- In
Dwarf.c:143:
}
ElfDeinit(&elf);
SymbolResolverDeinit(&res);
DefaultAllocatorDeinit(&alloc);- In
Dwarf.c:187:
}
ElfDeinit(&elf);
SymbolResolverDeinit(&res);
DefaultAllocatorDeinit(&alloc);- In
Dwarf.c:610:
}
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:646:
if (built)
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:758:
fx->built = DwarfLinesBuildFromElf(&fx->lines, &fx->elf, base);
if (!fx->built) {
ElfDeinit(&fx->elf);
DefaultAllocatorDeinit(&fx->alloc);
return false;- In
Dwarf.c:767:
static void lines_fixture_close(LinesFixture *fx) {
DwarfLinesDeinit(&fx->lines);
ElfDeinit(&fx->elf);
DefaultAllocatorDeinit(&fx->alloc);
}- In
Dwarf.c:885:
bool built = DwarfLinesBuildFromElf(lines, &elf, base);
ElfDeinit(&elf);
return built;
}- In
Dwarf.c:1543:
}
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:1918:
bool built = DwarfLinesBuildFromElf(lines, &elf, base);
ElfDeinit(&elf);
return built;
}- In
Dwarf.c:2163:
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:2214:
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:2270:
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:2351:
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:2390:
// not; close the ELF either way (lines_from_debug_line opens it before
// building).
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:2439:
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:2488:
}
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:2524:
if (built)
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:2560:
if (built)
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:2614:
}
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:2660:
ok = ok && (after == before);
ElfDeinit(&elf);
DebugAllocatorDeinit(&dbg);
return ok;- In
Dwarf.c:2707:
ok = ok && (after == before);
ElfDeinit(&elf);
DebugAllocatorDeinit(&dbg);
return ok;- In
Dwarf.c:2767:
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:2821:
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:2878:
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:2937:
ok = false;
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
} else {
ElfDeinit(&elf);- In
Dwarf.c:2939:
ElfDeinit(&elf);
} else {
ElfDeinit(&elf);
}- In
Dwarf.c:2983:
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Dwarf.c:3145:
ok = ok && e && e->file == NULL;
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc);- In
Dwarf.c:3217:
ok = ok && e && e->dir == NULL;
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc);- In
Dwarf.c:3248:
ok = ok && first_real_row_address(&lines, &addr) && addr == (u64)-1;
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc);- In
Dwarf.c:3278:
ok = ok && first_real_row_address(&lines, &addr) && addr == (u64)-1;
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc);- In
Dwarf.c:3308:
ok = ok && first_real_row_address(&lines, &addr) && addr == (u64)-1;
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc);- In
Dwarf.c:3337:
ok = ok && first_real_row_address(&lines, &addr) && addr == (u64)-1;
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc);- In
Dwarf.c:3372:
if (built) {
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
} else {
ElfDeinit(&elf);- In
Dwarf.c:3374:
ElfDeinit(&elf);
} else {
ElfDeinit(&elf);
}
DefaultAllocatorDeinit(&alloc);- In
Dwarf.c:3410:
if (built)
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
bool ok = !built && (DebugAllocatorLiveCount(&dbg) == 0);- In
Dwarf.c:3460:
if (built)
DwarfLinesDeinit(&lines);
ElfDeinit(&elf);
bool ok = !built && (DebugAllocatorLiveCount(&dbg) == 0);
Last updated on