Skip to content

PdbDeinit

Description

Release storage owned by a Pdb. Safe on a zeroed struct.

Success

Returns to the caller. *self is zeroed.

Failure

Function cannot fail. NULL self is a no-op.

Usage example (Cross-references)

Usage examples (Cross-references)
        if (pe_cv->age != pdb_inf->age || MemCompare(pe_cv->guid, pdb_inf->guid, 16) != 0) {
            LOG_ERROR("PdbCache: GUID/age mismatch between PE and PDB for {}", entry->module_path);
            PdbDeinit(&entry->pdb);
            return false;
        }
            PdbCacheEntry *e = VecPtrAt(&self->entries, i);
            if (e->pdb_open)
                PdbDeinit(&e->pdb);
            if (e->pe_open)
                PeDeinit(&e->pe);
    
    fail:
        PdbDeinit(out);
        return false;
    }
    }
    
    void PdbDeinit(Pdb *self) {
        if (!self)
            return;
        ok = ok && MemCompare(pdb.info.guid, kGuid, 16) == 0;
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        }
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
            ok = PdbResolveRva(&pdb, 0x1000) == NULL;
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        if (n >= 1 && out_rva0)
            *out_rva0 = ((const PdbFunction *)VecPtrAt(&pdb.functions, 0))->rva;
        PdbDeinit(&pdb);
        return n;
    }
            ok = ok && pdb.num_streams == 3;
            ok = ok && pdb.stream_dir_size == dir_bytes;
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
        if (ok) {
            ok = (pdb.block_size == bs) && (pdb.num_streams == 2);
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
            bool opened = PdbOpenFromMemoryCopy(&pdb, g_blob, blob_len, base);
            if (opened) {
                PdbDeinit(&pdb);
                ok = false; // corrupted magic must NOT open
            }
            // Last content page (stream 1) is the final page in the blob.
            ok = pdb.num_streams == 2 && pdb.stream_sizes[1] == 28;
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
        if (ok) {
            ok = pdb.dir_stream_blocks_count == 1;
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
            if (ok)
                ok = pdb.stream_blocks[1][0] == T_DATA_PG;
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
            ok = ok && pdb.stream_blocks[1] != NULL;
            ok = ok && pdb.stream_blocks[2] != NULL;
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
                     pdb.stream_blocks[2][0] == g_mb_blockids[2];
            }
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
            ok = ok && pdb.stream_sizes[0] == 28;
            ok = ok && pdb.stream_block_counts[0] == 1;
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
        if (ok) {
            ok = pdb.num_streams == 0;
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
            ok = ok && pdb.stream_block_counts[1] == 0;
            ok = ok && pdb.stream_blocks[1] == NULL;
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
            ok = ok && pdb.stream_sizes[1] == 2000;
            ok = ok && pdb.stream_block_counts[1] == 4;
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
            ok = ok && pdb.num_streams == 1;
            ok = ok && pdb.stream_sizes[0] == PDB_NIL;
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
        }
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        }
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        }
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        }
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        }
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        }
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        }
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        }
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        ok                = ok && MemCompare(pi->guid, kGuid, 16) == 0;
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        bool ok = !open_ok;
        if (open_ok)
            PdbDeinit(&pdb);
    
        DefaultAllocatorDeinit(&alloc);
             MemCompare(pdb.info.guid, kGuid, 16) == 0;
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        bool ok = !open_ok;
        if (open_ok)
            PdbDeinit(&pdb);
    
        // Crux: the fail path must have freed every allocation, including the
        ok = VecLen(&pdb.functions) == 2;
    
        PdbDeinit(&pdb);
    
        // Everything PdbDeinit owns -- including the name pool -- must be gone.
        if (ok) {
            ok = VecLen(&pdb.functions) == 2 && pdb.info.signature == 0xfeedface;
            PdbDeinit(&pdb);
        }
        }
    
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
                ok                   = f->rva == 0x6010 && ZstrCompare(f->name, "sixth") == 0;
            }
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
        if (ok) {
            ok = VecLen(&pdb.functions) == 0;
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
                ok                   = f->rva == 0x1040 && ZstrCompare(f->name, "good") == 0;
            }
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
                ok                   = ok && c->rva == 0x1300 && c->size == 0; // last -> 0
            }
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
                ok                   = f->rva == 0x1010 && ZstrCompare(f->name, "named_fn") == 0;
            }
            PdbDeinit(&pdb);
        }
        DefaultAllocatorDeinit(&alloc);
        bool rejected = !PdbOpenFromMemoryCopy(&pdb, g_blob_m5, P5_BLOB_SIZE, base);
        if (!rejected)
            PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return rejected; // real: open rejected (walk_publics failed)
            return -1;
        int n = (int)VecLen(&pdb.functions);
        PdbDeinit(&pdb);
        return n;
    }
            ok                   = f->rva == 0x1100 && ZstrCompare(f->name, "deepblk") == 0;
        }
        PdbDeinit(&pdb);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        }
        if (opened)
            PdbDeinit(&pdb);
        // No heap write may have overrun any allocation (canary intact).
        ok = ok && DebugAllocatorOverflows(&dbg) == 0;
        }
        if (opened)
            PdbDeinit(&pdb);
        ok = ok && DebugAllocatorOverflows(&dbg) == 0;
        DebugAllocatorDeinit(&dbg);
Last updated on