eliminate possibility for recursive watch window builds; correctly sort child expansion keys before iteration, if needed, for non-identity-based id schemes (debug info tables, frontend entities, etc.); further fixes & integration

This commit is contained in:
Ryan Fleury
2024-09-26 15:26:28 -07:00
parent 07f978ac41
commit d314a12698
6 changed files with 138 additions and 43 deletions
+13 -5
View File
@@ -5975,7 +5975,7 @@ rd_window_frame(RD_Window *ws)
B32 row_is_expanded = ev_expansion_from_key(ev_view, row->key);
if(row_is_expandable)
UI_PrefWidth(ui_em(1.5f, 1))
if(ui_pressed(ui_expanderf(row_is_expanded, "###%I64x_%I64x_is_expanded", row->key.parent_hash, row->key.child_num)))
if(ui_pressed(ui_expanderf(row_is_expanded, "###%I64x_%I64x_is_expanded", row->key.parent_hash, row->key.child_id)))
{
ev_key_set_expansion(ev_view, row->block->key, row->key, !row_is_expanded);
}
@@ -8506,12 +8506,20 @@ rd_ev_view_rule_expr_expand_range_info__debug_info_tables(Arena *arena, EV_View
internal U64
rd_ev_view_rule_expr_id_from_num__debug_info_tables(U64 num, void *user_data, RDI_SectionKind section)
{
return num;
RD_DebugInfoTableExpandAccel *accel = (RD_DebugInfoTableExpandAccel *)user_data;
U64 id = 0;
if(0 < num && num <= accel->items.count)
{
id = accel->items.v[num-1].idx+1;
}
return id;
}
internal U64
rd_ev_view_rule_expr_num_from_id__debug_info_tables(U64 num, void *user_data, RDI_SectionKind section)
rd_ev_view_rule_expr_num_from_id__debug_info_tables(U64 id, void *user_data, RDI_SectionKind section)
{
RD_DebugInfoTableExpandAccel *accel = (RD_DebugInfoTableExpandAccel *)user_data;
U64 num = fzy_item_num_from_array_element_idx__linear_search(&accel->items, id-1);
return num;
}
@@ -8571,7 +8579,7 @@ rd_ev_view_rule_block_prod_collection_debug_tables(Arena *arena, RDI_SectionKind
U64 idx = 0;
for(EV_ExpandNode *child = root_node->first; child != 0; child = child->next)
{
U64 item_num = fzy_item_num_from_array_element_idx__linear_search(&items, child->key.child_num);
U64 item_num = fzy_item_num_from_array_element_idx__linear_search(&items, child->key.child_id);
if(item_num != 0)
{
sub_expand_keys[idx] = child->key;
@@ -8712,7 +8720,7 @@ rd_append_value_strings_from_eval(Arena *arena, EV_StringFlags flags, U32 defaul
}
//- rjf: member evaluations -> display member info
if(eval.mode == E_Mode_Null && !e_type_key_match(e_type_key_zero(), eval.type_key) && member != 0)
if(eval.mode == E_Mode_Null && !e_type_key_match(e_type_key_zero(), eval.type_key) && member != &e_member_nil)
{
U64 member_byte_size = e_type_byte_size_from_key(eval.type_key);
String8 offset_string = str8_from_u64(arena, member->off, radix, 0, 0);
+1 -1
View File
@@ -1291,7 +1291,7 @@ internal EV_ExpandRangeInfo rd_ev_view_rule_expr_expand_range_info__meta_ctrl_en
internal EV_ExpandInfo rd_ev_view_rule_expr_expand_info__debug_info_tables(Arena *arena, EV_View *view, String8 filter, E_Expr *expr, MD_Node *params, RDI_SectionKind section);
internal EV_ExpandRangeInfo rd_ev_view_rule_expr_expand_range_info__debug_info_tables(Arena *arena, EV_View *view, String8 filter, E_Expr *expr, MD_Node *params, Rng1U64 idx_range, void *user_data, RDI_SectionKind section);
internal U64 rd_ev_view_rule_expr_id_from_num__debug_info_tables(U64 num, void *user_data, RDI_SectionKind section);
internal U64 rd_ev_view_rule_expr_num_from_id__debug_info_tables(U64 num, void *user_data, RDI_SectionKind section);
internal U64 rd_ev_view_rule_expr_num_from_id__debug_info_tables(U64 id, void *user_data, RDI_SectionKind section);
internal void rd_ev_view_rule_block_prod_collection_debug_tables(Arena *arena, RDI_SectionKind target, EV_View *view, String8 filter, EV_Key parent_key, EV_Key key, EV_ExpandNode *expand_node, String8 string, E_Expr *expr, EV_ViewRuleList *view_rules, MD_Node *view_params, S32 depth, struct EV_BlockList *out);
internal EV_View *rd_ev_view_from_key(U64 key);
+8 -8
View File
@@ -1749,8 +1749,8 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
// rjf: map selection keys to child numbers
U64 selection_numbers[2] =
{
selection_block->expand_view_rule_info->expr_expand_num_from_id(selection_keys_in_block[0].child_num, selection_block->expand_view_rule_info_user_data),
selection_block->expand_view_rule_info->expr_expand_num_from_id(selection_keys_in_block[1].child_num, selection_block->expand_view_rule_info_user_data),
selection_block->expand_view_rule_info->expr_expand_num_from_id(selection_keys_in_block[0].child_id, selection_block->expand_view_rule_info_user_data),
selection_block->expand_view_rule_info->expr_expand_num_from_id(selection_keys_in_block[1].child_id, selection_block->expand_view_rule_info_user_data),
};
// rjf: determine collection info for the block
@@ -1949,7 +1949,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
B32 next_row_expanded = row_expanded;
RD_ViewRuleInfo *ui_view_rule_info = rd_view_rule_info_from_string(row->block->expand_view_rule_info->string);
MD_Node *ui_view_rule_params_root = row->block->expand_view_rule_params;
if(ui_view_rule_info->ui == 0)
if(ui_view_rule_info->ui == 0 || !(ui_view_rule_info->flags & RD_ViewRuleInfoFlag_CanUseInWatchTable))
{
ui_view_rule_info = &rd_nil_view_rule_info;
ui_view_rule_params_root = &md_nil_node;
@@ -2231,9 +2231,9 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
//////////////////////
//- rjf: draw start of cache lines in expansions
//
U64 row_offset = row_eval.value.u64;
if((row_eval.mode == E_Mode_Offset || row_eval.mode == E_Mode_Null) &&
row_eval.value.u64%64 == 0 && row_depth > 0 &&
!row_expanded)
row_offset%64 == 0 && row_depth > 0 && !row_expanded)
{
ui_set_next_fixed_x(0);
ui_set_next_fixed_y(0);
@@ -2585,9 +2585,9 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
//- rjf: [DEV] hovering -> watch key tooltips
if(DEV_eval_watch_key_tooltips && ui_hovering(sig)) UI_Tooltip RD_Font(RD_FontSlot_Code)
{
ui_labelf("Block Key: {0x%I64x, %I64u}", row->block->key.parent_hash, row->block->key.child_num);
ui_labelf("Row Key: {0x%I64x, %I64u}", row->key.parent_hash, row->key.child_num);
ui_labelf("Cursor Key: {0x%I64x, %I64u}", ewv->cursor.key.parent_hash, ewv->cursor.key.child_num);
ui_labelf("Block Key: {0x%I64x, %I64u}", row->block->key.parent_hash, row->block->key.child_id);
ui_labelf("Row Key: {0x%I64x, %I64u}", row->key.parent_hash, row->key.child_id);
ui_labelf("Cursor Key: {0x%I64x, %I64u}", ewv->cursor.key.parent_hash, ewv->cursor.key.child_id);
ui_spacer(ui_em(1.f, 1.f));
ui_labelf("Cursor Table Coordinates: {%I64u, %I64u}", selection_tbl.min.x, selection_tbl.min.y);
}