MachoSymbol
Description
Decoded nlist_64 entry. name is borrowed from the file’s symbol string table (LC_SYMTAB.stroff).
Usage example (Cross-references)
Usage examples (Cross-references)
- In
MachO.c:161:
// Address at the function start.
const MachoSymbol *s = MachoFileResolveAddress(&m, 0x100000010ull);
bool ok = s && s->name && ZstrCompare(s->name, "my_function") == 0;- In
MachO.c:257:
u64 vaddr = runtime_addr - slide;
const MachoSymbol *sym = MachoFileResolveAddress(&m, vaddr);
bool ok = sym != NULL && sym->name != NULL &&
ZstrFindSubstring(sym->name, "test_macho_resolves_running_binary_symbol") != NULL;- In
MachoCache.c:214:
// (1) Main file's LC_SYMTAB.
const MachoSymbol *s = MachoFileResolveAddress(&entry->main, file_relative);
if (s && s->name && s->name[0]) {
*out_name = s->name;- In
MachO.c:237:
if (n_strx >= ctx->strsize)
continue; // bad index; skip
MachoSymbol sym;
sym.name = (const char *)(str_base + n_strx);
sym.value = n_value;- In
MachO.c:335:
// matched stabs with all three bits set -- N_SO / N_FUN / N_OSO /
// etc. were getting through and polluting lookups).
const MachoSymbol *MachoFileResolveAddress(const MachoFile *self, u64 vaddr) {
if (!self || self->symbols.length == 0)
return NULL;- In
MachO.c:342:
};
const MachoSymbol *best = NULL;
u64 best_value = 0;
const MachoSymbol *next_above = NULL;- In
MachO.c:344:
const MachoSymbol *best = NULL;
u64 best_value = 0;
const MachoSymbol *next_above = NULL;
u64 next_value = (u64)-1;- In
MachO.c:348:
for (size i = 0; i < self->symbols.length; ++i) {
const MachoSymbol *s = &self->symbols.data[i];
if (s->type & N_STAB_MASK)
continue; // any high bit set => STAB (debug) entry
- In
MachO.h:74:
u8 type; // n_type bitfield
u8 section_index; // n_sect, 1-based (0 = NO_SECT)
} MachoSymbol;
typedef Vec(MachoSegment) MachoSegments;- In
MachO.h:78:
typedef Vec(MachoSegment) MachoSegments;
typedef Vec(MachoSection) MachoSections;
typedef Vec(MachoSymbol) MachoSymbols;
///
- In
MachO.h:158:
/// FAILURE : Returns NULL.
///
const MachoSymbol *MachoFileResolveAddress(const MachoFile *self, u64 vaddr);
#endif // MISRA_PARSERS_MACHO_H
Last updated on