new debug info loading layer debugging & fixes

This commit is contained in:
Ryan Fleury
2025-09-29 15:07:08 -07:00
parent 08904c9e2d
commit 92809ee6b6
3 changed files with 38 additions and 29 deletions
+20 -16
View File
@@ -27,12 +27,12 @@ di2_init(void)
Arena *arena = arena_alloc();
di2_shared = push_array(arena, DI2_Shared, 1);
di2_shared->arena = arena;
di2_shared->key_slots_count = 4096;
di2_shared->key_slots = push_array(arena, DI2_KeySlot, di2_shared->key_slots_count);
di2_shared->key_stripes = stripe_array_alloc(arena);
di2_shared->key_path_slots_count = 4096;
di2_shared->key_path_slots = push_array(arena, DI2_KeySlot, di2_shared->key_path_slots_count);
di2_shared->key_path_stripes = stripe_array_alloc(arena);
di2_shared->key2path_slots_count = 4096;
di2_shared->key2path_slots = push_array(arena, DI2_KeySlot, di2_shared->key2path_slots_count);
di2_shared->key2path_stripes = stripe_array_alloc(arena);
di2_shared->path2key_slots_count = 4096;
di2_shared->path2key_slots = push_array(arena, DI2_KeySlot, di2_shared->path2key_slots_count);
di2_shared->path2key_stripes = stripe_array_alloc(arena);
di2_shared->slots_count = 4096;
di2_shared->slots = push_array(arena, DI2_Slot, di2_shared->slots_count);
di2_shared->stripes = stripe_array_alloc(arena);
@@ -51,9 +51,9 @@ di2_key_from_path_timestamp(String8 path, U64 min_timestamp)
{
//- rjf: unpack key
U64 hash = u64_hash_from_str8(path);
U64 slot_idx = hash%di2_shared->key_slots_count;
DI2_KeySlot *slot = &di2_shared->key_slots[slot_idx];
Stripe *stripe = stripe_from_slot_idx(&di2_shared->key_stripes, slot_idx);
U64 slot_idx = hash%di2_shared->path2key_slots_count;
DI2_KeySlot *slot = &di2_shared->path2key_slots[slot_idx];
Stripe *stripe = stripe_from_slot_idx(&di2_shared->path2key_stripes, slot_idx);
//- rjf: look up key, create if needed
DI2_Key key = {0};
@@ -117,6 +117,7 @@ di2_key_from_path_timestamp(String8 path, U64 min_timestamp)
B32 is_pdb = 0;
if(!is_pdb)
{
read_only local_persist char msf_msf20_magic[] = "Microsoft C/C++ program database 2.00\r\n\x1aJG\0\0";
U8 msf20_magic_maybe[sizeof(msf_msf20_magic)] = {0};
os_file_read(file, r1u64(0, sizeof(msf20_magic_maybe)), msf20_magic_maybe);
if(MemoryMatch(msf20_magic_maybe, msf_msf20_magic, sizeof(msf20_magic_maybe)))
@@ -126,6 +127,7 @@ di2_key_from_path_timestamp(String8 path, U64 min_timestamp)
}
if(!is_pdb)
{
read_only local_persist char msf_msf70_magic[] = "Microsoft C/C++ MSF 7.00\r\n\032DS\0\0";
U8 msf70_magic_maybe[sizeof(msf_msf70_magic)] = {0};
os_file_read(file, r1u64(0, sizeof(msf70_magic_maybe)), msf70_magic_maybe);
if(MemoryMatch(msf70_magic_maybe, msf_msf70_magic, sizeof(msf70_magic_maybe)))
@@ -154,9 +156,9 @@ di2_key_from_path_timestamp(String8 path, U64 min_timestamp)
if(made_key)
{
U64 key_hash = u64_hash_from_str8(str8_struct(&key));
U64 key_slot_idx = key_hash%di2_shared->key_path_slots_count;
DI2_KeySlot *key_slot = &di2_shared->key_path_slots[key_slot_idx];
Stripe *key_stripe = stripe_from_slot_idx(&di2_shared->key_path_stripes, key_slot_idx);
U64 key_slot_idx = key_hash%di2_shared->key2path_slots_count;
DI2_KeySlot *key_slot = &di2_shared->key2path_slots[key_slot_idx];
Stripe *key_stripe = stripe_from_slot_idx(&di2_shared->key2path_stripes, key_slot_idx);
RWMutexScope(key_stripe->rw_mutex, 1)
{
DI2_KeyNode *node = 0;
@@ -486,9 +488,9 @@ di2_async_tick(void)
//- rjf: unpack key
DI2_Key key = t->key;
U64 key_hash = u64_hash_from_str8(str8_struct(&key));
U64 key_slot_idx = key_hash%di2_shared->key_slots_count;
DI2_KeySlot *key_slot = &di2_shared->key_slots[key_slot_idx];
Stripe *key_stripe = stripe_from_slot_idx(&di2_shared->key_stripes, key_slot_idx);
U64 key_slot_idx = key_hash%di2_shared->key2path_slots_count;
DI2_KeySlot *key_slot = &di2_shared->key2path_slots[key_slot_idx];
Stripe *key_stripe = stripe_from_slot_idx(&di2_shared->key2path_stripes, key_slot_idx);
//- rjf: get key's O.G. path
String8 og_path = {0};
@@ -646,6 +648,8 @@ di2_async_tick(void)
}
}
}
lane_sync_u64(&parse_tasks, 0);
lane_sync_u64(&parse_tasks_count, 0);
lane_sync();
//////////////////////////////
@@ -662,7 +666,7 @@ di2_async_tick(void)
for(;;)
{
//- rjf: take next task
U64 parse_task_idx = ins_atomic_u64_inc_eval(parse_task_take_counter_ptr);
U64 parse_task_idx = ins_atomic_u64_inc_eval(parse_task_take_counter_ptr) - 1;
if(parse_task_idx >= parse_tasks_count)
{
break;
+7 -7
View File
@@ -135,14 +135,14 @@ struct DI2_Shared
Arena *arena;
// rjf: key -> path cache
U64 key_slots_count;
DI2_KeySlot *key_slots;
StripeArray key_stripes;
U64 key2path_slots_count;
DI2_KeySlot *key2path_slots;
StripeArray key2path_stripes;
// rjf: path -> key cache
U64 key_path_slots_count;
DI2_KeySlot *key_path_slots;
StripeArray key_path_stripes;
U64 path2key_slots_count;
DI2_KeySlot *path2key_slots;
StripeArray path2key_stripes;
// rjf: debug info cache
U64 slots_count;
@@ -179,7 +179,7 @@ internal void di2_init(void);
////////////////////////////////
//~ rjf: Path * Timestamp Cache Submission & Lookup
internal DI2_Key di2_key_from_path_timestamp(String8 path, U64 timestamp);
internal DI2_Key di2_key_from_path_timestamp(String8 path, U64 min_timestamp);
////////////////////////////////
//~ rjf: Debug Info Opening / Closing
+11 -6
View File
@@ -16,6 +16,8 @@
#include "content/content.h"
#include "artifact_cache/artifact_cache.h"
#include "file_stream/file_stream.h"
#include "rdi/rdi_local.h"
#include "dbg_info/dbg_info2.h"
//- rjf: [c]
#include "base/base_inc.c"
@@ -23,6 +25,8 @@
#include "content/content.c"
#include "artifact_cache/artifact_cache.c"
#include "file_stream/file_stream.c"
#include "rdi/rdi_local.c"
#include "dbg_info/dbg_info2.c"
////////////////////////////////
//~ rjf: Entry Point
@@ -30,15 +34,16 @@
internal void
entry_point(CmdLine *cmdline)
{
DI2_Key key = di2_key_from_path_timestamp(str8_lit("C:/devel/raddebugger/build/raddbg.pdb"), 0);
di2_open(key);
for(;;)
{
C_Key key = fs_key_from_path(str8_lit("C:/devel/raddebugger/build/x.dump"), os_now_microseconds() + 100000);
U128 hash = c_hash_from_key(key, 0);
printf("hash: 0x%I64x, 0x%I64x\n", hash.u64[0], hash.u64[1]);
fflush(stdout);
if(!u128_match(u128_zero(), hash))
Access *access = access_open();
RDI_Parsed *rdi = di2_rdi_from_key(access, key, 1, 0);
if(rdi != &rdi_parsed_nil)
{
break;
int x = 0;
}
access_close(access);
}
}