first pass at using symbol server to download correct module versions for dump debugging

This commit is contained in:
Ryan Fleury committed 2026-08-27 14:14:37 -07:00
1 parent 3bab86e6af
commit 0579e0f658
7 files changed
+51 -5

No files matched your search

+30 -1
View File
@@ -3199,7 +3199,7 @@ d_ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, D_Msg *msg, D
}
//- rjf: compute local symbol server cache path for this debug info
String8 local_symbol_server_cache_path = smsv_local_path_from_key(scratch2.arena, str8_skip_last_slash(module_info->debug_info_path), module_info->debug_info_guid, module_info->debug_info_age);
String8 local_symbol_server_cache_path = smsv_local_debug_info_path_from_key(scratch2.arena, str8_skip_last_slash(module_info->debug_info_path), module_info->debug_info_guid, module_info->debug_info_age);
//- rjf: pick default initial debug info path
String8 initial_debug_info_path = {0};
@@ -4185,6 +4185,35 @@ d_ctrl_thread__open_crash_dump(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg)
}
}
// rjf: check if the local module matches the dump's version
B32 local_module_matches = 1;
{
File file = file_open(AccessFlag_Read|AccessFlag_ShareRead, module_name);
if(file_match(file, file_zero()))
{
local_module_matches = 0;
}
else
{
FileProperties props = properties_from_file(file);
FileMap map = file_map_open(AccessFlag_Read, file);
void *base = file_map_view_open(map, AccessFlag_Read, r1u64(0, props.size));
String8 data = str8((U8 *)base, props.size);
PE_BinInfo pe = pe_bin_info_from_data(scratch.arena, data);
local_module_matches = (pe.timestamp == module->time_date_stamp);
}
file_close(file);
}
// rjf: download module if needed
#if defined(SYMBOL_SERVER_H)
if(!local_module_matches)
{
module_name = smsv_local_module_path_from_key(scratch.arena, str8_skip_last_slash(module_name), module->time_date_stamp, module->image_size);
smsv_fill_local_path(module_name);
}
#endif
// rjf: unpack module file
File module_file = file_open(AccessFlag_Read|AccessFlag_ShareRead, module_name);
FileProperties module_props = properties_from_file(module_file);
+1 -1
View File
@@ -2153,7 +2153,7 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
{
Access *access = access_open();
D_ModuleInfo *info = d_info_from_module(access, params->entity);
String8 symbol_server_local_cache_path = smsv_local_path_from_key(scratch.arena, info->dbg_name, info->dbg_guid, info->dbg_age);
String8 symbol_server_local_cache_path = smsv_local_debug_info_path_from_key(scratch.arena, info->dbg_name, info->dbg_guid, info->dbg_age);
smsv_fill_local_path(symbol_server_local_cache_path);
D_Msg *msg = d_msg_list_push(scratch.arena, &ctrl_msgs);
msg->kind = D_MsgKind_SetModuleDebugInfoPath;
+1
View File
@@ -627,6 +627,7 @@ pe_bin_info_from_data(Arena *arena, String8 data)
info.arch = arch_from_coff_machine(file_header.machine);
info.image_base = image_base;
info.entry_point = entry_point;
info.timestamp = file_header.time_stamp;
info.is_pe32 = (optional_magic == PE_PE32_MAGIC);
info.subsystem = subsystem;
info.check_sum = check_sum;
+1
View File
@@ -1009,6 +1009,7 @@ struct PE_BinInfo
Arch arch;
U64 image_base;
U64 entry_point;
U32 timestamp;
B32 is_pe32;
PE_WindowsSubsystem subsystem;
U32 *check_sum;
+2 -1
View File
@@ -18,7 +18,8 @@ SMSV_Status;
internal void smsv_init(void);
internal void smsv_async_tick(void);
internal String8 smsv_cache_path(void);
internal String8 smsv_local_path_from_key(Arena *arena, String8 dbg_name, Guid guid, U64 age);
internal String8 smsv_local_module_path_from_key(Arena *arena, String8 module_name, U32 timestamp, U32 size_of_image);
internal String8 smsv_local_debug_info_path_from_key(Arena *arena, String8 dbg_name, Guid guid, U64 age);
internal void smsv_fill_local_path(String8 path);
internal SMSV_Status smsv_status_from_local_path(String8 path);
+7 -1
View File
@@ -18,7 +18,13 @@ smsv_cache_path(void)
}
internal String8
smsv_local_path_from_key(Arena *arena, String8 dbg_name, Guid guid, U64 age)
smsv_local_module_path_from_key(Arena *arena, String8 module_name, U32 timestamp, U32 size_of_image)
{
return s("");
}
internal String8
smsv_local_debug_info_path_from_key(Arena *arena, String8 dbg_name, Guid guid, U64 age)
{
return s("");
}
@@ -359,7 +359,15 @@ smsv_cache_path(void)
}
internal String8
smsv_local_path_from_key(Arena *arena, String8 dbg_name, Guid guid, U64 age)
smsv_local_module_path_from_key(Arena *arena, String8 module_name, U32 timestamp, U32 size_of_image)
{
String8 symbol_cache_path = w32_smsv_state->symbol_cache_path;
String8 result = str8f(arena, "%S/%S/%08X%x/%S", symbol_cache_path, module_name, timestamp, size_of_image, module_name);
return result;
}
internal String8
smsv_local_debug_info_path_from_key(Arena *arena, String8 dbg_name, Guid guid, U64 age)
{
String8 result = {0};
Temp scratch = scratch_begin(&arena, 1);