prefer usage of pdbs in dbgi layer, if rdi path is not baked in, but pdb path *is* - otherwise the dbgi layer can simply choose a stale rdi file with no way to generate a new one.

This commit is contained in:
Ryan Fleury
2024-10-23 11:49:47 -07:00
parent 45f5a2d18f
commit 1ecabff7b6
6 changed files with 30 additions and 38 deletions
+18 -18
View File
@@ -3614,7 +3614,6 @@ ctrl_thread__module_open(CTRL_Handle process, CTRL_Handle module, Rng1U64 vaddr_
tls_vaddr_range = r1u64(tls_header.index_address, tls_header.index_address+sizeof(U32));
// rjf: grab data about debug info
if(data_dir_count > PE_DataDirectoryIndex_DEBUG)
{
// rjf: read data dir
@@ -3683,27 +3682,28 @@ ctrl_thread__module_open(CTRL_Handle process, CTRL_Handle module, Rng1U64 vaddr_
{
Temp scratch = scratch_begin(0, 0);
String8 exe_folder = str8_chop_last_slash(path);
String8 rdi_path__absolute = rdi_dbg_path;
String8 rdi_path__relative = push_str8f(scratch.arena, "%S/%S", exe_folder, rdi_dbg_path);
String8 pdb_path__absolute = pdb_dbg_path;
String8 pdb_path__relative = push_str8f(scratch.arena, "%S/%S", exe_folder, pdb_dbg_path);
String8 dbg_path_candidates[] =
String8List dbg_path_candidates = {0};
if(rdi_dbg_path.size != 0)
{
/* inferred (treated as absolute): */ rdi_path__absolute,
/* inferred (treated as relative): */ rdi_path__relative,
/* inferred (treated as absolute): */ pdb_path__absolute,
/* inferred (treated as relative): */ pdb_path__relative,
/* "foo.exe" -> "foo.rdi" */ push_str8f(scratch.arena, "%S.rdi", str8_chop_last_dot(path)),
/* "foo.exe" -> "foo.exe.rdi" */ push_str8f(scratch.arena, "%S.rdi", path),
/* "foo.exe" -> "foo.pdb" */ push_str8f(scratch.arena, "%S.pdb", str8_chop_last_dot(path)),
/* "foo.exe" -> "foo.exe.pdb" */ push_str8f(scratch.arena, "%S.pdb", path),
};
for(U64 idx = 0; idx < ArrayCount(dbg_path_candidates); idx += 1)
str8_list_push(scratch.arena, &dbg_path_candidates, rdi_dbg_path);
str8_list_pushf(scratch.arena, &dbg_path_candidates, "%S/%S", exe_folder, rdi_dbg_path);
}
if(pdb_dbg_path.size != 0)
{
FileProperties props = os_properties_from_file_path(dbg_path_candidates[idx]);
str8_list_push(scratch.arena, &dbg_path_candidates, pdb_dbg_path);
str8_list_pushf(scratch.arena, &dbg_path_candidates, "%S/%S", exe_folder, pdb_dbg_path);
}
str8_list_pushf(scratch.arena, &dbg_path_candidates, "%S.pdb", str8_chop_last_dot(path));
str8_list_pushf(scratch.arena, &dbg_path_candidates, "%S.pdb", path);
str8_list_pushf(scratch.arena, &dbg_path_candidates, "%S.rdi", str8_chop_last_dot(path));
str8_list_pushf(scratch.arena, &dbg_path_candidates, "%S.rdi", path);
for(String8Node *n = dbg_path_candidates.first; n != 0; n = n->next)
{
String8 candidate_path = n->string;
FileProperties props = os_properties_from_file_path(candidate_path);
if(props.modified != 0 && props.size != 0)
{
initial_debug_info_path = push_str8_copy(arena, dbg_path_candidates[idx]);
initial_debug_info_path = push_str8_copy(arena, candidate_path);
break;
}
}
-1
View File
@@ -107,7 +107,6 @@ D_ViewRuleTable:
@table(name)
D_DevToggleTable:
{
{telemetry_capture}
{simulate_lag}
{draw_ui_text_pos}
{draw_ui_focus_debug}
-15
View File
@@ -1974,21 +1974,6 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
}
}
//////////////////////////////
//- rjf: start/stop telemetry captures
//
ProfScope("start/stop telemetry captures")
{
if(!ProfIsCapturing() && DEV_telemetry_capture)
{
ProfBeginCapture("raddbg");
}
if(ProfIsCapturing() && !DEV_telemetry_capture)
{
ProfEndCapture();
}
}
//////////////////////////////
//- rjf: process top-level commands
//
@@ -71,7 +71,6 @@ D_ViewRuleKind_Geo3D,
D_ViewRuleKind_COUNT,
} D_ViewRuleKind;
global B32 DEV_telemetry_capture = 0;
global B32 DEV_simulate_lag = 0;
global B32 DEV_draw_ui_text_pos = 0;
global B32 DEV_draw_ui_focus_debug = 0;
@@ -83,7 +82,6 @@ global B32 DEV_scratch_mouse_draw = 0;
global B32 DEV_updating_indicator = 0;
struct {B32 *value_ptr; String8 name;} DEV_toggle_table[] =
{
{&DEV_telemetry_capture, str8_lit_comp("telemetry_capture")},
{&DEV_simulate_lag, str8_lit_comp("simulate_lag")},
{&DEV_draw_ui_text_pos, str8_lit_comp("draw_ui_text_pos")},
{&DEV_draw_ui_focus_debug, str8_lit_comp("draw_ui_focus_debug")},
+11 -1
View File
@@ -3962,6 +3962,16 @@ rd_window_frame(RD_Window *ws)
ui_set_next_flags(UI_BoxFlag_ViewScrollY|UI_BoxFlag_AllowOverflowY|UI_BoxFlag_ViewClamp);
UI_PaneF(r2f32p(30, 30, 30+ui_top_font_size()*100, ui_top_font_size()*150), "###dev_ctx_menu")
{
//- rjf: capture
if(!ProfIsCapturing() && ui_clicked(ui_buttonf("Begin Profiler Capture###prof_cap")))
{
ProfBeginCapture("raddbg");
}
else if(ProfIsCapturing() && ui_clicked(ui_buttonf("End Profiler Capture###prof_cap")))
{
ProfEndCapture();
}
//- rjf: toggles
for(U64 idx = 0; idx < ArrayCount(DEV_toggle_table); idx += 1)
{
@@ -16566,7 +16576,7 @@ rd_frame(void)
//////////////////////////////
//- rjf: capture is active? -> keep rendering
//
if(ProfIsCapturing() || DEV_telemetry_capture)
if(ProfIsCapturing())
{
rd_request_frame();
}
+1 -1
View File
@@ -5874,7 +5874,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(text)
//////////////////////////////
//- rjf: build missing file interface
//
if(file_is_missing && !key_has_data)
if(file_is_missing && !u128_match(hash, u128_zero()))
{
UI_WidthFill UI_HeightFill UI_Column UI_Padding(ui_pct(1, 0))
{