From d564184d315b750679b114a3b43725d90523a333 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Mon, 12 May 2025 17:09:13 -0700 Subject: [PATCH] chip away more unneeded path processing, impeding proper support for relative paths; we want to mostly preserve paths as we see them, and then we should find a different story for mapping the paths in very few places --- src/raddbg/raddbg_core.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index b0fedcee..dd46afa4 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -1486,7 +1486,6 @@ internal String8 rd_mapped_from_file_path(Arena *arena, String8 file_path) { Temp scratch = scratch_begin(&arena, 1); - String8 result = file_path; if(file_path.size != 0) { String8List file_path_parts = str8_split_path(scratch.arena, file_path); @@ -1527,9 +1526,10 @@ rd_mapped_from_file_path(Arena *arena, String8 file_path) str8_list_push(scratch.arena, &best_map_dst_parts, n->string); } StringJoin join = {.sep = str8_lit("/")}; - result = str8_list_join(arena, &best_map_dst_parts, &join); + file_path = str8_list_join(scratch.arena, &best_map_dst_parts, &join); } } + String8 result = push_str8_copy(arena, file_path); scratch_end(scratch); return result; } @@ -13473,6 +13473,10 @@ rd_frame(void) { // NOTE(rjf): // + // foo.c + // C:/test/bar/baz/foo.c + // -> override foo.c -> C:/test/bar/baz/foo.c + // // C:/foo/bar/baz.c // D:/foo/bar/baz.c // -> override C: -> D: @@ -13509,7 +13513,9 @@ rd_frame(void) String8Node *first_diff_dst = dst_path_parts__reversed.first; for(;first_diff_src != 0 && first_diff_dst != 0;) { - if(!str8_match(first_diff_src->string, first_diff_dst->string, StringMatchFlag_CaseInsensitive)) + if(!str8_match(first_diff_src->string, first_diff_dst->string, StringMatchFlag_CaseInsensitive) || + first_diff_src->next == 0 || + first_diff_dst->next == 0) { break; } @@ -14539,7 +14545,7 @@ rd_frame(void) U64 vaddr = 0; B32 require_disasm_snap = 0; { - file_path = rd_mapped_from_file_path(scratch.arena, rd_regs()->file_path); + file_path = rd_regs()->file_path; point = rd_regs()->cursor; thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->thread); process = ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->process);