mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-11-17 03:30:13 -08:00
dbg_engine: instead of sending down relativized breakpoint paths, relativize when resolving breakpoints on ctrl thread per-module - this avoids preference for the selected module, which broke relative file breakpoints without a selected thread in the right module.
This commit is contained in:
1 parent
73ba34f354
commit
8a5979a1a6
3 files changed
+30
-31
No files matched your search
@@ -2511,7 +2511,9 @@ d_ctrl_thread__append_resolved_module_user_bp_traps(Arena *arena, D_EvalScope *e
|
||||
D_Entity *module_entity = d_entity_from_handle(module);
|
||||
D_Entity *debug_info_path_entity = d_entity_child_from_kind(module_entity, D_EntityKind_DebugInfoPath);
|
||||
DMN_Handle process_dmn = d_dmn_from_handle(process);
|
||||
DI_Key dbgi_key = d_dbgi_key_from_module(module_entity);
|
||||
String8 dbgi_path = debug_info_path_entity->string;
|
||||
String8 module_path = module_entity->string;
|
||||
DI_Key dbgi_key = d_dbgi_key_from_debug_info_path(debug_info_path_entity);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
U64 base_vaddr = module_entity->vaddr_range.min;
|
||||
for(D_BreakpointNode *n = user_bps->first; n != 0; n = n->next)
|
||||
@@ -2524,13 +2526,23 @@ d_ctrl_thread__append_resolved_module_user_bp_traps(Arena *arena, D_EvalScope *e
|
||||
// rjf: unpack & normalize
|
||||
TxtPt pt = bp->pt;
|
||||
String8 filename = bp->file_path;
|
||||
String8 filename_normalized = push_str8_copy(scratch.arena, filename);
|
||||
String8 filename_normalized = str8_copy(scratch.arena, filename);
|
||||
for(U64 idx = 0; idx < filename_normalized.size; idx += 1)
|
||||
{
|
||||
filename_normalized.str[idx] = lower_from_char(filename_normalized.str[idx]);
|
||||
filename_normalized.str[idx] = correct_slash_from_char(filename_normalized.str[idx]);
|
||||
}
|
||||
|
||||
// rjf: gather filename candidates - the path passed down by the frontend *may*
|
||||
// exactly match what the debug info stores, but it may be absolute whereas our
|
||||
// debug info stores relative paths. so we'll try both.
|
||||
String8 filename_candidates[] =
|
||||
{
|
||||
filename_normalized,
|
||||
path_relative_dst_from_absolute_dst_src(scratch.arena, filename_normalized, str8_chop_last_slash(dbgi_path)),
|
||||
path_relative_dst_from_absolute_dst_src(scratch.arena, filename_normalized, str8_chop_last_slash(module_path)),
|
||||
};
|
||||
|
||||
// rjf: filename -> src_id
|
||||
U32 src_id = 0;
|
||||
{
|
||||
@@ -2539,14 +2551,21 @@ d_ctrl_thread__append_resolved_module_user_bp_traps(Arena *arena, D_EvalScope *e
|
||||
{
|
||||
RDI_ParsedNameMap map = {0};
|
||||
rdi_parsed_from_name_map(rdi, mapptr, &map);
|
||||
RDI_NameMapNode *node = rdi_name_map_lookup(rdi, &map, filename_normalized.str, filename_normalized.size);
|
||||
if(node != 0)
|
||||
for EachElement(idx, filename_candidates)
|
||||
{
|
||||
U32 id_count = 0;
|
||||
U32 *ids = rdi_matches_from_map_node(rdi, node, &id_count);
|
||||
if(id_count > 0)
|
||||
RDI_NameMapNode *node = rdi_name_map_lookup(rdi, &map, filename_candidates[idx].str, filename_candidates[idx].size);
|
||||
if(node != 0)
|
||||
{
|
||||
src_id = ids[0];
|
||||
U32 id_count = 0;
|
||||
U32 *ids = rdi_matches_from_map_node(rdi, node, &id_count);
|
||||
if(id_count > 0)
|
||||
{
|
||||
src_id = ids[0];
|
||||
}
|
||||
}
|
||||
if(src_id != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ d_breakpoint_array_copy(Arena *arena, D_BreakpointArray *src)
|
||||
//~ rjf: Path Map Application
|
||||
|
||||
internal String8List
|
||||
d_possible_path_overrides_from_maps_path(Arena *arena, D_Entity *primary_module, D_PathMapArray *path_maps, String8 file_path)
|
||||
d_possible_path_overrides_from_maps_path(Arena *arena, D_PathMapArray *path_maps, String8 file_path)
|
||||
{
|
||||
// NOTE(rjf): This path, given some target file path, scans all file path map
|
||||
// overrides, and collects the set of file paths which could've redirected
|
||||
@@ -73,20 +73,6 @@ d_possible_path_overrides_from_maps_path(Arena *arena, D_Entity *primary_module,
|
||||
PathStyle pth_style = PathStyle_Relative;
|
||||
String8List pth_parts = path_normalized_list_from_string(scratch.arena, file_path, &pth_style);
|
||||
|
||||
//- rjf: push possible overrides by relativizing according to module / debug info
|
||||
{
|
||||
String8 module_folder = str8_chop_last_slash(primary_module->string);
|
||||
String8 path_relative_to_module = path_relative_dst_from_absolute_dst_src(arena, file_path, module_folder);
|
||||
String8 debug_info_path = d_entity_child_from_kind(primary_module, D_EntityKind_DebugInfoPath)->string;
|
||||
String8 debug_info_folder = str8_chop_last_slash(debug_info_path);
|
||||
str8_list_push(arena, &result, path_relative_to_module);
|
||||
if(!path_match_normalized(debug_info_folder, module_folder))
|
||||
{
|
||||
String8 path_relative_to_debug_info = path_relative_dst_from_absolute_dst_src(arena, file_path, debug_info_folder);
|
||||
str8_list_push(arena, &result, path_relative_to_debug_info);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: push possible overrides based on path map rules
|
||||
{
|
||||
for(U64 idx = 0; idx < path_maps->count; idx += 1)
|
||||
@@ -2190,12 +2176,6 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
|
||||
d_user_state->ctrl_last_run_param_state_hash = ctrl_param_state_hash;
|
||||
}
|
||||
|
||||
// rjf: unpack target thread/module
|
||||
D_Entity *thread = d_entity_from_handle(params->thread);
|
||||
D_Entity *process = d_process_from_entity(thread);
|
||||
U64 thread_ip_vaddr = d_cached_ip_from_thread(thread->handle);
|
||||
D_Entity *module = d_module_from_process_vaddr(process, thread_ip_vaddr);
|
||||
|
||||
// rjf: push & fill run message
|
||||
D_Msg *msg = d_msg_list_push(scratch.arena, &ctrl_msgs);
|
||||
{
|
||||
@@ -2223,7 +2203,7 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
|
||||
// rjf: textual location -> add breakpoints for all possible override locations
|
||||
if(bp->file_path.size != 0 && bp->pt.line != 0)
|
||||
{
|
||||
String8List overrides = d_possible_path_overrides_from_maps_path(scratch.arena, module, path_maps, bp->file_path);
|
||||
String8List overrides = d_possible_path_overrides_from_maps_path(scratch.arena, path_maps, bp->file_path);
|
||||
for(String8Node *n = overrides.first; n != 0; n = n->next)
|
||||
{
|
||||
D_Breakpoint dst_bp = {0};
|
||||
|
||||
@@ -404,7 +404,7 @@ internal D_BreakpointArray d_breakpoint_array_copy(Arena *arena, D_BreakpointArr
|
||||
////////////////////////////////
|
||||
//~ rjf: Path Map Application
|
||||
|
||||
internal String8List d_possible_path_overrides_from_maps_path(Arena *arena, D_Entity *primary_module, D_PathMapArray *path_maps, String8 file_path);
|
||||
internal String8List d_possible_path_overrides_from_maps_path(Arena *arena, D_PathMapArray *path_maps, String8 file_path);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Debug Info Extraction Type Pure Functions
|
||||
|
||||
Reference in new issue
Block a user