mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-09 19:11:38 -07:00
robustify search item usage code to changed sets of dbgis
This commit is contained in:
+12
-5
@@ -54,7 +54,9 @@ di_key_copy(Arena *arena, DI_Key *src)
|
||||
internal DI_Key
|
||||
di_normalized_key_from_key(Arena *arena, DI_Key *src)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
DI_Key dst = {path_normalized_from_string(arena, src->path), src->min_timestamp};
|
||||
ProfEnd();
|
||||
return dst;
|
||||
}
|
||||
|
||||
@@ -197,7 +199,7 @@ di_init(void)
|
||||
Arena *arena = arena_alloc();
|
||||
di_shared = push_array(arena, DI_Shared, 1);
|
||||
di_shared->arena = arena;
|
||||
di_shared->slots_count = 1024;
|
||||
di_shared->slots_count = 4096;
|
||||
di_shared->slots = push_array(arena, DI_Slot, di_shared->slots_count);
|
||||
di_shared->stripes_count = Min(di_shared->slots_count, os_get_system_info()->logical_processor_count);
|
||||
di_shared->stripes = push_array(arena, DI_Stripe, di_shared->stripes_count);
|
||||
@@ -330,6 +332,7 @@ di_scope_touch_search_node__stripe_mutex_r_guarded(DI_Scope *scope, DI_SearchNod
|
||||
internal DI_Node *
|
||||
di_node_from_key_slot__stripe_mutex_r_guarded(DI_Slot *slot, DI_Key *key)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
DI_Node *node = 0;
|
||||
StringMatchFlags match_flags = path_match_flags_from_os(operating_system_from_context());
|
||||
U64 most_recent_timestamp = max_U64;
|
||||
@@ -343,6 +346,7 @@ di_node_from_key_slot__stripe_mutex_r_guarded(DI_Slot *slot, DI_Key *key)
|
||||
most_recent_timestamp = (n->key.min_timestamp - key->min_timestamp);
|
||||
}
|
||||
}
|
||||
ProfEnd();
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -586,7 +590,7 @@ di_rdi_from_key(DI_Scope *scope, DI_Key *key, U64 endt_us)
|
||||
U64 stripe_idx = slot_idx%di_shared->stripes_count;
|
||||
DI_Slot *slot = &di_shared->slots[slot_idx];
|
||||
DI_Stripe *stripe = &di_shared->stripes[stripe_idx];
|
||||
OS_MutexScopeR(stripe->rw_mutex) for(;;)
|
||||
ProfScope("grab node") OS_MutexScopeR(stripe->rw_mutex) for(;;)
|
||||
{
|
||||
//- rjf: find existing node
|
||||
DI_Node *node = di_node_from_key_slot__stripe_mutex_r_guarded(slot, &key_normalized);
|
||||
@@ -617,10 +621,13 @@ di_rdi_from_key(DI_Scope *scope, DI_Key *key, U64 endt_us)
|
||||
!ins_atomic_u64_eval(&node->is_working) &&
|
||||
di_u2p_enqueue_key(&key_normalized, endt_us))
|
||||
{
|
||||
ins_atomic_u64_eval_assign(&node->is_working, 1);
|
||||
DeferLoop(os_rw_mutex_drop_r(stripe->rw_mutex), os_rw_mutex_take_r(stripe->rw_mutex))
|
||||
ProfScope("ask for parse")
|
||||
{
|
||||
async_push_work(di_parse_work);
|
||||
ins_atomic_u64_eval_assign(&node->is_working, 1);
|
||||
DeferLoop(os_rw_mutex_drop_r(stripe->rw_mutex), os_rw_mutex_take_r(stripe->rw_mutex))
|
||||
{
|
||||
async_push_work(di_parse_work);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5039,6 +5039,12 @@ rd_window_frame(RD_Window *ws)
|
||||
DI_SearchItemArray items = di_search_items_from_key_params_query(di_scope, search_key, &search_params, query_word, 0, &is_stale);
|
||||
for(U64 idx = 0; idx < 20 && idx < items.count; idx += 1)
|
||||
{
|
||||
// rjf: skip bad elements
|
||||
if(items.v[idx].dbgi_idx >= rdis_count)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// rjf: unpack info
|
||||
RDI_Parsed *rdi = rdis[items.v[idx].dbgi_idx];
|
||||
String8 name = di_search_item_string_from_rdi_target_element_idx(rdi, search_params.target, items.v[idx].idx);
|
||||
@@ -5068,6 +5074,12 @@ rd_window_frame(RD_Window *ws)
|
||||
DI_SearchItemArray items = di_search_items_from_key_params_query(di_scope, search_key, &search_params, query_word, 0, &is_stale);
|
||||
for(U64 idx = 0; idx < 20 && idx < items.count; idx += 1)
|
||||
{
|
||||
// rjf: skip bad elements
|
||||
if(items.v[idx].dbgi_idx >= rdis_count)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// rjf: unpack info
|
||||
RDI_Parsed *rdi = rdis[items.v[idx].dbgi_idx];
|
||||
String8 name = di_search_item_string_from_rdi_target_element_idx(rdi, search_params.target, items.v[idx].idx);
|
||||
@@ -5097,6 +5109,12 @@ rd_window_frame(RD_Window *ws)
|
||||
DI_SearchItemArray items = di_search_items_from_key_params_query(di_scope, search_key, &search_params, query_word, 0, &is_stale);
|
||||
for(U64 idx = 0; idx < 20 && idx < items.count; idx += 1)
|
||||
{
|
||||
// rjf: skip bad elements
|
||||
if(items.v[idx].dbgi_idx >= rdis_count)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// rjf: unpack info
|
||||
RDI_Parsed *rdi = rdis[items.v[idx].dbgi_idx];
|
||||
String8 name = di_search_item_string_from_rdi_target_element_idx(rdi, search_params.target, items.v[idx].idx);
|
||||
@@ -5126,6 +5144,12 @@ rd_window_frame(RD_Window *ws)
|
||||
DI_SearchItemArray items = di_search_items_from_key_params_query(di_scope, search_key, &search_params, query_word, 0, &is_stale);
|
||||
for(U64 idx = 0; idx < 20 && idx < items.count; idx += 1)
|
||||
{
|
||||
// rjf: skip bad elements
|
||||
if(items.v[idx].dbgi_idx >= rdis_count)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// rjf: unpack info
|
||||
RDI_Parsed *rdi = rdis[items.v[idx].dbgi_idx];
|
||||
String8 name = di_search_item_string_from_rdi_target_element_idx(rdi, search_params.target, items.v[idx].idx);
|
||||
@@ -9321,8 +9345,16 @@ rd_ev_view_rule_expr_expand_range_info__debug_info_tables(Arena *arena, EV_View
|
||||
result.row_members = push_array(arena, E_Member *, result.row_exprs_count);
|
||||
for EachIndex(row_expr_idx, result.row_exprs_count)
|
||||
{
|
||||
// rjf: unpack row info
|
||||
// rjf: unpack row
|
||||
DI_SearchItem *item = &accel->items.v[idx_range.min + row_expr_idx];
|
||||
|
||||
// rjf: skip bad elements
|
||||
if(item->dbgi_idx >= accel->rdis_count)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// rjf: unpack row info
|
||||
RDI_Parsed *rdi = accel->rdis[item->dbgi_idx];
|
||||
E_Module *module = &e_parse_ctx->modules[item->dbgi_idx];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user