ResolvedSymbol
Description
Per-resolve output. All string fields are borrowed from internal state and remain valid until the next call (which may rebuild the cache) or SymbolResolverDestroy.
Fields
| Name | Description |
|---|---|
module_path |
Backing file of the loaded ELF that contains addr, or NULL if no mapping was found. |
module_base |
Lowest mapped virtual address for that file. |
symbol_name |
Name of the enclosing symbol, or NULL if the address landed inside the module but outside any named symbol’s range. |
symbol_value |
st_value of the matching symbol (file-relative). |
symbol_size |
st_size of the matching symbol. |
offset |
addr minus the start of the matching symbol. If no symbol matched, the offset from module_base. |
source_file |
When MISRA_HAVE_PARSER_DWARF is on and the module ships .debug_line data we understand, this is the source file containing addr. NULL otherwise. |
source_dir |
Compilation directory hint paired with source_file. May be NULL. |
source_line |
1-based source line, or 0 if unknown. |
source_column |
1-based source column, or 0 if unknown. |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Dwarf.c:52:
}
ResolvedSymbol r;
if (!SymbolResolverResolve(&res, (void *)&dwarf_marker_helper, &r)) {
SymbolResolverDeinit(&res); }
ResolvedSymbol r;
bool ok = SymbolResolverResolve(&res, (void *)&test_symres_resolve_self, &r);
ok = ok && r.module_path && r.module_path[0] != '\0'; // Static functions don't appear in .dynsym but do appear in
// .symtab. libc dladdr would fail to name this; we should not.
ResolvedSymbol r;
bool ok = SymbolResolverResolve(&res, (void *)&symres_marker_helper, &r);
ok = ok && r.symbol_name != NULL && ZstrFindSubstring(r.symbol_name, "symres_marker_helper") != NULL;- In
Backtrace.c:174:
}
static void emit_resolved_line(Str *out, u32 idx, const ResolvedSymbol *r, void *ip) {
if (r->symbol_name) {
const char *mod = basename_of(r->module_path);- In
Backtrace.c:200:
return;
for (size i = 0; i < count; ++i) {
ResolvedSymbol r;
if (SymbolResolverResolve(resolver, frames[i].ip, &r)) {
emit_resolved_line(out, (u32)i, &r, frames[i].ip); // ---------------------------------------------------------------------------
bool SymbolResolverResolve(SymbolResolver *self, void *runtime_addr, ResolvedSymbol *out) {
if (!self || !out)
return false; u32 source_line;
u32 source_column;
} ResolvedSymbol;
typedef struct ResolverCacheEntry { /// TAGS: Sys, Symbol, Resolver
///
bool SymbolResolverResolve(SymbolResolver *self, void *runtime_addr, ResolvedSymbol *out);
#endif // MISRA_SYS_SYMBOL_RESOLVER_H
Last updated on