get default symbol path as part of process info; sketch out windows-style path for local symbol server cache

This commit is contained in:
Ryan Fleury
2026-06-02 12:10:48 -07:00
parent e1782d08cf
commit 4e44a3c271
6 changed files with 56 additions and 9 deletions
+1
View File
@@ -13,6 +13,7 @@ struct ProcessInfo
String8 binary_path;
String8 initial_path;
String8 user_program_data_path;
String8 symbol_cache_path;
String8List module_load_paths;
String8List environment;
};
+29 -3
View File
@@ -1834,7 +1834,7 @@ d_initial_debug_info_path_from_module(Arena *arena, D_Handle module_handle)
{
if(d_handle_match(n->module, module_handle))
{
result = push_str8_copy(arena, n->initial_debug_info_path);
result = str8_copy(arena, n->local_debug_info_path);
break;
}
}
@@ -4110,12 +4110,37 @@ d_ctrl_thread__module_open(D_Handle process, D_Handle module, Rng1U64 vaddr_rang
FileProperties props = properties_from_file_path(candidate_path);
if(props.modified != 0 && props.size != 0)
{
initial_debug_info_path = push_str8_copy(arena, path_normalized_from_string(scratch.arena, candidate_path));
initial_debug_info_path = str8_copy(arena, path_normalized_from_string(scratch.arena, candidate_path));
break;
}
}
}
//////////////////////////////
//- rjf: determine debug info unique identifier
//
String8 debug_info_unique_identifier = {0};
if(pdb_dbg_path.size != 0)
{
Guid guid = pdb_dbg_guid;
debug_info_unique_identifier = str8f(scratch.arena, "%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X%x",
guid.data1, guid.data2, guid.data3, guid.data4[0], guid.data4[1], guid.data4[2], guid.data4[3], guid.data4[4], guid.data4[5], guid.data4[6], guid.data4[7], pdb_dbg_age);
}
//////////////////////////////
//- rjf: build local server cache debug info path
//
String8 local_server_cache_debug_info_path = {0};
if(debug_info_unique_identifier.size != 0 && pdb_dbg_path.size != 0)
{
// TODO(rjf): this is not complete - assuming stripped etc. - just following pattern from ntdll.dll for now
String8 symbol_cache_path = get_process_info()->symbol_cache_path;
String8 module_name = str8_skip_last_slash(path);
String8 dbg_name = str8_skip_last_slash(pdb_dbg_path);
String8 path = str8f(scratch.arena, "%S/%S/%S/stripped/%S", symbol_cache_path, module_name, debug_info_unique_identifier, dbg_name);
local_server_cache_debug_info_path = path_normalized_from_string(arena, path);
}
//////////////////////////////
//- rjf: insert info into cache
//
@@ -4149,7 +4174,8 @@ d_ctrl_thread__module_open(D_Handle process, D_Handle module, Rng1U64 vaddr_rang
node->eh_frame_hdr = eh_frame_hdr;
node->eh_ptr_ctx = eh_ptr_ctx;
node->entry_point_voff = entry_point_voff;
node->initial_debug_info_path = initial_debug_info_path;
node->local_debug_info_path = initial_debug_info_path;
node->debug_info_unique_identifier= debug_info_unique_identifier;
node->raddbg_attached_marker_voff = raddbg_is_attached_section_voff_range.min;
node->raddbg_data = str8_copy(arena, raddbg_data);
}
+3 -1
View File
@@ -186,7 +186,9 @@ struct D_ModuleImageInfoCacheNode
EH_FrameHdr eh_frame_hdr;
EH_PtrCtx eh_ptr_ctx;
U64 entry_point_voff;
String8 initial_debug_info_path;
String8 local_debug_info_path;
String8 local_server_cache_debug_info_path;
String8 debug_info_unique_identifier;
U64 raddbg_attached_marker_voff;
String8 raddbg_data;
};
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -765,8 +765,8 @@ RD_VocabTable:
x:
{
'path': @no_relativize path,
@query 'guid': string,
@no_revert @no_expand @default(1) 'enabled': bool,
@query 'guid': string,
}
```,
}
@@ -1594,8 +1594,8 @@ RD_ThemePresetTable:
theme_color:{tags: "bad_pop background", value: 0x803425ff}
theme_color:{tags: "bad_pop hover", value: 0xff825cff}
theme_color:{tags: code_default, value: 0xecececff}
theme_color:{tags: code_symbol, value: 0xebb624ff}
theme_color:{tags: code_type, value: 0xebb624ff}
theme_color:{tags: code_symbol, value: 0xceaf64ff}
theme_color:{tags: code_type, value: 0xceaf64ff}
theme_color:{tags: code_local, value: 0xa7dae8ff}
theme_color:{tags: code_register, value: 0xb7afd5ff}
theme_color:{tags: code_keyword, value: 0x838b8fff}
+18
View File
@@ -1923,12 +1923,30 @@ w32_entry_point_caller(int argc, WCHAR **wargv)
{
String16 string16 = str16((U16 *)this_proc_env + start_idx, idx - start_idx);
String8 string = str8_from_16(arena, string16);
if(str8_match(string, s("_NT_SYMBOL_PATH="), StringMatchFlag_RightSideSloppy))
{
info->symbol_cache_path = str8_skip(string, 16);
info->symbol_cache_path = str8_skip_chop_whitespace(info->symbol_cache_path);
}
str8_list_push(arena, &info->environment, string);
start_idx = idx+1;
}
}
}
}
if(info->symbol_cache_path.size == 0)
{
Temp scratch = scratch_begin(0, 0);
U64 size = KB(32);
U16 *buffer = push_array_no_zero(scratch.arena, U16, size);
if(SUCCEEDED(SHGetFolderPathW(0, CSIDL_LOCAL_APPDATA, 0, 0, (WCHAR*)buffer)))
{
String8 local_appdata = str8_from_16(scratch.arena, str16_cstring(buffer));
info->symbol_cache_path = str8f(arena, "%S\\Temp\\SymbolCache", local_appdata);
}
scratch_end(scratch);
}
}
//- rjf: set up entity storage