enum type evaluation visualization - can now use watch windows to inspect all possible enum values

This commit is contained in:
Ryan Fleury
2024-02-02 11:50:21 -08:00
parent 847749337b
commit 5d3aa301f0
3 changed files with 73 additions and 2 deletions
+27 -2
View File
@@ -5255,6 +5255,27 @@ df_append_viz_blocks_for_parent__rec(Arena *arena, DBGI_Scope *scope, DF_EvalVie
df_eval_viz_block_end(list_out, last_vb);
}
//////////////////////////////
//- rjf: (enums) descend to members & make block(s)
//
if(parent_is_expanded && expand_rule == DF_EvalVizExpandRule_Default &&
udt_eval.mode == EVAL_EvalMode_NULL &&
udt_type_kind == TG_Kind_Enum)
ProfScope("build viz blocks for UDT type-eval enums")
{
//- rjf: type -> full type info
TG_Type *type = tg_type_from_graph_raddbg_key(scratch.arena, parse_ctx->type_graph, parse_ctx->rdbg, udt_eval.type_key);
//- rjf: build block for all members (cannot be expanded)
DF_EvalVizBlock *last_vb = df_eval_viz_block_begin(arena, DF_EvalVizBlockKind_EnumMembers, key, df_expand_key_make(df_hash_from_expand_key(key), 0), depth+1);
{
last_vb->eval = udt_eval;
last_vb->cfg_table = *cfg_table;
last_vb->visual_idx_range = last_vb->semantic_idx_range = r1u64(0, type->count);
}
df_eval_viz_block_end(list_out, last_vb);
}
//////////////////////////////
//- rjf: (structs, unions, classes) descend to members & make block(s), with linked list view
//
@@ -5609,10 +5630,14 @@ df_eval_viz_row_list_push_new(Arena *arena, EVAL_ParseCtx *parse_ctx, DF_EvalViz
{
break;
}
if(block->eval.mode != EVAL_EvalMode_NULL && ((TG_Kind_FirstBasic <= kind && kind <= TG_Kind_LastBasic) || kind == TG_Kind_Ptr || kind == TG_Kind_LRef || kind == TG_Kind_RRef))
if(eval.mode != EVAL_EvalMode_NULL && ((TG_Kind_FirstBasic <= kind && kind <= TG_Kind_LastBasic) || kind == TG_Kind_Ptr || kind == TG_Kind_LRef || kind == TG_Kind_RRef))
{
row->flags |= DF_EvalVizRowFlag_CanEditValue;
}
if(eval.mode == EVAL_EvalMode_NULL && kind == TG_Kind_Enum)
{
row->flags |= DF_EvalVizRowFlag_CanExpand;
}
if(kind == TG_Kind_Struct ||
kind == TG_Kind_Union ||
kind == TG_Kind_Class ||
@@ -5624,7 +5649,7 @@ df_eval_viz_row_list_push_new(Arena *arena, EVAL_ParseCtx *parse_ctx, DF_EvalViz
{
break;
}
if(block->eval.mode == EVAL_EvalMode_NULL)
if(eval.mode == EVAL_EvalMode_NULL)
{
break;
}
+1
View File
@@ -696,6 +696,7 @@ typedef enum DF_EvalVizBlockKind
DF_EvalVizBlockKind_Null, // empty
DF_EvalVizBlockKind_Root, // root of tree or subtree; possibly-expandable expression.
DF_EvalVizBlockKind_Members, // members of struct, class, union
DF_EvalVizBlockKind_EnumMembers, // members of enum
DF_EvalVizBlockKind_Elements, // elements of array
DF_EvalVizBlockKind_Links, // flattened nodes in a linked list
DF_EvalVizBlockKind_Canvas, // escape hatch for arbitrary UI