replace watch view fill kind with top-level expression & view rule; collection macro for watches; reintroduce only/omit, with new expr-macro-based eval visualization system; remove root-expression-generation from expansion block generation, since it makes things a bit more complicated

This commit is contained in:
Ryan Fleury
2024-09-20 16:15:29 -07:00
parent a1debd9219
commit c98db01b63
10 changed files with 186 additions and 51 deletions
+36 -2
View File
@@ -1294,6 +1294,7 @@ rd_entity_mark_for_deletion(RD_Entity *entity)
if(!rd_entity_is_nil(entity))
{
entity->flags |= RD_EntityFlag_MarkedForDeletion;
rd_state->kind_alloc_gens[entity->kind] += 1;
}
}
@@ -1596,7 +1597,7 @@ rd_push_entity_list_with_kind(Arena *arena, RD_EntityKind kind)
!rd_entity_is_nil(entity);
entity = rd_entity_rec_depth_first_pre(entity, &d_nil_entity).next)
{
if(entity->kind == kind)
if(entity->kind == kind && !(entity->flags & RD_EntityFlag_MarkedForDeletion))
{
rd_entity_list_push(arena, &result, entity);
}
@@ -7861,10 +7862,34 @@ rd_window_frame(RD_Window *ws)
EV_VIEW_RULE_BLOCK_PROD_FUNCTION_DEF(rd_collection_block_prod)
{
//////////////////////////////
//- rjf: watches
//
if(str8_match(string, str8_lit("watches"), 0))
{
Temp scratch = scratch_begin(&arena, 1);
RD_EntityList watches = rd_query_cached_entity_list_with_kind(RD_EntityKind_Watch);
EV_ViewRuleList top_level_view_rules = {0};
for(RD_EntityNode *n = watches.first; n != 0; n = n->next)
{
RD_Entity *entity = n->entity;
String8 entity_expr_string = entity->string;
EV_Key entity_parent_key = rd_parent_ev_key_from_entity(entity);
EV_Key entity_key = rd_ev_key_from_entity(entity);
EV_BlockList blocks = ev_block_list_from_view_expr_keys(arena, view, str8_zero(), &top_level_view_rules, entity_expr_string, entity_parent_key, entity_key, depth);
FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, entity_expr_string);
if(blocks.total_semantic_row_count > 1 || matches.count == matches.needle_part_count)
{
ev_block_list_concat__in_place(out, &blocks);
}
}
scratch_end(scratch);
}
//////////////////////////////
//- rjf: targets
//
if(str8_match(string, str8_lit("targets"), 0))
else if(str8_match(string, str8_lit("targets"), 0))
{
Temp scratch = scratch_begin(&arena, 1);
RD_EntityList targets = rd_query_cached_entity_list_with_kind(RD_EntityKind_Target);
@@ -8536,6 +8561,14 @@ rd_append_value_strings_from_eval(Arena *arena, EV_StringFlags flags, U32 defaul
space_taken += fnt_dim_from_tag_size_string(font, font_size, 0, 0, brace).x;
}
}break;
//- rjf: collections
case E_TypeKind_Collection:
{
String8 placeholder = str8_lit("{...}");
str8_list_push(arena, out, placeholder);
space_taken += fnt_dim_from_tag_size_string(font, font_size, 0, 0, placeholder).x;
}break;
}
scratch_end(scratch);
@@ -10605,6 +10638,7 @@ rd_frame(void)
{
String8 collection_names[] =
{
str8_lit_comp("watches"),
str8_lit_comp("targets"),
str8_lit_comp("breakpoints"),
str8_lit_comp("watch_pins"),
+16 -15
View File
@@ -1,9 +1,9 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: 0.9.12 TODO notes
//
//~ rjf: 0.9.12 TODO notes
//
// [ ] remainder of @msgs pass:
// [ ] new universal ctx menu, hover, tooltips systems
// [ ] meta eval system
@@ -24,30 +24,31 @@
// [ ] post-@msgs TODOs:
// [ ] output: add option for scroll-to-bottom - ensure this shows up in universal ctx menu
// [ ] universal ctx menu address/watch options; e.g. watch -> memory; watch -> add watch
// [ ] rich hover coverage; bitmap <-> geo <-> memory <-> disassembly <-> text; etc.
// [ ] rich hover coverage; bitmap <-> geo <-> memory <-> disassembly <-> text; etc.
// [ ] ensure "prefer_disasm" is calculated correctly - disassembly-focused
// stepping
//
// stepping
//
// [ ] ensure the following issues are resolved with this new pass:
// [ ] mohit-reported callstack-frame-selection bug (with inlines)
// [ ] empty user file causing failure to launch
// [ ] save view column pcts; generalize to being a first-class thing in
// RD_View, e.g. by just having a string -> f32 store
// [ ] decay arrays to pointers in pointer/value comparison
// RD_View, e.g. by just having a string -> f32 store
// [ ] decay arrays to pointers in pointer/value comparison
// [ ] EVAL LOOKUP RULES -> currently going 0 -> rdis_count, but we need
// to prioritize the primary rdi
// to prioritize the primary rdi
// [ ] file overrides -> always pick most specific one! found with conflicting
// overrides, e.g. C:/devel/ -> D:/devel/, but also C:/devel/foo ->
// C:/devel/bar, etc.
// [ ] auto-scroll output window
// C:/devel/bar, etc.
// [ ] auto-scroll output window
// [ ] visualize all breakpoints everywhere - source view should show up in
// disasm, disasm should show up in source view, function should show up in
// both, etc.
// both, etc.
// [ ] ** Function breakpoints should show up in the source listing. Without
// them being visible, it is confusing when you run and you stop there,
// because you're like "wait why did it stop" and then you later remember
// that's because there was a function breakpoint there.
// [ ] codebase readme pass
// [ ] debugger readme pass
// that's because there was a function breakpoint there.
// [ ] codebase readme pass
// [ ] debugger readme pass
////////////////////////////////
//~ rjf: Frontend/UI Pass Tasks
+26 -14
View File
@@ -944,7 +944,7 @@ rd_watch_view_init(RD_WatchViewState *ewv, RD_WatchViewFillKind fill_kind)
}
internal void
rd_watch_view_build(RD_WatchViewState *ewv, B32 modifiable, U32 default_radix, Rng2F32 rect)
rd_watch_view_build(RD_WatchViewState *ewv, String8 root_expr, String8 root_view_rule, B32 modifiable, U32 default_radix, Rng2F32 rect)
{
ProfBeginFunction();
DI_Scope *di_scope = di_scope_open();
@@ -994,7 +994,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, B32 modifiable, U32 default_radix, R
};
U64 frame_rows_count = 0;
FrameRow *frame_rows = 0;
EV_ViewRuleList top_level_view_rules = {0};
EV_ViewRuleList *top_level_view_rules = ev_view_rule_list_from_string(scratch.arena, root_view_rule);
EV_BlockList blocks = {0};
UI_ScrollListRowBlockArray row_blocks = {0};
Vec2S64 cursor_tbl = {0};
@@ -1014,6 +1014,17 @@ rd_watch_view_build(RD_WatchViewState *ewv, B32 modifiable, U32 default_radix, R
if(state_dirty)
{
MemoryZeroStruct(&blocks);
mutable_entity_kind = RD_EntityKind_Watch;
EV_Key root_parent_key = ev_key_make(5381, 0);
EV_Key root_key = ev_key_make(ev_hash_from_key(root_parent_key), 1);
ev_key_set_expansion(eval_view, root_parent_key, root_key, 1);
blocks = ev_block_list_from_view_expr_keys(scratch.arena, eval_view, filter, top_level_view_rules, root_expr, root_parent_key, root_key, -1);
blocks.first = blocks.first->next;
blocks.count -= 1;
blocks.total_visual_row_count -= 1;
blocks.total_semantic_row_count -= 1;
#if 0
RDI_SectionKind fzy_target = RDI_SectionKind_UDTs;
switch(ewv->fill_kind)
{
@@ -1037,10 +1048,10 @@ rd_watch_view_build(RD_WatchViewState *ewv, B32 modifiable, U32 default_radix, R
RD_Entity *view_rule = rd_entity_child_from_kind(watch, RD_EntityKind_ViewRule);
ev_key_set_view_rule(eval_view, key, view_rule->string);
String8 expr_string = watch->string;
EV_BlockList watch_blocks = ev_block_list_from_view_expr_keys(scratch.arena, eval_view, filter, &top_level_view_rules, expr_string, parent_key, key, 0);
FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, expr_string);
if(matches.count == matches.needle_part_count)
if(watch_blocks.total_semantic_row_count > 1 || matches.count == matches.needle_part_count)
{
EV_BlockList watch_blocks = ev_block_list_from_view_expr_keys(scratch.arena, eval_view, str8_zero(), &top_level_view_rules, expr_string, parent_key, key, 0);
ev_block_list_concat__in_place(&blocks, &watch_blocks);
}
}
@@ -1367,6 +1378,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, B32 modifiable, U32 default_radix, R
ev_block_end(&blocks, last_vb);
}break;
}
#endif
}
//////////////////////////
@@ -5475,7 +5487,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(breakpoints)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Member, 0.10f, .string = str8_lit("enabled"), .display_string = str8_lit("Enabled"), .view_rule = str8_lit("checkbox"));
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Member, 0.10f, .string = str8_lit("hit_count"), .display_string = str8_lit("Hit Count"));
}
rd_watch_view_build(wv, 0, 10, rect);
rd_watch_view_build(wv, str8_lit("breakpoints"), str8_lit(""), 0, 10, rect);
ProfEnd();
}
@@ -5492,7 +5504,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(watch_pins)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Member, 0.5f, .string = str8_lit("Label"), .dequote_string = 1);
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Member, 0.5f, .string = str8_lit("Location"), .dequote_string = 1, .is_non_code = 1);
}
rd_watch_view_build(wv, 0, 10, rect);
rd_watch_view_build(wv, str8_lit("watch_pins"), str8_lit(""), 0, 10, rect);
ProfEnd();
}
@@ -5734,7 +5746,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(call_stack)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.7f);
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Module, 0.25f, .is_non_code = 1);
}
rd_watch_view_build(wv, 0, 10, rect);
rd_watch_view_build(wv, str8_lit("current_thread.callstack.v"), str8_lit("cast:void**, array:current_thread.callstack.count"), 0, 10, rect);
ProfEnd();
}
@@ -6089,7 +6101,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(watch)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_ViewRule, 0.30f);
}
String8 filter = rd_view_filter();
rd_watch_view_build(wv, 1 * (filter.size == 0), 10, rect);
rd_watch_view_build(wv, str8_lit("watches"), str8_lit(""), 1 * (filter.size == 0), 10, rect);
ProfEnd();
}
@@ -6108,7 +6120,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(locals)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Type, 0.15f);
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_ViewRule, 0.30f);
}
rd_watch_view_build(wv, 0, 10, rect);
rd_watch_view_build(wv, str8_lit("locals"), str8_lit(""), 0, 10, rect);
ProfEnd();
}
@@ -6127,7 +6139,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(registers)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Type, 0.15f);
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_ViewRule, 0.30f);
}
rd_watch_view_build(wv, 0, 16, rect);
rd_watch_view_build(wv, str8_lit("registers"), str8_lit("hex"), 0, 16, rect);
ProfEnd();
}
@@ -6146,7 +6158,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(globals)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Type, 0.15f);
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_ViewRule, 0.30f);
}
rd_watch_view_build(wv, 0, 10, rect);
rd_watch_view_build(wv, str8_lit("globals"), str8_lit(""), 0, 10, rect);
ProfEnd();
}
@@ -6165,7 +6177,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(thread_locals)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Type, 0.15f);
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_ViewRule, 0.30f);
}
rd_watch_view_build(wv, 0, 10, rect);
rd_watch_view_build(wv, str8_lit("thread_locals"), str8_lit(""), 0, 10, rect);
ProfEnd();
}
@@ -6184,7 +6196,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(types)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Type, 0.15f);
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_ViewRule, 0.30f);
}
rd_watch_view_build(wv, 0, 10, rect);
rd_watch_view_build(wv, str8_lit("types"), str8_lit(""), 0, 10, rect);
ProfEnd();
}
@@ -6202,7 +6214,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(procedures)
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.6f);
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_ViewRule, 0.2f);
}
rd_watch_view_build(wv, 0, 10, rect);
rd_watch_view_build(wv, str8_lit("procedures"), str8_lit(""), 0, 10, rect);
ProfEnd();
}
+1 -1
View File
@@ -177,6 +177,6 @@ internal void rd_watch_view_column_release(RD_WatchViewState *wv, RD_WatchViewCo
//- rjf: watch view main hooks
internal void rd_watch_view_init(RD_WatchViewState *ewv, RD_WatchViewFillKind fill_kind);
internal void rd_watch_view_build(RD_WatchViewState *ewv, B32 modifiable, U32 default_radix, Rng2F32 rect);
internal void rd_watch_view_build(RD_WatchViewState *ewv, String8 root_expr, String8 root_view_rule, B32 modifiable, U32 default_radix, Rng2F32 rect);
#endif // RADDBG_VIEWS_H