Skip to content
PdbCacheResolve

PdbCacheResolve

Description

Resolve runtime_ip to a function name.

Parameters

Name Direction Description
self in,out Cache. Grows on first sight of module_path.
module_path in Path to the loaded PE for the address being resolved. Caller-owned; we copy it.
module_base in Runtime virtual address of the module’s load point. ip - module_base is the RVA.
runtime_ip in Address to resolve.
out_name out On success, pointer to the function name (borrowed from the cached PDB; valid until the next PdbCacheDeinit).
out_offset out On success, byte offset from the function start (rva - function.rva).

Success

Returns true.

Failure

Returns false if the module can’t be opened, no PDB pairs with it, or the RVA falls outside every public function.

Usage example (Cross-references)

Usage examples (Cross-references)
        const char *name        = NULL;
        u32         offset      = 0;
        bool        ok          = PdbCacheResolve(&cache, pe_path, module_base, ip, &name, &offset);
        ok                      = ok && name && ZstrCompare(name, "winproc") == 0 && offset == 0;
        name          = NULL;
        offset        = 0;
        ok            = ok && PdbCacheResolve(&cache, pe_path, module_base, ip2, &name, &offset);
        ok            = ok && name && ZstrCompare(name, "winproc") == 0 && offset == 0x10;
        PdbCacheInit(&cache, base);
        const char *name = NULL;
        bool        ok   = !PdbCacheResolve(&cache, missing, 0, 0x1000, &name, NULL);
        PdbCacheDeinit(&cache);
        DefaultAllocatorDeinit(&alloc);
    }
    
    bool PdbCacheResolve(
        PdbCache    *self,
        const char  *module_path,
                u64  module_base = 0;
                if (win_module_for_ip(frames[i].ip, module_path, sizeof(module_path), &module_base)) {
                    if (PdbCacheResolve(&pdb_cache, module_path, module_base, (u64)ip, &sym_name, &sym_off)) {
                        named = true;
                    }
Last updated on