mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
extend id -> handle cons APIs with separate hash channel, so usage code completely controls both unique IDs and how they're hashed; second pass at designing better local variable hashing function
This commit is contained in:
+1
-1
@@ -74,7 +74,7 @@ commands =
|
||||
},
|
||||
.rjf_f4 =
|
||||
{
|
||||
.win = "build raddbg_from_pdb release telemetry && pushd build && raddbg_from_pdb.exe --exe:raddbg.exe --pdb:raddbg.pdb --out:raddbg.raddbg --capture && popd",
|
||||
.win = "build raddbg_from_pdb telemetry && pushd build && raddbg_from_pdb.exe --exe:raddbg.exe --pdb:raddbg.pdb --out:raddbg.raddbg --capture && popd",
|
||||
.linux = "",
|
||||
.out = "*compilation*",
|
||||
.footer_panel = true,
|
||||
|
||||
@@ -516,9 +516,10 @@ cons_add_binary_section(CONS_Root *root, String8 name, RADDBG_BinarySectionFlags
|
||||
// units
|
||||
|
||||
static CONS_Unit*
|
||||
cons_unit_handle_from_user_id(CONS_Root *root, U64 unit_user_id){
|
||||
cons_unit_handle_from_user_id(CONS_Root *root, U64 unit_user_id, U64 unit_user_id_hash){
|
||||
ProfBeginFunction();
|
||||
CONS__U64ToPtrLookup lookup = {0};
|
||||
cons__u64toptr_lookup(&root->unit_map, unit_user_id, unit_user_id, &lookup);
|
||||
cons__u64toptr_lookup(&root->unit_map, unit_user_id, unit_user_id_hash, &lookup);
|
||||
|
||||
CONS_Unit *result = 0;
|
||||
if (lookup.match != 0){
|
||||
@@ -532,6 +533,7 @@ cons_unit_handle_from_user_id(CONS_Root *root, U64 unit_user_id){
|
||||
cons__u64toptr_insert(root->arena, &root->unit_map, unit_user_id, unit_user_id, &lookup, result);
|
||||
}
|
||||
|
||||
ProfEnd();
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -588,26 +590,28 @@ cons_unit_vmap_add_range(CONS_Root *root, CONS_Unit *unit, U64 first, U64 opl){
|
||||
// types
|
||||
|
||||
static CONS_Type*
|
||||
cons_type_from_id(CONS_Root *root, U64 type_user_id){
|
||||
cons_type_from_id(CONS_Root *root, U64 type_user_id, U64 type_user_id_hash){
|
||||
CONS__U64ToPtrLookup lookup = {0};
|
||||
cons__u64toptr_lookup(&root->type_from_id_map, type_user_id, type_user_id, &lookup);
|
||||
cons__u64toptr_lookup(&root->type_from_id_map, type_user_id, type_user_id_hash, &lookup);
|
||||
|
||||
CONS_Type *result = (CONS_Type*)lookup.match;
|
||||
return(result);
|
||||
}
|
||||
|
||||
static CONS_Reservation*
|
||||
cons_type_reserve_id(CONS_Root *root, U64 type_user_id){
|
||||
cons_type_reserve_id(CONS_Root *root, U64 type_user_id, U64 type_user_id_hash){
|
||||
ProfBeginFunction();
|
||||
CONS__U64ToPtrLookup lookup = {0};
|
||||
cons__u64toptr_lookup(&root->type_from_id_map, type_user_id, type_user_id, &lookup);
|
||||
cons__u64toptr_lookup(&root->type_from_id_map, type_user_id, type_user_id_hash, &lookup);
|
||||
|
||||
CONS_Reservation *result = 0;
|
||||
if (lookup.match == 0){
|
||||
cons__u64toptr_insert(root->arena, &root->type_from_id_map, type_user_id, type_user_id, &lookup, root->nil_type);
|
||||
cons__u64toptr_insert(root->arena, &root->type_from_id_map, type_user_id, type_user_id_hash, &lookup, root->nil_type);
|
||||
void **slot = &lookup.fill_node->ptr[lookup.fill_k];
|
||||
result = (CONS_Reservation*)slot;
|
||||
}
|
||||
|
||||
ProfEnd();
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -1317,10 +1321,10 @@ cons_type_list_push(Arena *arena, CONS_TypeList *list, CONS_Type *type){
|
||||
// symbols
|
||||
|
||||
static CONS_Symbol*
|
||||
cons_symbol_handle_from_user_id(CONS_Root *root, U64 symbol_user_id){
|
||||
cons_symbol_handle_from_user_id(CONS_Root *root, U64 symbol_user_id, U64 symbol_user_id_hash){
|
||||
ProfBeginFunction();
|
||||
CONS__U64ToPtrLookup lookup = {0};
|
||||
U64 symbol_hash = raddbg_hash((U8 *)&symbol_user_id, sizeof(symbol_user_id));
|
||||
cons__u64toptr_lookup(&root->symbol_map, symbol_user_id, symbol_hash, &lookup);
|
||||
cons__u64toptr_lookup(&root->symbol_map, symbol_user_id, symbol_user_id_hash, &lookup);
|
||||
|
||||
CONS_Symbol *result = 0;
|
||||
if (lookup.match != 0){
|
||||
@@ -1330,9 +1334,10 @@ cons_symbol_handle_from_user_id(CONS_Root *root, U64 symbol_user_id){
|
||||
result = push_array(root->arena, CONS_Symbol, 1);
|
||||
SLLQueuePush_N(root->first_symbol, root->last_symbol, result, next_order);
|
||||
root->symbol_count += 1;
|
||||
cons__u64toptr_insert(root->arena, &root->symbol_map, symbol_user_id, symbol_hash, &lookup, result);
|
||||
cons__u64toptr_insert(root->arena, &root->symbol_map, symbol_user_id, symbol_user_id_hash, &lookup, result);
|
||||
}
|
||||
|
||||
ProfEnd();
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -1429,9 +1434,10 @@ cons_symbol_set_info(CONS_Root *root, CONS_Symbol *symbol, CONS_SymbolInfo *info
|
||||
// scopes
|
||||
|
||||
static CONS_Scope*
|
||||
cons_scope_handle_from_user_id(CONS_Root *root, U64 scope_user_id){
|
||||
cons_scope_handle_from_user_id(CONS_Root *root, U64 scope_user_id, U64 scope_user_id_hash){
|
||||
ProfBeginFunction();
|
||||
CONS__U64ToPtrLookup lookup = {0};
|
||||
cons__u64toptr_lookup(&root->scope_map, scope_user_id, scope_user_id, &lookup);
|
||||
cons__u64toptr_lookup(&root->scope_map, scope_user_id, scope_user_id_hash, &lookup);
|
||||
|
||||
CONS_Scope *result = 0;
|
||||
if (lookup.match != 0){
|
||||
@@ -1442,9 +1448,10 @@ cons_scope_handle_from_user_id(CONS_Root *root, U64 scope_user_id){
|
||||
result->idx = root->scope_count;
|
||||
SLLQueuePush_N(root->first_scope, root->last_scope, result, next_order);
|
||||
root->scope_count += 1;
|
||||
cons__u64toptr_insert(root->arena, &root->scope_map, scope_user_id, scope_user_id, &lookup, result);
|
||||
cons__u64toptr_insert(root->arena, &root->scope_map, scope_user_id, scope_user_id_hash, &lookup, result);
|
||||
}
|
||||
|
||||
ProfEnd();
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -1477,10 +1484,10 @@ cons_scope_add_voff_range(CONS_Root *root, CONS_Scope *scope, U64 voff_first, U6
|
||||
// locals
|
||||
|
||||
static CONS_Local*
|
||||
cons_local_handle_from_user_id(CONS_Root *root, U64 local_user_id){
|
||||
cons_local_handle_from_user_id(CONS_Root *root, U64 local_user_id, U64 local_user_id_hash){
|
||||
ProfBeginFunction();
|
||||
CONS__U64ToPtrLookup lookup = {0};
|
||||
U64 local_hash = (local_user_id<<4) ^ (local_user_id>>3) ^ (((local_user_id&0xffffffff00000000ull)>>32));
|
||||
cons__u64toptr_lookup(&root->local_map, local_user_id, local_hash, &lookup);
|
||||
cons__u64toptr_lookup(&root->local_map, local_user_id, local_user_id_hash, &lookup);
|
||||
|
||||
CONS_Local *result = 0;
|
||||
if (lookup.match != 0){
|
||||
@@ -1488,9 +1495,10 @@ cons_local_handle_from_user_id(CONS_Root *root, U64 local_user_id){
|
||||
}
|
||||
else{
|
||||
result = push_array(root->arena, CONS_Local, 1);
|
||||
cons__u64toptr_insert(root->arena, &root->local_map, local_user_id, local_hash, &lookup, result);
|
||||
cons__u64toptr_insert(root->arena, &root->local_map, local_user_id, local_user_id_hash, &lookup, result);
|
||||
}
|
||||
|
||||
ProfEnd();
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -1802,7 +1810,6 @@ cons__u64toptr_init(Arena *arena, CONS__U64ToPtrMap *map, U64 bucket_count){
|
||||
|
||||
static void
|
||||
cons__u64toptr_lookup(CONS__U64ToPtrMap *map, U64 key, U64 hash, CONS__U64ToPtrLookup *lookup_out){
|
||||
ProfBeginFunction();
|
||||
U64 bucket_idx = hash&(map->buckets_count - 1);
|
||||
CONS__U64ToPtrNode *check_node = map->buckets[bucket_idx];
|
||||
for (;check_node != 0; check_node = check_node->next){
|
||||
@@ -1818,7 +1825,6 @@ cons__u64toptr_lookup(CONS__U64ToPtrMap *map, U64 key, U64 hash, CONS__U64ToPtrL
|
||||
}
|
||||
}
|
||||
}
|
||||
ProfEnd();
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -101,7 +101,7 @@ static void cons_add_binary_section(CONS_Root *root,
|
||||
|
||||
|
||||
// units
|
||||
static CONS_Unit* cons_unit_handle_from_user_id(CONS_Root *root, U64 unit_user_id);
|
||||
static CONS_Unit* cons_unit_handle_from_user_id(CONS_Root *root, U64 unit_user_id, U64 unit_user_id_hash);
|
||||
|
||||
typedef struct CONS_UnitInfo{
|
||||
String8 unit_name;
|
||||
@@ -130,8 +130,8 @@ static void cons_unit_vmap_add_range(CONS_Root *root, CONS_Unit *unit, U64 first
|
||||
|
||||
|
||||
// types
|
||||
static CONS_Type* cons_type_from_id(CONS_Root *root, U64 type_user_id);
|
||||
static CONS_Reservation* cons_type_reserve_id(CONS_Root *root, U64 type_user_id);
|
||||
static CONS_Type* cons_type_from_id(CONS_Root *root, U64 type_user_id, U64 type_user_id_hash);
|
||||
static CONS_Reservation* cons_type_reserve_id(CONS_Root *root, U64 type_user_id, U64 type_user_id_hash);
|
||||
static void cons_type_fill_id(CONS_Root *root, CONS_Reservation *res, CONS_Type *type);
|
||||
|
||||
static B32 cons_type_is_unhandled_nil(CONS_Root *root, CONS_Type *type);
|
||||
@@ -190,7 +190,7 @@ static void cons_type_set_source_coordinates(CONS_Root *root, CONS_Type *defined
|
||||
static void cons_type_list_push(Arena *arena, CONS_TypeList *list, CONS_Type *type);
|
||||
|
||||
// symbols
|
||||
static CONS_Symbol* cons_symbol_handle_from_user_id(CONS_Root *root, U64 symbol_user_id);
|
||||
static CONS_Symbol* cons_symbol_handle_from_user_id(CONS_Root *root, U64 symbol_user_id, U64 symbol_user_id_hash);
|
||||
|
||||
typedef enum{
|
||||
CONS_SymbolKind_NULL,
|
||||
@@ -216,13 +216,13 @@ typedef struct CONS_SymbolInfo{
|
||||
static void cons_symbol_set_info(CONS_Root *root, CONS_Symbol *symbol, CONS_SymbolInfo *info);
|
||||
|
||||
// scopes
|
||||
static CONS_Scope *cons_scope_handle_from_user_id(CONS_Root *root, U64 scope_user_id);
|
||||
static CONS_Scope *cons_scope_handle_from_user_id(CONS_Root *root, U64 scope_user_id, U64 scope_user_id_hash);
|
||||
|
||||
static void cons_scope_set_parent(CONS_Root *root, CONS_Scope *scope, CONS_Scope *parent);
|
||||
static void cons_scope_add_voff_range(CONS_Root *root, CONS_Scope *scope, U64 voff_first, U64 voff_opl);
|
||||
|
||||
// locals
|
||||
static CONS_Local* cons_local_handle_from_user_id(CONS_Root *root, U64 local_user_id);
|
||||
static CONS_Local* cons_local_handle_from_user_id(CONS_Root *root, U64 local_user_id, U64 local_user_id_hash);
|
||||
|
||||
typedef struct CONS_LocalInfo{
|
||||
RADDBG_LocalKind kind;
|
||||
|
||||
@@ -220,7 +220,7 @@ pdbconv_type_cons_main_passes(PDBCONV_Ctx *ctx){
|
||||
ProfScope("setup variadic itype -> node")
|
||||
{
|
||||
CONS_Type *variadic_type = cons_type_variadic(ctx->root);
|
||||
CONS_Reservation *res = cons_type_reserve_id(ctx->root, CV_TypeId_Variadic);
|
||||
CONS_Reservation *res = cons_type_reserve_id(ctx->root, CV_TypeId_Variadic, CV_TypeId_Variadic);
|
||||
cons_type_fill_id(ctx->root, res, variadic_type);
|
||||
}
|
||||
|
||||
@@ -419,27 +419,35 @@ pdbconv_type_resolve_itype(PDBCONV_Ctx *ctx, CV_TypeId itype){
|
||||
ProfBeginFunction();
|
||||
|
||||
// convert fwd references to real types
|
||||
ProfBegin("fwd map get");
|
||||
CV_TypeId resolved_itype = pdbconv_type_fwd_map_get(&ctx->fwd_map, itype);
|
||||
if (resolved_itype != 0){
|
||||
itype = resolved_itype;
|
||||
}
|
||||
ProfEnd();
|
||||
|
||||
// type handle from id
|
||||
CONS_Type *result = cons_type_from_id(ctx->root, itype);
|
||||
ProfBegin("id -> handle");
|
||||
CONS_Type *result = cons_type_from_id(ctx->root, itype, itype);
|
||||
ProfEnd();
|
||||
|
||||
// basic type
|
||||
ProfBegin("basic type");
|
||||
if (result == 0){
|
||||
if (itype < 0x1000){
|
||||
result = pdbconv_type_cons_basic(ctx, itype);
|
||||
}
|
||||
}
|
||||
ProfEnd();
|
||||
|
||||
// leaf decode
|
||||
ProfBegin("leaf decode");
|
||||
if (result == 0){
|
||||
if (ctx->leaf->itype_first <= itype && itype < ctx->leaf->itype_opl){
|
||||
result = pdbconv_type_cons_leaf_record(ctx, itype);
|
||||
}
|
||||
}
|
||||
ProfEnd();
|
||||
|
||||
// never return null, return "nil" instead
|
||||
if (result == 0){
|
||||
@@ -967,13 +975,12 @@ pdbconv_type_equip_enumerates(PDBCONV_Ctx *ctx, CONS_Type *owner_type, CV_TypeId
|
||||
|
||||
static CONS_Type*
|
||||
pdbconv_type_cons_basic(PDBCONV_Ctx *ctx, CV_TypeId itype){
|
||||
ProfBeginFunction();
|
||||
Assert(itype < 0x1000);
|
||||
|
||||
CV_BasicPointerKind basic_ptr_kind = CV_BasicPointerKindFromTypeId(itype);
|
||||
CV_BasicType basic_type_code = CV_BasicTypeFromTypeId(itype);
|
||||
|
||||
CONS_Reservation *basic_res = cons_type_reserve_id(ctx->root, basic_type_code);
|
||||
CONS_Reservation *basic_res = cons_type_reserve_id(ctx->root, basic_type_code, basic_type_code);
|
||||
|
||||
CONS_Type *basic_type = 0;
|
||||
switch (basic_type_code){
|
||||
@@ -1147,7 +1154,7 @@ pdbconv_type_cons_basic(PDBCONV_Ctx *ctx, CV_TypeId itype){
|
||||
// wrap in constructed type
|
||||
CONS_Type *constructed_type = 0;
|
||||
if (basic_ptr_kind != 0 && basic_type != 0){
|
||||
CONS_Reservation *constructed_res = cons_type_reserve_id(ctx->root, itype);
|
||||
CONS_Reservation *constructed_res = cons_type_reserve_id(ctx->root, itype, itype);
|
||||
|
||||
switch (basic_ptr_kind){
|
||||
case CV_BasicPointerKind_16BIT:
|
||||
@@ -1171,16 +1178,14 @@ pdbconv_type_cons_basic(PDBCONV_Ctx *ctx, CV_TypeId itype){
|
||||
result = constructed_type;
|
||||
}
|
||||
|
||||
ProfEnd();
|
||||
return(result);
|
||||
}
|
||||
|
||||
static CONS_Type*
|
||||
pdbconv_type_cons_leaf_record(PDBCONV_Ctx *ctx, CV_TypeId itype){
|
||||
ProfBeginFunction();
|
||||
Assert(ctx->leaf->itype_first <= itype && itype < ctx->leaf->itype_opl);
|
||||
|
||||
CONS_Reservation *res = cons_type_reserve_id(ctx->root, itype);
|
||||
CONS_Reservation *res = cons_type_reserve_id(ctx->root, itype, itype);
|
||||
|
||||
CV_RecRange *range = &ctx->leaf->leaf_ranges.ranges[itype - ctx->leaf->itype_first];
|
||||
String8 data = ctx->leaf->data;
|
||||
@@ -1696,7 +1701,6 @@ pdbconv_type_cons_leaf_record(PDBCONV_Ctx *ctx, CV_TypeId itype){
|
||||
|
||||
cons_type_fill_id(ctx->root, res, result);
|
||||
|
||||
ProfEnd();
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -1747,7 +1751,7 @@ static CONS_Type*
|
||||
pdbconv_type_from_name(PDBCONV_Ctx *ctx, String8 name){
|
||||
// TODO(rjf): no idea if this is correct
|
||||
CV_TypeId cv_type_id = pdb_tpi_first_itype_from_name(ctx->hash, ctx->leaf, name, 0);
|
||||
CONS_Type *result = cons_type_from_id(ctx->root, cv_type_id);
|
||||
CONS_Type *result = cons_type_from_id(ctx->root, cv_type_id, cv_type_id);
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -1807,6 +1811,13 @@ pdbconv_type_fwd_map_get(PDBCONV_FwdMap *map, CV_TypeId key){
|
||||
|
||||
//- symbols
|
||||
|
||||
static U64
|
||||
pdbconv_hash_from_symbol_user_id(U64 user_id)
|
||||
{
|
||||
U64 hash = user_id;
|
||||
return hash;
|
||||
}
|
||||
|
||||
static void
|
||||
pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id){
|
||||
ProfBeginFunction();
|
||||
@@ -1815,6 +1826,7 @@ pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id){
|
||||
// extract important values from parameters
|
||||
String8 data = sym->data;
|
||||
U64 user_id_base = (((U64)sym_unique_id) << 32);
|
||||
U64 sym_unique_id_hash = raddbg_hash((U8*)&sym_unique_id, sizeof(sym_unique_id));
|
||||
|
||||
// PASS 1: map out data associations
|
||||
ProfScope("map out data associations")
|
||||
@@ -1825,7 +1837,9 @@ pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id){
|
||||
// loop
|
||||
CV_RecRange *rec_range = sym->sym_ranges.ranges;
|
||||
CV_RecRange *opl = rec_range + sym->sym_ranges.count;
|
||||
for (;rec_range < opl; rec_range += 1){
|
||||
U64 symbol_num = 1;
|
||||
for(;rec_range < opl; rec_range += 1)
|
||||
{
|
||||
// symbol data range
|
||||
U64 opl_off_raw = rec_range->off + rec_range->hdr.size;
|
||||
U64 opl_off = ClampTop(opl_off_raw, data.size);
|
||||
@@ -1863,7 +1877,8 @@ pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id){
|
||||
case CV_SymKind_GPROC32:
|
||||
{
|
||||
U64 user_id = user_id_base + off;
|
||||
current_proc = cons_symbol_handle_from_user_id(ctx->root, user_id);
|
||||
current_proc = cons_symbol_handle_from_user_id(ctx->root, user_id, user_id);
|
||||
symbol_num += 1;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@@ -1879,7 +1894,11 @@ pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id){
|
||||
// loop
|
||||
CV_RecRange *rec_range = sym->sym_ranges.ranges;
|
||||
CV_RecRange *opl = rec_range + sym->sym_ranges.count;
|
||||
for (;rec_range < opl; rec_range += 1){
|
||||
U64 symbol_num = 1;
|
||||
U64 local_num = 1;
|
||||
U64 scope_num = 1;
|
||||
for(;rec_range < opl; rec_range += 1)
|
||||
{
|
||||
// symbol data range
|
||||
U64 opl_off_raw = rec_range->off + rec_range->hdr.size;
|
||||
U64 opl_off = ClampTop(opl_off_raw, data.size);
|
||||
@@ -1933,7 +1952,8 @@ pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id){
|
||||
|
||||
// scope
|
||||
U64 user_id = user_id_base + off;
|
||||
CONS_Scope *block_scope = cons_scope_handle_from_user_id(ctx->root, user_id);
|
||||
scope_num += 1;
|
||||
CONS_Scope *block_scope = cons_scope_handle_from_user_id(ctx->root, user_id, user_id);
|
||||
cons_scope_set_parent(ctx->root, block_scope, current_scope);
|
||||
pdbconv_symbol_push_scope(ctx, block_scope, current_procedure);
|
||||
|
||||
@@ -1993,7 +2013,8 @@ pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id){
|
||||
|
||||
// cons this symbol
|
||||
U64 user_id = user_id_base + off;
|
||||
CONS_Symbol *symbol = cons_symbol_handle_from_user_id(ctx->root, user_id);
|
||||
CONS_Symbol *symbol = cons_symbol_handle_from_user_id(ctx->root, user_id, user_id);
|
||||
symbol_num += 1;
|
||||
|
||||
CONS_SymbolInfo info = zero_struct;
|
||||
info.kind = CONS_SymbolKind_GlobalVariable;
|
||||
@@ -2040,8 +2061,9 @@ pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id){
|
||||
}
|
||||
|
||||
// get this symbol handle
|
||||
U64 user_id = user_id_base + off;
|
||||
CONS_Symbol *proc_symbol = cons_symbol_handle_from_user_id(ctx->root, user_id);
|
||||
U64 proc_id = user_id_base + off;
|
||||
CONS_Symbol *proc_symbol = cons_symbol_handle_from_user_id(ctx->root, proc_id, proc_id);
|
||||
symbol_num += 1;
|
||||
|
||||
// scope
|
||||
|
||||
@@ -2050,8 +2072,10 @@ pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id){
|
||||
// it here because these scopes refer to the ranges of code that make up a
|
||||
// procedure *not* the namespaces, so a procedure's root scope always has
|
||||
// no parent.
|
||||
CONS_Scope *root_scope = cons_scope_handle_from_user_id(ctx->root, user_id);
|
||||
U64 scope_id = user_id_base + off;
|
||||
CONS_Scope *root_scope = cons_scope_handle_from_user_id(ctx->root, scope_id, scope_id);
|
||||
pdbconv_symbol_push_scope(ctx, root_scope, proc_symbol);
|
||||
scope_num += 1;
|
||||
|
||||
// set voff range
|
||||
U64 voff = 0;
|
||||
@@ -2136,15 +2160,16 @@ pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id){
|
||||
}
|
||||
|
||||
// emit local
|
||||
U64 user_id = user_id_base + off;
|
||||
CONS_Local *local_var = cons_local_handle_from_user_id(ctx->root, user_id);
|
||||
U64 local_id = user_id_base + local_num;;
|
||||
U64 local_id_hash = local_id ^ sym_unique_id_hash<<1 ^ sym_unique_id_hash<<4;
|
||||
CONS_Local *local_var = cons_local_handle_from_user_id(ctx->root, local_id, local_id_hash);
|
||||
local_num += 1;
|
||||
|
||||
CONS_LocalInfo info = {0};
|
||||
info.kind = local_kind;
|
||||
info.scope = current_scope;
|
||||
info.name = name;
|
||||
info.type = type;
|
||||
|
||||
cons_local_set_basic_info(ctx->root, local_var, &info);
|
||||
|
||||
// add location to local
|
||||
@@ -2224,7 +2249,8 @@ pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id){
|
||||
|
||||
// setup symbol
|
||||
U64 user_id = user_id_base + off;
|
||||
CONS_Symbol *symbol = cons_symbol_handle_from_user_id(ctx->root, user_id);
|
||||
CONS_Symbol *symbol = cons_symbol_handle_from_user_id(ctx->root, user_id, user_id);
|
||||
symbol_num += 1;
|
||||
|
||||
CONS_SymbolInfo info = zero_struct;
|
||||
info.kind = CONS_SymbolKind_ThreadVariable;
|
||||
@@ -2277,8 +2303,10 @@ pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id){
|
||||
}
|
||||
|
||||
// emit local
|
||||
U64 user_id = user_id_base + off;
|
||||
CONS_Local *local_var = cons_local_handle_from_user_id(ctx->root, user_id);
|
||||
U64 local_id = user_id_base + local_num;
|
||||
U64 local_id_hash = local_id ^ sym_unique_id_hash<<1 ^ sym_unique_id_hash<<4;
|
||||
CONS_Local *local_var = cons_local_handle_from_user_id(ctx->root, local_id, local_id_hash);
|
||||
local_num += 1;
|
||||
local_var->kind = local_kind;
|
||||
local_var->name = name;
|
||||
local_var->type = type;
|
||||
@@ -2512,7 +2540,8 @@ pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id){
|
||||
// if scope stack isn't empty emit an error
|
||||
{
|
||||
CONS_Scope* scope = pdbconv_symbol_current_scope(ctx);
|
||||
if (scope != 0){
|
||||
if(scope != 0)
|
||||
{
|
||||
// TODO(allen): emit error
|
||||
}
|
||||
}
|
||||
@@ -3207,7 +3236,7 @@ str8_list_pushf(arena, &out->errors, fmt, __VA_ARGS__);\
|
||||
root_params.bucket_count_units = comp_unit_count;
|
||||
root_params.bucket_count_symbols = symbol_count_prediction;
|
||||
root_params.bucket_count_scopes = symbol_count_prediction;
|
||||
root_params.bucket_count_locals = symbol_count_prediction;
|
||||
root_params.bucket_count_locals = symbol_count_prediction*2;
|
||||
root_params.bucket_count_types = tpi->itype_opl;
|
||||
root_params.bucket_count_type_constructs = tpi->itype_opl;
|
||||
|
||||
@@ -3293,7 +3322,7 @@ str8_list_pushf(arena, &out->errors, fmt, __VA_ARGS__);\
|
||||
RADDBG_Language lang = raddbg_language_from_cv_language(sym->info.language);
|
||||
|
||||
// basic per unit info
|
||||
CONS_Unit *unit_handle = cons_unit_handle_from_user_id(root, i);
|
||||
CONS_Unit *unit_handle = cons_unit_handle_from_user_id(root, i, i);
|
||||
|
||||
CONS_UnitInfo info = {0};
|
||||
info.unit_name = unit_name;
|
||||
@@ -3336,7 +3365,7 @@ str8_list_pushf(arena, &out->errors, fmt, __VA_ARGS__);\
|
||||
PDB_CompUnitContribution *contrib_opl = contrib_ptr + comp_unit_contribution_count;
|
||||
for (;contrib_ptr < contrib_opl; contrib_ptr += 1){
|
||||
if (contrib_ptr->mod < root->unit_count){
|
||||
CONS_Unit *unit_handle = cons_unit_handle_from_user_id(root, contrib_ptr->mod);
|
||||
CONS_Unit *unit_handle = cons_unit_handle_from_user_id(root, contrib_ptr->mod, contrib_ptr->mod);
|
||||
cons_unit_vmap_add_range(root, unit_handle,
|
||||
contrib_ptr->voff_first,
|
||||
contrib_ptr->voff_opl);
|
||||
|
||||
@@ -212,6 +212,7 @@ static CV_TypeId pdbconv_type_fwd_map_get(PDBCONV_FwdMap *map, CV_TypeId key);
|
||||
//- symbol info
|
||||
|
||||
// symbol info construction
|
||||
static U64 pdbconv_hash_from_symbol_user_id(U64 user_id);
|
||||
static void pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id);
|
||||
static void pdbconv_gather_link_names(PDBCONV_Ctx *ctx, CV_SymParsed *sym);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ main(int argc, char **argv){
|
||||
local_persist TCTX main_thread_tctx = {0};
|
||||
tctx_init_and_equip(&main_thread_tctx);
|
||||
#if PROFILE_TELEMETRY
|
||||
U64 tm_data_size = MB(128);
|
||||
U64 tm_data_size = MB(512);
|
||||
U8 *tm_data = os_reserve(tm_data_size);
|
||||
os_commit(tm_data, tm_data_size);
|
||||
tmLoadLibrary(TM_RELEASE);
|
||||
|
||||
Reference in New Issue
Block a user