Skip to content
SymbolResolverResolve

SymbolResolverResolve

Description

Resolve a runtime instruction pointer to a symbol.

Parameters

Name Direction Description
self in,out Resolver. The cache may grow on this call.
runtime_addr in Address to resolve, as captured at runtime.
out out Populated on success. Untouched on failure.

Success

Returns true. out->module_path is set; out->symbol_name may still be NULL if the address falls in a module range that lacks symbol coverage there.

Failure

Returns false if no loaded module contains runtime_addr, or if the resolver fails to open the backing ELF file.

Usage example (Cross-references)

Usage examples (Cross-references)
    
        ResolvedSymbol r;
        if (!SymbolResolverResolve(&res, (void *)&dwarf_marker_helper, &r)) {
            SymbolResolverDeinit(&res);
            DefaultAllocatorDeinit(&alloc);
    
        ResolvedSymbol r;
        bool           ok = SymbolResolverResolve(&res, (void *)&test_symres_resolve_self, &r);
        ok                = ok && r.module_path && r.module_path[0] != '\0';
        // We're a function so a symbol should resolve. Name may or may
        // .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;
        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);
            } else {
    // ---------------------------------------------------------------------------
    
    bool SymbolResolverResolve(SymbolResolver *self, void *runtime_addr, ResolvedSymbol *out) {
        if (!self || !out)
            return false;
Last updated on