eval: use resolution qualifiers to express disambiguating debug info, or module, or unit, and use in debug info resolution matching path; automatically prefer selected thread voff's unit

This commit is contained in:
Ryan Fleury committed 2026-06-02 12:10:43 -07:00
1 parent a72d284058
commit 56ee3bbf7b
11 files changed
+423 -253

No files matched your search

+50 -8
View File
@@ -1500,12 +1500,16 @@ di_match_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out, U64 *g
Temp scratch = scratch_begin(0, 0);
//- rjf: unpack key
U64 index = 0;
U32 index = 0;
U32 unit_idx = 0;
B32 allow_other_dbgis = 0;
String8 name = {0};
DI_Key preferred_key = {0};
{
U64 key_read_off = 0;
key_read_off += str8_deserial_read_struct(key, key_read_off, &index);
key_read_off += str8_deserial_read_struct(key, key_read_off, &unit_idx);
key_read_off += str8_deserial_read_struct(key, key_read_off, &allow_other_dbgis);
key_read_off += str8_deserial_read_struct(key, key_read_off, &preferred_key);
key_read_off += str8_deserial_read_struct(key, key_read_off, &name.size);
name.str = push_array_no_zero(scratch.arena, U8, name.size);
@@ -1623,10 +1627,15 @@ di_match_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out, U64 *g
Rng1U64 range = lane_range(dbgi_keys.count);
for EachInRange(dbgi_idx, range)
{
DI_Key dbgi_key = dbgi_keys.v[dbgi_idx];
if(!allow_other_dbgis && !di_key_match(preferred_key, dbgi_key))
{
continue;
}
Access *access = access_open();
{
DI_Key dbgi_key = dbgi_keys.v[dbgi_idx];
RDI_Parsed *rdi = di_rdi_from_key(access, dbgi_key, 0, 0);
RDI_Unit *unit = rdi_element_from_name_idx(rdi, Units, unit_idx);
for EachElement(name_map_kind_idx, name_map_kinds)
{
// rjf: unpack name map
@@ -1685,12 +1694,43 @@ di_match_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out, U64 *g
}
// rjf: do we have a specific unit queried? -> filter matches according to containing unit
#if 0
if(target_unit_index != 0)
if(unit_idx != 0)
{
U32 *unit_filtered_matches = push_array(scratch.arena, U32, filtered_matches_count);
U32 unit_filtered_matches_count = 0;
for EachIndex(match_idx, filtered_matches_count)
{
U32 match = filtered_matches[match_idx];
B32 hits_filter = 1;
switch(name_map_section_kinds[name_map_kind_idx])
{
default:{}break;
case RDI_SectionKind_GlobalVariables:
{
hits_filter = (unit->global_variables_first_idx <= match && match < unit->global_variables_first_idx+unit->global_variables_count);
}break;
case RDI_SectionKind_ThreadVariables:
{
hits_filter = (unit->thread_variables_first_idx <= match && match < unit->thread_variables_first_idx+unit->thread_variables_count);
}break;
case RDI_SectionKind_Constants:
{
hits_filter = (unit->constants_first_idx <= match && match < unit->constants_first_idx+unit->constants_count);
}break;
case RDI_SectionKind_Procedures:
{
hits_filter = (unit->procedures_first_idx <= match && match < unit->procedures_first_idx+unit->procedures_count);
}break;
}
if(hits_filter)
{
unit_filtered_matches[unit_filtered_matches_count] = match;
unit_filtered_matches_count += 1;
}
}
filtered_matches = unit_filtered_matches;
filtered_matches_count = unit_filtered_matches_count;
}
#endif
// rjf: given matches, pick selected & return as result
if(filtered_matches_count != 0)
@@ -1743,7 +1783,7 @@ di_match_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out, U64 *g
}
internal DI_Match
di_match_from_string(String8 string, U64 match_index, DI_Key preferred_dbgi_key, U64 endt_us)
di_match_from_string(String8 string, U32 match_index, U32 unit_idx, B32 allow_other_dbgis, DI_Key preferred_dbgi_key, U64 endt_us)
{
DI_Match result = {0};
Access *access = access_open();
@@ -1751,12 +1791,14 @@ di_match_from_string(String8 string, U64 match_index, DI_Key preferred_dbgi_key,
{
String8List key_parts = {0};
str8_list_push(scratch.arena, &key_parts, str8_struct(&match_index));
str8_list_push(scratch.arena, &key_parts, str8_struct(&unit_idx));
str8_list_push(scratch.arena, &key_parts, str8_struct(&allow_other_dbgis));
str8_list_push(scratch.arena, &key_parts, str8_struct(&preferred_dbgi_key));
str8_list_push(scratch.arena, &key_parts, str8_struct(&string.size));
str8_list_push(scratch.arena, &key_parts, string);
String8 key = str8_list_join(scratch.arena, &key_parts, 0);
U64 dbgi_count = di_load_count();
B32 wide = (dbgi_count > 256);
B32 wide = (dbgi_count > 256 && allow_other_dbgis);
AC_Artifact artifact = ac_artifact_from_key(access, key, di_match_artifact_create, 0, endt_us, .flags = wide ? AC_Flag_Wide : 0, .gen = di_load_gen(), .evict_threshold_us = wide ? 20000000 : 10000000);
result.key.u64[0] = artifact.u64[0];
result.key.u64[1] = artifact.u64[1];
+1 -1
View File
@@ -361,6 +361,6 @@ internal DI_SearchItemArray di_search_item_array_from_target_query(Access *acces
//~ rjf: Match Artifact Cache Hooks / Lookups
internal AC_Artifact di_match_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out, U64 *gen_out);
internal DI_Match di_match_from_string(String8 string, U64 match_index, DI_Key preferred_dbgi_key, U64 endt_us);
internal DI_Match di_match_from_string(String8 string, U32 match_index, U32 unit_idx, B32 allow_other_dbgis, DI_Key preferred_dbgi_key, U64 endt_us);
#endif // DBG_INFO_H