Skip to content
SymbolResolverInit

SymbolResolverInit

Description

Initialize a SymbolResolver for the current process. Loads /proc/self/maps once at create time. New ELF files are opened lazily on demand and cached for the resolver’s lifetime.

Parameters

Name Direction Description
out out Populated on success.
alloc in Allocator backing the ProcMaps, the cache, and any opened ELF files. Must outlive the resolver.

Success

Returns true.

Failure

Returns false if /proc/self/maps can’t be loaded. out is left zeroed.

Usage example (Cross-references)

Usage examples (Cross-references)
    bool symbol_resolver_init(SymbolResolver *out, Allocator *alloc) {
        if (!out || !alloc) {
            LOG_FATAL("SymbolResolverInit: NULL argument");
        }
        MemSet(out, 0, sizeof(*out));
    static void format_walk_alloc(Str *out, const StackFrame *frames, size count, Allocator *alloc) {
        SymbolResolver res;
        if (!SymbolResolverInit(&res, alloc)) {
            for (size i = 0; i < count; ++i) {
                StrAppendFmt(out, "  #{} {x}\n", (u32)i, (u64)frames[i].ip);
    
        SymbolResolver res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc)))
            return false;
        DefaultAllocator alloc = DefaultAllocatorInit();
        SymbolResolver   res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DefaultAllocatorDeinit(&alloc);
            return false;
        DefaultAllocator alloc = DefaultAllocatorInit();
        SymbolResolver   res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DefaultAllocatorDeinit(&alloc);
            return false;
        DefaultAllocator alloc = DefaultAllocatorInit();
        SymbolResolver   res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DefaultAllocatorDeinit(&alloc);
            return false;
        DefaultAllocator alloc = DefaultAllocatorInit();
        SymbolResolver   res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DefaultAllocatorDeinit(&alloc);
            return false;
        DefaultAllocator alloc = DefaultAllocatorInit();
        SymbolResolver   res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DefaultAllocatorDeinit(&alloc);
            return false;
        DefaultAllocator alloc = DefaultAllocatorInit();
        SymbolResolver   res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DefaultAllocatorDeinit(&alloc);
            return false;
        DefaultAllocator alloc = DefaultAllocatorInit();
        SymbolResolver   res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DefaultAllocatorDeinit(&alloc);
            return false;
        DefaultAllocator alloc = DefaultAllocatorInit();
        SymbolResolver   res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DefaultAllocatorDeinit(&alloc);
            return false;
        DefaultAllocator alloc = DefaultAllocatorInit();
        SymbolResolver   res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DefaultAllocatorDeinit(&alloc);
            return false;
        SymbolResolver   res;
    
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DefaultAllocatorDeinit(&alloc);
            return false;
        SymbolResolver   res;
    
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DefaultAllocatorDeinit(&alloc);
            return false;
        DebugAllocator alloc = DebugAllocatorInit();
        SymbolResolver res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DebugAllocatorDeinit(&alloc);
            return false;
        DebugAllocator alloc = DebugAllocatorInit();
        SymbolResolver res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DebugAllocatorDeinit(&alloc);
            return false;
        DebugAllocator alloc = DebugAllocatorInit();
        SymbolResolver res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DebugAllocatorDeinit(&alloc);
            return false;
        DebugAllocator alloc = DebugAllocatorInit();
        SymbolResolver res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DebugAllocatorDeinit(&alloc);
            return false;
    
        SymbolResolver res;
        if (!SymbolResolverInit(&res, ALLOCATOR_OF(&alloc))) {
            DebugAllocatorDeinit(&alloc);
            return false;
    
        SymbolResolver res;
        if (!SymbolResolverInit(&res, alloc_base)) {
            DefaultAllocatorDeinit(&alloc);
            return false;
    
        SymbolResolver res;
        if (!SymbolResolverInit(&res, alloc_base)) {
            DefaultAllocatorDeinit(&alloc);
            return false;
    
        SymbolResolver res;
        if (!SymbolResolverInit(&res, alloc_base)) {
            DefaultAllocatorDeinit(&alloc);
            return false;
        // (1) Find this process's load base for /proc/self/exe.
        SymbolResolver res;
        if (!SymbolResolverInit(&res, base)) {
            DefaultAllocatorDeinit(&alloc);
            return false;
    
        SymbolResolver res;
        if (!SymbolResolverInit(&res, base)) {
            DefaultAllocatorDeinit(&alloc);
            return false;
    
        SymbolResolver res;
        if (!SymbolResolverInit(&res, base)) {
            DefaultAllocatorDeinit(&alloc);
            return false;
    
        SymbolResolver res;
        if (!SymbolResolverInit(&res, base)) {
            DefaultAllocatorDeinit(&alloc);
            return false;
Last updated on