on ambiguous debug info matches, inside primary debug info -> try building a fully qualified name from context, and replacing initial debug info match if it hits

This commit is contained in:
Ryan Fleury
2026-05-19 12:08:26 -07:00
parent 161663016f
commit 17cdf458d3
3 changed files with 25 additions and 5 deletions
+4 -2
View File
@@ -1699,6 +1699,7 @@ di_match_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out, U64 *g
lane_matches[lane_idx()].key = dbgi_key; lane_matches[lane_idx()].key = dbgi_key;
lane_matches[lane_idx()].section_kind = name_map_section_kinds[name_map_kind_idx]; lane_matches[lane_idx()].section_kind = name_map_section_kinds[name_map_kind_idx];
lane_matches[lane_idx()].idx = filtered_matches[selected_match_idx]; lane_matches[lane_idx()].idx = filtered_matches[selected_match_idx];
lane_matches[lane_idx()].count = filtered_matches_count;
} }
} }
} }
@@ -1732,7 +1733,7 @@ di_match_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out, U64 *g
artifact.u64[0] = match.key.u64[0]; artifact.u64[0] = match.key.u64[0];
artifact.u64[1] = match.key.u64[1]; artifact.u64[1] = match.key.u64[1];
artifact.u64[2] = match.section_kind; artifact.u64[2] = match.section_kind;
artifact.u64[3] = match.idx; artifact.u64[3] = ((U64)(match.idx & 0xffffffffull) << 32) | ((U64)(match.count & 0xffffffffull) << 0);
} }
lane_sync(); lane_sync();
@@ -1760,7 +1761,8 @@ di_match_from_string(String8 string, U64 match_index, DI_Key preferred_dbgi_key,
result.key.u64[0] = artifact.u64[0]; result.key.u64[0] = artifact.u64[0];
result.key.u64[1] = artifact.u64[1]; result.key.u64[1] = artifact.u64[1];
result.section_kind = artifact.u64[2]; result.section_kind = artifact.u64[2];
result.idx = artifact.u64[3]; result.idx = (artifact.u64[3] & 0xffffffff00000000ull) >> 32;
result.count = (artifact.u64[3] & 0x00000000ffffffffull) >> 0;
} }
scratch_end(scratch); scratch_end(scratch);
access_close(access); access_close(access);
+1
View File
@@ -202,6 +202,7 @@ struct DI_Match
DI_Key key; DI_Key key;
RDI_SectionKind section_kind; RDI_SectionKind section_kind;
U32 idx; U32 idx;
U32 count;
}; };
//////////////////////////////// ////////////////////////////////
+20 -3
View File
@@ -1900,6 +1900,26 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
// rjf: find match // rjf: find match
DI_Match match = di_match_from_string(string, match_disambiguating_idx, e_base_ctx->primary_dbg_info->dbgi_key, 0); DI_Match match = di_match_from_string(string, match_disambiguating_idx, e_base_ctx->primary_dbg_info->dbgi_key, 0);
// rjf: match -> RDI
RDI_Parsed *rdi = di_rdi_from_key(access, match.key, 0, 0);
// rjf: ambiguous global/thread variable in primary debug info -> try fully qualifying the name implicitly.
if((match.section_kind == RDI_SectionKind_GlobalVariables ||
match.section_kind == RDI_SectionKind_ThreadVariables) &&
match.count != 1 &&
rdi == e_base_ctx->primary_dbg_info->rdi)
{
U64 voff = e_base_ctx->thread_ip_voff;
RDI_Symbol *procedure = rdi_procedure_from_voff(rdi, voff);
String8 procedure_name = fully_qualified_str8_from_rdi_symbol(scratch.arena, rdi, procedure);
String8 fully_qualified_name = str8f(scratch.arena, "%S.%S", procedure_name, string);
DI_Match fully_qualified_match_maybe = di_match_from_string(fully_qualified_name, match_disambiguating_idx, e_base_ctx->primary_dbg_info->dbgi_key, 0);
if(fully_qualified_match_maybe.idx != 0)
{
match = fully_qualified_match_maybe;
}
}
#if 0 #if 0
//~ TODO(rjf): vvvvv this used to be used for namespaceifying partially-qualified strings. //~ TODO(rjf): vvvvv this used to be used for namespaceifying partially-qualified strings.
// now, the debugger just stores partially-qualified strings, so we instead need to do the // now, the debugger just stores partially-qualified strings, so we instead need to do the
@@ -1943,9 +1963,6 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
} }
#endif #endif
// rjf: match -> RDI
RDI_Parsed *rdi = di_rdi_from_key(access, match.key, 0, 0);
// rjf: find dbg info from rdi // rjf: find dbg info from rdi
E_DbgInfo *dbg_info = &e_dbg_info_nil; E_DbgInfo *dbg_info = &e_dbg_info_nil;
U32 dbg_info_num = 0; U32 dbg_info_num = 0;