From 1284c25b9e83a65a2ca46e79ed9233084a3883f0 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Wed, 7 May 2025 08:58:12 -0700 Subject: [PATCH] sketch out better usage of expansion info in text visualizer; notes; naming pass --- src/eval/eval_core.c | 55 ++- src/eval/eval_ir.c | 22 +- src/eval/eval_types.c | 68 ++-- src/eval/eval_types.h | 4 +- .../eval_visualization_core.c | 22 +- src/raddbg/raddbg_core.c | 14 +- src/raddbg/raddbg_eval.c | 12 +- src/raddbg/raddbg_main.c | 363 ------------------ src/raddbg/raddbg_views.c | 32 +- 9 files changed, 126 insertions(+), 466 deletions(-) diff --git a/src/eval/eval_core.c b/src/eval/eval_core.c index 394d67bf..ce82cff8 100644 --- a/src/eval/eval_core.c +++ b/src/eval/eval_core.c @@ -1001,8 +1001,7 @@ e_value_eval_from_eval(E_Eval eval) // rjf: mask&shift, for bitfields if(type_kind == E_TypeKind_Bitfield && type_byte_size <= sizeof(U64)) { - Temp scratch = scratch_begin(0, 0); - E_Type *type = e_type_from_key__cached(type_key); + E_Type *type = e_type_from_key(type_key); U64 valid_bits_mask = 0; for(U64 idx = 0; idx < type->count; idx += 1) { @@ -1011,7 +1010,6 @@ e_value_eval_from_eval(E_Eval eval) eval.value.u64 = eval.value.u64 >> type->off; eval.value.u64 = eval.value.u64 & valid_bits_mask; eval.irtree.type_key = type->direct_type_key; - scratch_end(scratch); } // rjf: manually sign-extend @@ -1222,19 +1220,44 @@ e_base_offset_from_eval(E_Eval eval) internal U64 e_range_size_from_eval(E_Eval eval) { - U64 result = 256; - E_TypeKey type_unwrapped = e_type_key_unwrap(eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative); - E_TypeKind type_unwrapped_kind = e_type_kind_from_key(type_unwrapped); - if(type_unwrapped_kind == E_TypeKind_Array || - type_unwrapped_kind == E_TypeKind_Struct || - type_unwrapped_kind == E_TypeKind_Union || - type_unwrapped_kind == E_TypeKind_Class) + U64 result = KB(16); { - result = e_type_byte_size_from_key(type_unwrapped); - } - else - { - result = KB(16); + E_TypeKey type_core = e_type_key_unwrap(eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative); + E_TypeKind type_core_kind = e_type_kind_from_key(type_core); + B32 got_size = 0; + + // rjf: try getting size from expansions + if(!got_size) + { + E_TypeKey maybe_lens_type_key = e_type_key_unwrap(eval.irtree.type_key, E_TypeUnwrapFlag_Meta); + E_TypeKind maybe_lens_type_kind = e_type_kind_from_key(maybe_lens_type_key); + if(maybe_lens_type_kind == E_TypeKind_Lens) + { + E_TypeExpandRule *expand_rule = e_expand_rule_from_type_key(maybe_lens_type_key); + if(expand_rule->info != 0) + { + Temp scratch = scratch_begin(0, 0); + U64 element_size = e_type_byte_size_from_key(e_type_key_unwrap(type_core, E_TypeUnwrapFlag_All)); + E_TypeExpandInfo expand_info = expand_rule->info(scratch.arena, eval, str8_zero()); + result = expand_info.expr_count * element_size; + got_size = 1; + scratch_end(scratch); + } + } + } + + // rjf: try getting size from intrinsic type (e.g. arrays/etc.) + if(!got_size) + { + if(type_core_kind == E_TypeKind_Array || + type_core_kind == E_TypeKind_Struct || + type_core_kind == E_TypeKind_Union || + type_core_kind == E_TypeKind_Class) + { + result = e_type_byte_size_from_key(type_core); + got_size = 1; + } + } } return result; } @@ -1314,7 +1337,7 @@ e_debug_log_from_expr_string(Arena *arena, String8 string) type_key = e_type_key_direct(type_key), indent += 1) { - E_Type *type = e_type_from_key(scratch.arena, type_key); + E_Type *type = e_push_type_from_key(scratch.arena, type_key); str8_list_pushf(scratch.arena, &strings, "%.*s%S\n", (int)indent*4, indent_spaces, e_type_kind_basic_string_table[type->kind]); } } diff --git a/src/eval/eval_ir.c b/src/eval/eval_ir.c index d24c6d39..62e88a1a 100644 --- a/src/eval/eval_ir.c +++ b/src/eval/eval_ir.c @@ -397,7 +397,7 @@ E_TYPE_ACCESS_FUNCTION_DEF(default) } if(match.kind == E_MemberKind_Null) { - E_Type *type = e_type_from_key__cached(check_type_key); + E_Type *type = e_type_from_key(check_type_key); if(type->enum_vals != 0) { String8 lookup_string = exprr->string; @@ -637,7 +637,7 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, B32 E_TypeKind kind = e_type_kind_from_key(k); for(;kind == E_TypeKind_Lens;) { - E_Type *lens_type = e_type_from_key__cached(k); + E_Type *lens_type = e_type_from_key(k); if((lens_type->flags & E_TypeFlag_InheritedByMembers && expr->kind == E_ExprKind_MemberAccess) || (lens_type->flags & E_TypeFlag_InheritedByElements && expr->kind == E_ExprKind_ArrayIndex)) { @@ -649,11 +649,11 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, B32 } // rjf: pick access hook based on type - E_Type *lhs_type = e_type_from_key__cached(lhs_irtree_try->type_key); + E_Type *lhs_type = e_type_from_key(lhs_irtree_try->type_key); E_TypeAccessFunctionType *lhs_access = lhs_type->access; for(E_Type *lens_type = lhs_type; lens_type->kind == E_TypeKind_Lens || lens_type->kind == E_TypeKind_Set; - lens_type = e_type_from_key__cached(lens_type->direct_type_key)) + lens_type = e_type_from_key(lens_type->direct_type_key)) { if(lens_type->access != 0) { @@ -1292,7 +1292,7 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, B32 E_IRTreeAndType lhs_irtree = e_push_irtree_and_type_from_expr(arena, parent, disallow_autohooks, 1, lhs); e_msg_list_concat_in_place(&result.msgs, &lhs_irtree.msgs); E_TypeKey lhs_type_key = lhs_irtree.type_key; - E_Type *lhs_type = e_type_from_key__cached(lhs_type_key); + E_Type *lhs_type = e_type_from_key(lhs_type_key); // rjf: calling a type? -> treat as a cast of that type if(lhs_irtree.mode == E_Mode_Null && lhs_type != &e_type_nil && lhs_type->kind != E_TypeKind_Lens && lhs_type->kind != E_TypeKind_LensSpec) @@ -2130,7 +2130,7 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, B32 { E_Expr *lens_spec_expr = e_string2expr_map_lookup(e_ir_ctx->macro_map, str8_lit("array")); E_TypeKey lens_spec_type_key = lens_spec_expr->type_key; - E_Type *lens_spec_type = e_type_from_key__cached(lens_spec_type_key); + E_Type *lens_spec_type = e_type_from_key(lens_spec_type_key); result.type_key = e_type_key_cons(.kind = E_TypeKind_Lens, .flags = lens_spec_type->flags, .count = 1, @@ -2147,10 +2147,10 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, B32 //- rjf: if the evaluated type has a hook for an extra layer of ir extension, // call into it - E_Type *type = e_type_from_key__cached(result.type_key); + E_Type *type = e_type_from_key(result.type_key); { E_TypeIRExtFunctionType *irext = type->irext; - for(E_Type *t = type; t->kind == E_TypeKind_Lens || t->kind == E_TypeKind_Set; t = e_type_from_key__cached(t->direct_type_key)) + for(E_Type *t = type; t->kind == E_TypeKind_Lens || t->kind == E_TypeKind_Set; t = e_type_from_key(t->direct_type_key)) { if(t->irext != 0) { @@ -2182,7 +2182,7 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, B32 if(ptee_kind == E_TypeKind_Struct || ptee_kind == E_TypeKind_Class) { - E_Type *ptee_type = e_type_from_key__cached(ptee_key); + E_Type *ptee_type = e_type_from_key(ptee_key); B32 has_vtable = 0; for(U64 idx = 0; idx < ptee_type->count; idx += 1) { @@ -2282,10 +2282,10 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, B32 // if(inherited_lenses.count != 0) { - E_Type *result_type = e_type_from_key__cached(result.type_key); + E_Type *result_type = e_type_from_key(result.type_key); for(E_TypeKeyNode *n = inherited_lenses.first; n != 0; n = n->next) { - E_Type *src_type = e_type_from_key__cached(n->v); + E_Type *src_type = e_type_from_key(n->v); E_TypeKey dst_type_key = e_type_key_cons(.kind = src_type->kind, .flags = src_type->flags, .name = src_type->name, diff --git a/src/eval/eval_types.c b/src/eval/eval_types.c index 8f2d5345..a0293565 100644 --- a/src/eval/eval_types.c +++ b/src/eval/eval_types.c @@ -645,7 +645,7 @@ e_type_byte_size_from_key(E_TypeKey key) } internal E_Type * -e_type_from_key(Arena *arena, E_TypeKey key) +e_push_type_from_key(Arena *arena, E_TypeKey key) { ProfBeginFunction(); E_Type *type = &e_type_nil; @@ -1251,7 +1251,7 @@ e_type_data_members_from_key(Arena *arena, E_TypeKey key) E_MemberList members_list = {0}; B32 members_need_offset_sort = 0; { - E_Type *root_type = e_type_from_key__cached(key); + E_Type *root_type = e_type_from_key(key); typedef struct Task Task; struct Task { @@ -1290,7 +1290,7 @@ e_type_data_members_from_key(Arena *arena, E_TypeKey key) t->inheritance_chain = e_type_key_list_copy(scratch.arena, &task->inheritance_chain); e_type_key_list_push(scratch.arena, &t->inheritance_chain, type->members[member_idx].type_key); t->type_key = type->members[member_idx].type_key; - t->type = e_type_from_key__cached(type->members[member_idx].type_key); + t->type = e_type_from_key(type->members[member_idx].type_key); SLLQueuePush(first_task, last_task, t); members_need_offset_sort = 1; } @@ -1390,14 +1390,14 @@ e_expand_rule_from_type_key(E_TypeKey key) { E_TypeExpandRule *rule = &e_type_expand_rule__default; { - E_Type *type = e_type_from_key__cached(e_type_key_unwrap(key, E_TypeUnwrapFlag_Meta)); + E_Type *type = e_type_from_key(e_type_key_unwrap(key, E_TypeUnwrapFlag_Meta)); if(type->expand.info != 0) { rule = &type->expand; } for(E_Type *lens_type = type; lens_type->kind == E_TypeKind_Lens || lens_type->kind == E_TypeKind_Set; - lens_type = e_type_from_key__cached(e_type_key_unwrap(lens_type->direct_type_key, E_TypeUnwrapFlag_Meta))) + lens_type = e_type_from_key(e_type_key_unwrap(lens_type->direct_type_key, E_TypeUnwrapFlag_Meta))) { if(lens_type->expand.info != 0) { @@ -1421,7 +1421,7 @@ e_type_key_direct(E_TypeKey key) case E_TypeKeyKind_Ext: case E_TypeKeyKind_Cons: { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); result = type->direct_type_key; }break; } @@ -1438,7 +1438,7 @@ e_type_key_owner(E_TypeKey key) case E_TypeKeyKind_Ext: case E_TypeKeyKind_Cons: { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); result = type->owner_type_key; }break; } @@ -1554,8 +1554,8 @@ e_type_match(E_TypeKey l, E_TypeKey r) case E_TypeKind_Array: { - E_Type *lt = e_type_from_key__cached(l); - E_Type *rt = e_type_from_key__cached(r); + E_Type *lt = e_type_from_key(l); + E_Type *rt = e_type_from_key(r); if(lt->count == rt->count && e_type_match(lt->direct_type_key, rt->direct_type_key)) { result = 1; @@ -1564,8 +1564,8 @@ e_type_match(E_TypeKey l, E_TypeKey r) case E_TypeKind_Function: { - E_Type *lt = e_type_from_key__cached(l); - E_Type *rt = e_type_from_key__cached(r); + E_Type *lt = e_type_from_key(l); + E_Type *rt = e_type_from_key(r); if(lt->count == rt->count && e_type_match(lt->direct_type_key, rt->direct_type_key)) { B32 params_match = 1; @@ -1586,8 +1586,8 @@ e_type_match(E_TypeKey l, E_TypeKey r) case E_TypeKind_Method: { - E_Type *lt = e_type_from_key__cached(l); - E_Type *rt = e_type_from_key__cached(r); + E_Type *lt = e_type_from_key(l); + E_Type *rt = e_type_from_key(r); if(lt->count == rt->count && e_type_match(lt->direct_type_key, rt->direct_type_key) && e_type_match(lt->owner_type_key, rt->owner_type_key)) @@ -1625,20 +1625,20 @@ e_type_lhs_string_from_key(Arena *arena, E_TypeKey key, String8List *out, U32 pr { default: { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); str8_list_pushf(arena, out, "%S ", type->name); }break; case E_TypeKind_Bitfield: { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); e_type_lhs_string_from_key(arena, type->direct_type_key, out, prec, skip_return); str8_list_pushf(arena, out, ": %I64u", type->count); }break; case E_TypeKind_Modifier: { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); E_TypeKey direct = type->direct_type_key; e_type_lhs_string_from_key(arena, direct, out, 1, skip_return); if(type->flags & E_TypeFlag_Const) @@ -1662,7 +1662,7 @@ e_type_lhs_string_from_key(Arena *arena, E_TypeKey key, String8List *out, U32 pr case E_TypeKind_Class: case E_TypeKind_Alias: { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); str8_list_pushf(arena, out, "%S ", type->name); }break; @@ -1672,7 +1672,7 @@ e_type_lhs_string_from_key(Arena *arena, E_TypeKey key, String8List *out, U32 pr case E_TypeKind_IncompleteClass: keyword = str8_lit("class"); goto fwd_udt; fwd_udt:; { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); str8_list_push(arena, out, keyword); str8_list_push(arena, out, str8_lit(" ")); str8_list_pushf(arena, out, "%S ", type->name); @@ -1703,7 +1703,7 @@ e_type_lhs_string_from_key(Arena *arena, E_TypeKey key, String8List *out, U32 pr case E_TypeKind_Lens: { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); str8_list_pushf(arena, out, "%S(", type->name); E_TypeKey direct = e_type_key_direct(key); String8 direct_string = e_type_string_from_key(arena, direct); @@ -1722,7 +1722,7 @@ e_type_lhs_string_from_key(Arena *arena, E_TypeKey key, String8List *out, U32 pr E_TypeKey direct = e_type_key_direct(key); e_type_lhs_string_from_key(arena, direct, out, 1, skip_return); str8_list_push(arena, out, str8_lit("*")); - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); if(type->count != 1) { str8_list_pushf(arena, out, ".%I64u", type->count); @@ -1745,10 +1745,10 @@ e_type_lhs_string_from_key(Arena *arena, E_TypeKey key, String8List *out, U32 pr case E_TypeKind_MemberPtr: { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); E_TypeKey direct = type->direct_type_key; e_type_lhs_string_from_key(arena, direct, out, 1, skip_return); - E_Type *container = e_type_from_key__cached(type->owner_type_key); + E_Type *container = e_type_from_key(type->owner_type_key); if(container->kind != E_TypeKind_Null) { str8_list_push(arena, out, push_str8_copy(arena, container->name)); @@ -1796,7 +1796,7 @@ e_type_rhs_string_from_key(Arena *arena, E_TypeKey key, String8List *out, U32 pr case E_TypeKind_Array: { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); if(prec == 1) { str8_list_push(arena, out, str8_lit(")")); @@ -1811,7 +1811,7 @@ e_type_rhs_string_from_key(Arena *arena, E_TypeKey key, String8List *out, U32 pr case E_TypeKind_Function: { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); if(prec == 1) { str8_list_push(arena, out, str8_lit(")")); @@ -1884,7 +1884,7 @@ e_default_expansion_type_from_key(E_TypeKey root_key) // if(e_type_kind_is_pointer_or_ref(kind)) { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); if(!e_type_key_match(e_type_key_basic(E_TypeKind_Void), type->direct_type_key)) { if(type->count == 1 && hit_1ptr) @@ -1965,7 +1965,7 @@ e_default_expansion_type_from_key(E_TypeKey root_key) //~ rjf: Cache Lookups internal E_Type * -e_type_from_key__cached(E_TypeKey key) +e_type_from_key(E_TypeKey key) { E_Type *type = &e_type_nil; { @@ -1984,7 +1984,7 @@ e_type_from_key__cached(E_TypeKey key) { node = push_array(e_cache->arena, E_TypeCacheNode, 1); node->key = key; - node->type = e_type_from_key(e_cache->arena, key); + node->type = e_push_type_from_key(e_cache->arena, key); SLLQueuePush(e_cache->type_cache_slots[slot_idx].first, e_cache->type_cache_slots[slot_idx].last, node); } type = node->type; @@ -2144,7 +2144,7 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(default) if(array_type_kind == E_TypeKind_Array || array_type_kind == E_TypeKind_Ptr) { - E_Type *array_type = e_type_from_key__cached(expand_type_key); + E_Type *array_type = e_type_from_key(expand_type_key); result.expr_count = array_type->count; did_expansion = 1; } @@ -2156,7 +2156,7 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(default) E_TypeKind enum_type_kind = e_type_kind_from_key(expand_type_key); if(enum_type_kind == E_TypeKind_Enum) { - E_Type *enum_type = e_type_from_key__cached(expand_type_key); + E_Type *enum_type = e_type_from_key(expand_type_key); result.expr_count = enum_type->count; did_expansion = 1; } @@ -2194,7 +2194,7 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(default) //- rjf: enum case -> the lookup-range will return a range of enum constants else if(expand_type_kind == E_TypeKind_Enum) { - E_Type *type = e_type_from_key__cached(expand_type_key); + E_Type *type = e_type_from_key(expand_type_key); Rng1U64 legal_idx_range = r1u64(0, type->count); Rng1U64 read_range = intersect_1u64(legal_idx_range, idx_range); U64 read_range_count = dim_1u64(read_range); @@ -2236,14 +2236,14 @@ E_TYPE_EXPAND_NUM_FROM_ID_FUNCTION_DEF(identity) E_TYPE_EXPAND_INFO_FUNCTION_DEF(only) { - E_Type *type = e_type_from_key__cached(eval.irtree.type_key); + E_Type *type = e_type_from_key(eval.irtree.type_key); E_TypeExpandInfo info = {0, type->count}; return info; } E_TYPE_EXPAND_RANGE_FUNCTION_DEF(only) { - E_Type *type = e_type_from_key__cached(eval.irtree.type_key); + E_Type *type = e_type_from_key(eval.irtree.type_key); U64 out_idx = 0; for(U64 idx = idx_range.min; idx < idx_range.max; idx += 1, out_idx += 1) { @@ -2260,7 +2260,7 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(only) E_TYPE_EXPAND_INFO_FUNCTION_DEF(omit) { - E_Type *type = e_type_from_key__cached(eval.irtree.type_key); + E_Type *type = e_type_from_key(eval.irtree.type_key); String8Array allowed_children_array = {0}; { Temp scratch = scratch_begin(&arena, 1); @@ -2345,7 +2345,7 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(sequence) E_TYPE_EXPAND_INFO_FUNCTION_DEF(array) { - E_Type *type = e_type_from_key__cached(eval.irtree.type_key); + E_Type *type = e_type_from_key(eval.irtree.type_key); U64 count = 1; if(type->args != 0 && type->count > 0) E_ParentKey(eval.key) { diff --git a/src/eval/eval_types.h b/src/eval/eval_types.h index 451dc8b0..0ce41cd2 100644 --- a/src/eval/eval_types.h +++ b/src/eval/eval_types.h @@ -89,7 +89,7 @@ internal B32 e_type_key_match(E_TypeKey l, E_TypeKey r); internal U64 e_hash_from_type(E_Type *type); internal E_TypeKind e_type_kind_from_key(E_TypeKey key); internal U64 e_type_byte_size_from_key(E_TypeKey key); -internal E_Type *e_type_from_key(Arena *arena, E_TypeKey key); +internal E_Type *e_push_type_from_key(Arena *arena, E_TypeKey key); internal int e_type_qsort_compare_members_offset(E_Member *a, E_Member *b); internal E_MemberArray e_type_data_members_from_key(Arena *arena, E_TypeKey key); internal E_TypeExpandRule *e_expand_rule_from_type_key(E_TypeKey key); @@ -112,7 +112,7 @@ internal E_TypeKey e_default_expansion_type_from_key(E_TypeKey key); //////////////////////////////// //~ rjf: Cache Lookups -internal E_Type *e_type_from_key__cached(E_TypeKey key); +internal E_Type *e_type_from_key(E_TypeKey key); internal E_MemberCacheNode *e_member_cache_node_from_type_key(E_TypeKey key); internal E_MemberArray e_type_data_members_from_key_filter__cached(E_TypeKey key, String8 filter); internal E_MemberArray e_type_data_members_from_key__cached(E_TypeKey key); diff --git a/src/eval_visualization/eval_visualization_core.c b/src/eval_visualization/eval_visualization_core.c index 7e8deaf1..a9e70f6a 100644 --- a/src/eval_visualization/eval_visualization_core.c +++ b/src/eval_visualization/eval_visualization_core.c @@ -89,7 +89,7 @@ ev_expansion_type_from_key(E_TypeKey type_key) // so, choose the current eval if(kind == E_TypeKind_Lens) { - E_Type *type = e_type_from_key__cached(key); + E_Type *type = e_type_from_key(key); if(type->expand.info != 0 || ev_expand_rule_from_string(type->name) != &ev_nil_expand_rule) { @@ -167,7 +167,7 @@ ev_type_key_is_editable(E_TypeKey type_key) }break; case E_TypeKind_Array: { - E_Type *type = e_type_from_key__cached(t); + E_Type *type = e_type_from_key(t); if(type->flags & E_TypeFlag_IsNotText) { result = 0; @@ -448,7 +448,7 @@ ev_expand_rule_from_type_key(E_TypeKey type_key) E_TypeKind kind = e_type_kind_from_key(k); for(;kind == E_TypeKind_Lens; k = e_type_key_direct(e_type_key_unwrap(k, E_TypeUnwrapFlag_Meta)), kind = e_type_kind_from_key(k)) { - E_Type *type = e_type_from_key__cached(k); + E_Type *type = e_type_from_key(k); EV_ExpandRule *candidate = ev_expand_rule_from_string(type->name); if(candidate != &ev_nil_expand_rule) { @@ -1420,7 +1420,7 @@ ev_string_from_simple_typed_eval(Arena *arena, EV_StringParams *params, E_Eval e case E_TypeKind_Enum: { Temp scratch = scratch_begin(&arena, 1); - E_Type *type = e_type_from_key__cached(type_key); + E_Type *type = e_type_from_key(type_key); String8 constant_name = {0}; for(U64 val_idx = 0; val_idx < type->count; val_idx += 1) { @@ -1560,7 +1560,7 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string) { if(it->top_task->redirect_to_sets_and_structs) { - E_Type *type = e_type_from_key__cached(type_key); + E_Type *type = e_type_from_key(type_key); if(type->flags & E_TypeFlag_ArrayLikeExpansion) { expansion_opener_symbol = str8_lit("["); @@ -1568,7 +1568,7 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string) } goto arrays_and_sets_and_structs; } - E_Type *type = e_type_from_key__cached(type_key); + E_Type *type = e_type_from_key(type_key); E_TypeKind element_type_kind = e_type_kind_from_key(e_type_key_unwrap(type->direct_type_key, E_TypeUnwrapFlag_All)); B32 lens_applied = 1; EV_StringParams lens_params = *params; @@ -1690,7 +1690,7 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string) default:{}break; case 0: { - E_Type *type = e_type_from_key__cached(type_key); + E_Type *type = e_type_from_key(type_key); *out_string = push_str8f(arena, "%S (", type->name); need_pop = 0; need_new_task = 1; @@ -1706,7 +1706,7 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string) } else { - E_Type *type = e_type_from_key__cached(type_key); + E_Type *type = e_type_from_key(type_key); *out_string = type->name; } }break; @@ -1756,8 +1756,8 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string) { ptr_data = it->top_task->user_data = push_array(arena, EV_StringPtrData, 1); ptr_data->value_eval = e_value_eval_from_eval(eval); - ptr_data->type = e_type_from_key__cached(type_key); - ptr_data->direct_type = e_type_from_key__cached(e_type_key_unwrap(type_key, E_TypeUnwrapFlag_All)); + ptr_data->type = e_type_from_key(type_key); + ptr_data->direct_type = e_type_from_key(e_type_key_unwrap(type_key, E_TypeUnwrapFlag_All)); ptr_data->ptee_has_content = (ptr_data->value_eval.value.u64 != 0 && ptr_data->direct_type->kind != E_TypeKind_Null && ptr_data->direct_type->kind != E_TypeKind_Void); ptr_data->ptee_has_string = ((E_TypeKind_Char8 <= ptr_data->direct_type->kind && ptr_data->direct_type->kind <= E_TypeKind_UChar32) || ptr_data->direct_type->kind == E_TypeKind_S8 || @@ -2081,7 +2081,7 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string) if(expand_data == 0) { expand_data = it->top_task->user_data = push_array(arena, EV_ExpandedTypeData, 1); - expand_data->type = e_type_from_key__cached(type_key); + expand_data->type = e_type_from_key(type_key); } switch(task_idx) { diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index d0c173bb..279d6088 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -2388,7 +2388,7 @@ rd_view_from_eval(RD_Cfg *parent, E_Eval eval) { Temp scratch = scratch_begin(0, 0); E_TypeKey type_key = eval.irtree.type_key; - E_Type *type = e_type_from_key__cached(type_key); + E_Type *type = e_type_from_key(type_key); String8 schema_name = str8_lit("watch"); B32 type_is_visualizer = 0; if(type->kind == E_TypeKind_Lens) @@ -3262,7 +3262,7 @@ rd_view_ui(Rng2F32 rect) case E_SpaceKind_File: case E_SpaceKind_FileSystem: { - E_Type *type = e_type_from_key__cached(eval.irtree.type_key); + E_Type *type = e_type_from_key(eval.irtree.type_key); String8 file = rd_file_path_from_eval(scratch.arena, eval); if(str8_match(type->name, str8_lit("folder"), 0)) { @@ -3954,7 +3954,7 @@ rd_view_ui(Rng2F32 rect) E_TypeKind block_type_kind = e_type_kind_from_key(block_type_key); if(block_type_kind == E_TypeKind_Set) { - E_Type *block_type = e_type_from_key__cached(block_type_key); + E_Type *block_type = e_type_from_key(block_type_key); group_cfg_name = rd_singular_from_code_name_plural(block_type->name); if(group_cfg_name.size == 0) { @@ -4303,7 +4303,7 @@ rd_view_ui(Rng2F32 rect) EV_Row *row = &row_node->row; F32 row_height = row_height_px*row->visual_size; RD_WatchRowInfo *row_info = &row_infos[local_row_idx]; - E_Type *block_type = e_type_from_key__cached(row->block->eval.irtree.type_key); + E_Type *block_type = e_type_from_key(row->block->eval.irtree.type_key); // rjf: determine if this row's block is good for the current drag/drop B32 block_is_good_for_drop = 0; @@ -4608,7 +4608,7 @@ rd_view_ui(Rng2F32 rect) B32 cell_selected = (row_selected && selection_tbl.min.x <= cell_x && cell_x <= selection_tbl.max.x); RD_WatchRowCellInfo cell_info = rd_info_from_watch_row_cell(scratch.arena, row, string_flags, row_info, cell, ui_top_font(), ui_top_font_size(), visual_row_string_max_size_px); E_TypeKey cell_type_key = cell->eval.irtree.type_key; - E_Type *cell_type = e_type_from_key__cached(cell_type_key); + E_Type *cell_type = e_type_from_key(cell_type_key); E_Eval cell_value_eval = e_value_eval_from_eval(cell->eval); B32 cell_toggled = (cell_value_eval.value.u64 != 0); B32 next_cell_toggled = cell_toggled; @@ -4836,7 +4836,7 @@ rd_view_ui(Rng2F32 rect) RD_CellParams cell_params = {0}; ProfScope("form cell build parameters") { - E_Type *block_type = e_type_from_key__cached(row->block->eval.irtree.type_key); + E_Type *block_type = e_type_from_key(row->block->eval.irtree.type_key); B32 cells_are_editable = !!(block_type->flags & E_TypeFlag_EditableChildren); // rjf: set up base parameters @@ -5568,7 +5568,7 @@ rd_arch_from_eval(E_Eval eval) } // rjf: try arch arguments - E_Type *type = e_type_from_key__cached(eval.irtree.type_key); + E_Type *type = e_type_from_key(eval.irtree.type_key); if(type->kind == E_TypeKind_Lens) { for EachIndex(idx, type->count) diff --git a/src/raddbg/raddbg_eval.c b/src/raddbg/raddbg_eval.c index e543ea33..7c848b68 100644 --- a/src/raddbg/raddbg_eval.c +++ b/src/raddbg/raddbg_eval.c @@ -26,7 +26,7 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(commands) { Temp scratch = scratch_begin(&arena, 1); String8List cmd_names = {0}; - E_Type *type = e_type_from_key__cached(eval.irtree.type_key); + E_Type *type = e_type_from_key(eval.irtree.type_key); for EachNonZeroEnumVal(RD_CmdKind, k) { RD_CmdKindInfo *info = &rd_cmd_kind_info_table[k]; @@ -269,7 +269,7 @@ E_TYPE_IREXT_FUNCTION_DEF(schema) String8 bytecode = e_bytecode_from_oplist(scratch.arena, &oplist); E_Interpretation interpret = e_interpret(bytecode); E_TypeKey type_key = irtree->type_key; - E_Type *type = e_type_from_key__cached(type_key); + E_Type *type = e_type_from_key(type_key); ext->cfg = rd_cfg_from_eval_space(interpret.space); ext->entity = rd_ctrl_entity_from_eval_space(interpret.space); ext->schemas = rd_schemas_from_name(type->name); @@ -687,7 +687,7 @@ E_TYPE_IREXT_FUNCTION_DEF(cfgs_slice) //- rjf: determine which key we'll be gathering E_TypeKey type_key = irtree->type_key; - E_Type *type = e_type_from_key__cached(type_key); + E_Type *type = e_type_from_key(type_key); String8 cfg_name = rd_singular_from_code_name_plural(type->name); //- rjf: gather cfgs @@ -1423,7 +1423,7 @@ E_TYPE_ACCESS_FUNCTION_DEF(ctrl_entities) }break; case E_ExprKind_ArrayIndex: { - E_Type *type = e_type_from_key__cached(lhs_irtree->type_key); + E_Type *type = e_type_from_key(lhs_irtree->type_key); CTRL_EntityKind kind = ctrl_entity_kind_from_string(rd_singular_from_code_name_plural(type->name)); E_Value rhs_value = e_value_from_expr(expr->first->next); U64 rhs_idx = rhs_value.u64; @@ -1461,7 +1461,7 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(ctrl_entities) //- rjf: determine which type of child we're gathering E_TypeKey lhs_type_key = eval.irtree.type_key; - E_Type *lhs_type = e_type_from_key__cached(lhs_type_key); + E_Type *lhs_type = e_type_from_key(lhs_type_key); String8 name = rd_singular_from_code_name_plural(lhs_type->name); CTRL_EntityKind entity_kind = ctrl_entity_kind_from_string(name); @@ -1548,7 +1548,7 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(debug_info_table) RDI_SectionKind section = RDI_SectionKind_NULL; { E_TypeKey lhs_type_key = eval.irtree.type_key; - E_Type *lhs_type = e_type_from_key__cached(lhs_type_key); + E_Type *lhs_type = e_type_from_key(lhs_type_key); if(0){} else if(str8_match(lhs_type->name, str8_lit("procedures"), 0)) {section = RDI_SectionKind_Procedures;} else if(str8_match(lhs_type->name, str8_lit("globals"), 0)) {section = RDI_SectionKind_GlobalVariables;} diff --git a/src/raddbg/raddbg_main.c b/src/raddbg/raddbg_main.c index 622c9cc6..5cc5210c 100644 --- a/src/raddbg/raddbg_main.c +++ b/src/raddbg/raddbg_main.c @@ -1,215 +1,6 @@ // Copyright (c) 2024 Epic Games Tools // Licensed under the MIT license (https://opensource.org/license/mit/) -//////////////////////////////// -//~ rjf: 0.9.16 release notes -// -// - **Formal integration of views (view rules) into the evaluation language.** -// "View rules", now simply called "views", have been formally integrated -// into the debugger evaluation language. They now appear similar to function -// calls, and are expressed directly within an expression. For example, an -// expression `dynamic_array` with a view rule `slice` from prior versions -// would now be expressed as `slice(dynamic_array)`. Alternatively, views -// can be expressed with similar syntax to method calls: -// `dynamic_array.slice()`. Many views can still be attached to a single -// expression, like `dynamic_array.slice().hex()` (equivalent to -// `hex(slice(dynamic_array))`. The first argument to a view is the -// expression to which the view should apply. Some views take additional -// parameters, like `bitmap(base_pointer, width, height)`. Named parameters, -// required in some cases (e.g. the `fmt`/format parameter for `bitmap`), are -// expressed using `name = value` syntax: -// `bitmap(base, width, height, fmt=bgra8)`. -// - **Support for generics in type views (auto view rules)**. "Auto view -// rules", now simply called "type views", have been upgraded to support type -// pattern-matching. This makes them usable for generic types in various -// languages. This pattern-matching is done by using `?` characters in a -// pattern, to specify placeholders for various parts of a type name. For -// example, the pattern `DynamicArray` would match `DynamicArray`, -// `DynamicArray`, and so on. `?(?)` would match all function types. -// (#118, #345) -// - **Usage of the source expression within type views.** Type views have been -// upgraded to support a larger number of possibilities. Instead of mapping -// to a set of views which are applied to some other expression, type views -// can remap the expression itself, and apply additional views. These -// expressions can refer to the originating expression either explicitly -// using the `$` character, or implicitly in some cases. For instance, a type -// like `struct Bitmap {U8 *base; U32 width; U32 height;};` can be used in a -// type view which maps `Bitmap` to `bitmap(base, width, height)`. In this -// case, `base`, `width`, and `height` are recognized as being member names -// of `Bitmap`. This is equivalent to `bitmap($.base, $.width, $.height)`. -// - **Hardware data breakpoints.** Breakpoints have been upgraded to support -// flags for breaking on writing, reading, or execution, as well as an -// address range size. When used with an address location, this can be used -// to express hardware data breakpoints, where the CPU will break when it -// sees particular addresses being written to, read from, or executed, -// regardless of which code does it. There is a maximum limit of four such -// breakpoints on a processor. Theoretically, this means a limit of four per -// thread, but for now, the debugger only supports four global data -// breakpoints. In the future, we plan to allow organizing these by thread, -// in which case the total number of data breakpoints we support will -// increase. -// - **A new `table` view** has been added, which allows one to define custom -// rules for how rows of a watch expansion are formed. The first argument a -// `table` is the expression which should be evaluated (like other views), -// and the remaining arguments are used to express a number of expressions -// which should be used to generated cells for each row in the expansion. For -// instance, `table(my_int_array, $, $*4, $*8)` would expand `my_int_array`, -// but instead of the default row structure (which displays an expression -// string, a value string, and a type string), three cells would be generated -// per row: one with the value of each element, one with that value -// multiplied by 4, and one multiplied by 8. -// - **A new `sequence` view** has been added. This is a simple view which -// simply takes a single integer scalar argument `n`, and returns a sequence -// of integers, from `0`, `1`, `2`, all the way to `n`. This sequence can be -// expanded. This can compose with the `table` view, to easily generate `n` -// rows, and use each integer as a value in each cell expression. As an -// example, `table(sequence(1000), array1[$], array2[$])` would display -// elements of `array1` and `array2` in each row, side-by-side. -// - **The everything palette**. The F1 command palette has been replaced by a -// substantially more powerful "everything palette" (referred to in the UI -// simply as "palette"), opened with the `Open Palette` command. This palette -// lists commands and allows the editing of bindings, just like the old -// command palette (although it now also supports searching for command -// bindings themselves, in addition to the original searching support for -// command names and descriptions). However, this palette now also lists -// targets, breakpoints, recent files, recent projects, settings (including -// tab settings, window settings, user settings, project settings), attached -// processes, threads, modules, functions, types, and global variables. This -// can be used to quickly search for a large set of possible things, and -// either jump to them or edit them. The old `Run Command` command still -// exists, and still presents a command palette, which is simply a -// special-case of the generalized palette. But this command is no longer -// bound to F1 by default. -// - **Upgraded per-tab settings.** The tab right-click menu has been upgraded -// to show all tab-related settings, including ones specially-defined for -// specific visualizers (like the width and height parameters to the bitmap -// visualizer). The debugger UI now also supports per-tab font sizes. If a -// tab has no per-tab font size set, then it inherits the window's font size. -// Each tab's root expression is now also editable in this interface. The tab -// right-click menu's options also show up in the palette when the -// corresponding tab is focused. They can also be manually opened with the -// `Tab Settings` command. -// - **UI for setting the font.** The fonts which the debugger uses can now be -// set through settings UI (including the palette), rather than just through -// the configuration files. -// - **Support for searching system font folders for fonts.** The debugger now -// accepts system font file names in addition to full font file paths to -// specify font settings. -// - **Per-`Watch` expressions and labels.** Expressions inserted into a -// `Watch` tab are now stored per-tab. This makes many `Watch` tabs more -// useful, since different tabs can have a different set of expressions. -// `Watch` tabs can now also be labeled, so you can visually distinguish -// many `Watch` tabs more easily. -// - **Evaluation drag/drop.** Evaluations in a watch tree can be dragged and -// dropped. This can be used to create new top-level rows in a `Watch` tab, -// or to drag evaluations between `Watch` tabs, or to drag evaluations to -// source or disassembly views and pin the evaluation to some location there. -// (#137, #388) -// - **Settings expressions.** Debugger settings have been upgraded to be -// stored as expressions, rather than being locked to a specific value. -// These expressions are evaluated, like any other expression, and their -// evaluated value is used when the setting value is actually needed. -// - **Upgrades to the `slice` view.** The `slice` view has been streamlined -// and simplified. When an expression with a `slice` view is expanded, it -// will simply expand to the slice's contents, which matches the behavior -// with static arrays. The `slice` view now also supports -// `first, one_past_last` pointer pairs, as well as `base_pointer, length` -// pairs. -// - **Boolean evaluation toggle-switches.** The debugger now displays toggle -// switches as an additional visualization and editor for all boolean -// evaluations. -// - **A new `range1` view** has been added, which expresses bounds for some -// scalar value. When this view is used in an evaluation, the debugger will -// visualize the evaluation value with a slider, which can be used to edit -// the value as well. -// - **Merging of `Watch` UI with hover evaluation.** The hover evaluation -// feature has been majorly upgraded to support all features normally -// available in `Watch` tabs. (#342) -// - Added **transient tabs**, which are colored differently than normal tabs. -// These tabs are automatically opened by the debugger when snapping to -// source code which is not already opened. They are automatically replaced -// and recycled when the debugger needs to snap to new locations. This will -// greatly reduce the number of unused source code tabs accumulated -// throughout a debugging session. These tabs can still be promoted to -// permanent tabs, in which case they'll stay around until manually closed. -// - The `Scheduler` tab has been removed, in favor of three separate tabs, -// which present various versions of the same information: `Threads`, -// `Processes`, and `Machines`. The justification for this is that the -// common case is debugging a small number of programs, usually 1, and for -// those purposes, the `Threads` tab is sufficient if not desirable, and -// the extra information provided by `Processes` and `Machines`, while useful -// in other contexts, is not useful in that common case. The `Machines` tab -// now shows a superset of the information previously found in the -// `Scheduler` tab. -// - The two separate interfaces for editing threads, breakpoints, and watch -// pins (the right-click context menu and the dedicated tabs) have been -// merged. Both interfaces support exactly the same features in exactly the -// same way. The same interface is also accessible through the palette. -// - Added the ability to add a list of environment strings to targets. (#73) -// - The debugger releases are now packaged with a `raddbg_markup.h` -// single-header library which contains a number of source code markup tools -// which can be used in your programs. Some of these features are for direct -// interaction with the RAD Debugger. Others are simply helpers (often -// abstracting over platform functionality) for very commonly needed -// debugger-related features, like setting thread names. This second set of -// features will work with any debugger. Here is a list of this library's -// initial features (proper documentation will be written once the library -// matures): -// - `raddbg_is_attached()`: Returns 1 if the RAD Debugger is attached, -// otherwise returns 0. -// - `raddbg_break()`: Generates a trap instruction at the usage site. -// - `raddbg_break_if(expr)`: Generates a trap instruction guarded by a -// conditional, evaluating `expr`. -// - `raddbg_thread_name(format, ...)`, e.g. -// `raddbg_thread_name("worker_thread_%i", index)`: Sets the calling -// thread's name. -// - `raddbg_log(format, ...)`, e.g. -// `raddbg_log("This is a number: %i", 123)`: Writes a debug string for a -// debugger to read and display in its UI. -// - `raddbg_thread_color_u32(hexcode)`, e.g. -// `raddbg_thread_color_u32(0xff0000ff)`: Sets the calling thread's color. -// - Also can be done with individual `[0, 1]` color components: -// `raddbg_thread_color_rgba(1.f, 0.f, 0.f, 1.f)` -// - `raddbg_pin()`, e.g. -// `raddbg_pin(slice(dynamic_array))`: Like watch pins, but defined in -// source code. This is used by the debugger UI, but does not show up -// anywhere other than the source code, so it can either be used as a macro -// (which expands to nothing), or in comments too. -// - `raddbg_entry_point(name)`, e.g. `raddbg_entry_point(entry_point)`: -// declares the entry point for an executable, which the debugger will use -// when stepping into a program, rather than the defaults (e.g. `main`). -// - `raddbg_type_view(, )`, e.g. -// `raddbg_type_view(DynamicArray, slice($))`: declares a type view from -// source code, rather than from debugger configuration. -// - The debugger now incorporates the loaded project in all window titles. -// - Fixed an annoyance where the debugger would open a console window, even -// for graphical programs, causing a flicker. -// - Fixed substantial unnecessary memory usage with very large output logs. -// - Fixed a debugger regression which was incorrectly using thread name events -// when those events were sent to name a suspended thread by a different -// thread. (#430) -// - Added support for Tab and Shift + Tab style navigation in Watch tables, -// using the `Move Next` and `Move Previous` commands. (#93) -// - The debugger now correctly serializes window sizes when fullscreened. -// (#130) -// - Added an option to disable the Alt key Windows-style menu-bar focusing -// behavior. (#382) -// - Added an option to quickly duplicate configuration entities (targets, -// breakpoints, etc.). (#451) -// - Fixed a crash relating to truncated string hover tooltips when font sizes -// were changed. (#416) -// - Fixed the debugger's lack of robustness to selecting non-config files as -// config files. (#432, #409) -// - Fixed crashes caused by quick changes in the set of loaded modules while -// debug information table tabs (`Procedures`, `Globals`, `Types`) were open. -// (#467, #459, #458, #440, #436, #415, #412) -// - Fixed a crash where the debugger would crash when toggling fullscreen, if -// launched in fullscreen mode. (#454, #413) -// - Adjusted breakpoint placement to automatically deduplicate identical -// breakpoints, if placed at the same location, with no extra information -// attached (condition or label). (#407) -// - Made several visual improvements. - //////////////////////////////// //~ rjf: post-0.9.16 TODO notes // @@ -371,160 +162,6 @@ //////////////////////////////// //~ rjf: Recently Completed Task Log -// -// [x] filesystem drag/drop support -// [x] ** Converter performance & heuristics for asynchronously doing it early -// [x] icon fonts glyphs sometimes disappear for specific font size, but they -// reappear if you go +1 higher or -1 lower. Mostly red triangle in watch -// values for "unknown identifier". But also yellow arrow in call stack -// disappears if font size gets too large. -// [x] @cleanup central worker thread pool - eliminate per-layer thread pools -// [x] frontend config entities, serialization/deserialization, remove hacks, -// etc. - the entity structure should be dramatically simplified & made -// to reflect a more flexible string-tree data structure which can be -// more trivially derived from config, and more flexibly rearranged. -// drag/drop watch rows -> tabs, tabs -> watch rows, etc. -// [x] frontend entities need to be the "upstream state" for windows, panels, -// tabs, etc. - entities can be mapped to caches of window/panel/view state -// in purely immediate-mode fashion, so the only *state* part of the -// equation only has to do with the string tree. -// [x] watch table UI - hidden table boundaries, special-cased control hacks -// [x] hash store -> need to somehow hold on to hash blobs which are still -// depended upon by usage layers, e.g. extra dependency refcount, e.g. -// text cache can explicitly correllate nodes in its cache to hashes, -// bump their refcount - this would keep the hash correllated to its key -// and it would prevent it from being evicted (output debug string perf) -// [x] OutputDebugString spam, keeping way too much around! -// [x] auto view rule templates (?) -// [x] auto-view-rules likely should apply at each level in the expression -// tree -// [x] `slice` view rule - extend to support begin/end style as well -// [x] investigate false exceptions, being reported while stepping through init code -// [x] collapse upstream state for theme/bindings/settings into entities; use cache accelerators if needed to make up difference -// [x] collapse upstream state for windows/panels/tabs into entities; use downstream window/view resource cache to make up the difference -// [x] entity <-> mdesk paths -// [x] save view column pcts; generalize to being a first-class thing in -// RD_View, e.g. by just having a string -> f32 store -// [x] transient view timeout releasing -// [x] view rule editors in hover-eval -// [x] table column boundaries should be checked against *AFTER* table -// contents, not before -// [x] In a "hover watch" (where you hover over a variable and it shows a pop- -// up watch window), if you expand an item near the bottom of the listing, -// it will be clipped to the bottom of the listing instead of showing the -// actual items (ie., it doesn't resize the listing based on what's -// actually visible) -// [x] Right-clicking on a thread in the Scheduler window pops up a context -// menu, but you can't actually see it because the tooltip for the thread -// draws on top of it, so you can't see the menu. -// [x] double-click vs. single-click for folder navigation, see if we can infer -// [x] 'view rules' need to be rephrased as "function" calls in the expression language -// [x] need a formalization which takes unknown identifiers which are called, and tries -// to use that to apply a IR-generation rule, which is keyed by that unknown -// identifier -// [x] we need to select expressions as "parents" when possible, so that when using an -// auto-view-rule (or similar context), leaf identifiers referring to e.g. members -// of an expression's type resolve correctly (e.g. bitmap(base, width, height) being -// used as a shorthand for bitmap(foo.base, foo.width, foo.height) when evaluating -// foo). -// [x] single-line visualization busted with auto-view-rules applied, it seems... -// not showing member variables, just commas, check w/ mohit -// [x] r8 bitmap view rule seems incorrect? -// [x] font cache layer -> can probably cache (string*font*size) -> (run) too -// (not just rasterization)... would save a *lot*, there is a ton of work -// just in looking up & stitching stuff repeatedly -// [x] convert UI layout pass to not be naive recursive version -// [x] @feature header file for target -> debugger communication; printf, log, -// etc. -// [x] `slider:(min max)` view rule -// [x] `matrix` view rule -// [x] `each:(expr addition)` - apply some additional expression to all -// elements in an array/linked list would be useful to look at only a -// subset of an array of complex structs -// [x] @bug view-snapping in scroll-lists, accounting for mapping between -// visual positions & logical positions (variably sized rows in watch, -// table headers, etc.) -// [x] @cleanup straighten out index/number space & types & terminology for -// scroll lists -// [x] sort locals by appearance in source code (or maybe just debug info) -// [x] per-panel font size overrides -// [x] theme lister -> fonts & font sizes -// [x] make `array` view rule work with actual array types, to change their -// size dynamically -// [x] automatically start search query with selected text -// [x] @feature processor/data breakpoints -// [x] Setting the code_font/main_font values to a font name doesn't work. -// Should probably make note that you have to set it to a path to a TTF, -// since that's not normally how Windows fonts work. -// [x] I had to go into the user file to change the font. That should probably -// be in the theme window? -// [x] autocompletion lister, file lister, function lister, command lister, -// etc., all need to be merged, and optionally contextualized/filtered. -// right-clicking a tab should be equivalent to spawning a command lister, -// but only with commands that are directly -// [x] tab opening -// [x] query listers -// [x] watch-window-defined query completion -// [x] rebindings -// [x] correct breakpoint/watch pin location visualization -// [x] config saving/loading -// [x] "pin hover eval" -// [x] member filtering -// [x] filtering is busted on ctrl_entities, cgs -// [x] right-click menus -> specialize query -// [x] writing ctrl entity names -// [x] saved view rules need to be applied when watch loads!!! -// [x] mechanism to promote tab -> non-auto -// [x] focusing a hover eval makes icons disappear! (seems to only work with -// table demo in mule_main) -// [x] need to distinguish between auto-genn'd expressions and editable expressions -// in watches. if I put in array[0] in the watch window, it just shows up as -// [0] (same for member names, foo.a shows as .a) -// [x] types in watch windows are missing! -// [x] MISSING ERRORS IN WATCH WINDOW -// [x] fix everything lister stopping at targets? -// [x] strange bug where typing on a non-editable expression cell (e.g. bp -// right-click menu) causes cmd icons to shift over -// [x] acceleration pass: -// [x] default setting schema lookup -// [x] evaluation, esp. setting evaluation (evaluation cache) -// [x] string -> run? -// [x] fix glitchiness when mutating cfgs - the cfgs evaluations are cached, and -// never are recomputed!!!! -// [x] fix editing source locations textually -// [x] see if I can make padding member names nicer -// [x] settings / exception filters -// [x] why does 'cut' not work??? -// [x] disallow chained fast paths when evaluating callee in call expr -// [x] missing function type decorations in lister etc. -// [x] dynamic type resolution -// [x] ensure "file picking", for file path map remap, works -// [x] paths in cfg -> relativization on save, de-relativization on load -// [x] "add hover eval to watch" (expr drag & drop -> watch window) -// [x] unattached process evaluation - need a string to evaluate so I can generate -// the evals -// [x] save-to-project (command line targets) -// [x] odin's demo is busted - need to revert PDB conversion type index changes. -//- readme improvements -// [x] I was a little confused about what a profile file was. I understood -// what the user file was, but the profile file sounded like it should -// perhaps be per-project, yet it sounded like it was meant to be somewhat -// global? I don't have any feedback here because it probably will make -// sense once I use the debugger more, but I just thought I'd make a note -// to say that I was confused about it after reading the manual, so -// perhaps you could elaborate a little more on it in there. -// [x] It wasn't clear to me how you save a user or project file. I can see -// how to load them, but not how you save them. Obviously I can just copy -// the files myself in the shell, but it seemed weird that there was no -// "save" option in the menus. -// [x] user switching -// [x] project switching -// [x] do not apply filters past one block layer -// [x] "pop out" (hitting enter on visualizers should open them as tabs) -// [x] crash bug, release mode - filter globals view (try with debugging raddbg, typing `dev` in globals view) -// [x] fix operator precedence in (u64)&foo - merge prefix-unary parsing with atom parsing loop -// [x] finish theme editing, build themes - replace code colors map with new theme stuff -// [x] autocompletion lister //////////////////////////////// //~ rjf: Build Options diff --git a/src/raddbg/raddbg_views.c b/src/raddbg/raddbg_views.c index 5afb5e9f..f6488046 100644 --- a/src/raddbg/raddbg_views.c +++ b/src/raddbg/raddbg_views.c @@ -941,13 +941,13 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row) //////////////////////////// //- rjf: unpack row's evaluation, key, & block info // - E_Type *row_type = e_type_from_key__cached(row->eval.irtree.type_key); + E_Type *row_type = e_type_from_key(row->eval.irtree.type_key); EV_Key key = row->key; EV_Block *block = row->block; E_Eval block_eval = e_eval_from_key(row->block->eval.key); E_TypeKey block_type_key = e_type_key_unwrap(block_eval.irtree.type_key, E_TypeUnwrapFlag_Meta); E_TypeKind block_type_kind = e_type_kind_from_key(block_type_key); - E_Type *block_type = e_type_from_key__cached(block_type_key); + E_Type *block_type = e_type_from_key(block_type_key); RD_Cfg *evalled_cfg = rd_cfg_from_eval_space(row->eval.space); CTRL_Entity *evalled_entity = (row->eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity ? rd_ctrl_entity_from_eval_space(row->eval.space) : &ctrl_entity_nil); @@ -1086,7 +1086,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row) } else if(maybe_table_type->kind == E_TypeKind_Lens) { - maybe_table_type = e_type_from_key__cached(maybe_table_type->direct_type_key); + maybe_table_type = e_type_from_key(maybe_table_type->direct_type_key); continue; } else @@ -1125,7 +1125,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row) // else if(row->eval.space.kind == E_SpaceKind_FileSystem) { - E_Type *type = e_type_from_key__cached(row->eval.irtree.type_key); + E_Type *type = e_type_from_key(row->eval.irtree.type_key); if(type->kind == E_TypeKind_Set) { String8 file_path = e_string_from_id(row->eval.value.u64); @@ -1325,7 +1325,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row) // else if(row->eval.space.kind == RD_EvalSpaceKind_MetaCmd) { - E_Type *type = e_type_from_key__cached(row->eval.irtree.type_key); + E_Type *type = e_type_from_key(row->eval.irtree.type_key); if(type->kind == E_TypeKind_Set) { rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Eval, row->eval, @@ -1539,8 +1539,8 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla ////////////////////////////// //- rjf: unpack evaluation // - E_Type *block_type = e_type_from_key__cached(row->block->eval.irtree.type_key); - E_Type *cell_type = e_type_from_key__cached(cell->eval.irtree.type_key); + E_Type *block_type = e_type_from_key(row->block->eval.irtree.type_key); + E_Type *cell_type = e_type_from_key(cell->eval.irtree.type_key); MD_NodePtrList cell_schemas = rd_schemas_from_name(cell_type->name); if(cell->eval.space.u64s[1] == 0 && cell_schemas.count != 0) { @@ -1554,7 +1554,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla result.file_path = rd_file_path_from_eval(arena, cell->eval); for(E_Type *type = cell_type; type->kind == E_TypeKind_Lens; - type = e_type_from_key__cached(type->direct_type_key)) + type = e_type_from_key(type->direct_type_key)) { RD_ViewUIRule *view_ui_rule = rd_view_ui_rule_from_string(type->name); if(view_ui_rule != &rd_nil_view_ui_rule) @@ -1569,7 +1569,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla // for(E_Type *type = cell_type; type->kind != E_TypeKind_Null; - type = e_type_from_key__cached(type->direct_type_key)) + type = e_type_from_key(type->direct_type_key)) { if(type->kind == E_TypeKind_MetaDescription) { @@ -1696,9 +1696,9 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla // rjf: if this cell has a meta-display-name, then use that if(expr_string.size == 0) { - for(E_Type *t = e_type_from_key__cached(cell->eval.irtree.type_key); + for(E_Type *t = e_type_from_key(cell->eval.irtree.type_key); t != &e_type_nil; - t = e_type_from_key__cached(t->direct_type_key)) + t = e_type_from_key(t->direct_type_key)) { if(t->kind == E_TypeKind_MetaDisplayName) { @@ -1837,7 +1837,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla // rjf: determine if code B32 is_code = 1; { - E_Type *type = e_type_from_key__cached(e_type_key_unwrap(cell->eval.irtree.type_key, E_TypeUnwrapFlag_Meta)); + E_Type *type = e_type_from_key(e_type_key_unwrap(cell->eval.irtree.type_key, E_TypeUnwrapFlag_Meta)); if(type->flags & (E_TypeFlag_IsPlainText|E_TypeFlag_IsPathText)) { is_code = 0; @@ -3744,7 +3744,7 @@ rd_eval_color_from_eval(E_Eval eval) LeafTask *last_task = first_task; for(LeafTask *t = first_task; t != 0 && num_components_left > 0; t = t->next) { - E_Type *type = e_type_from_key__cached(e_type_key_unwrap(t->eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative)); + E_Type *type = e_type_from_key(e_type_key_unwrap(t->eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative)); switch(type->kind) { default:{}break; @@ -3779,8 +3779,8 @@ rd_eval_color_from_eval(E_Eval eval) // (the lens implicitly tells us the format) RD_EvalColor result = {0}; { - E_Type *lens_type = e_type_from_key__cached(eval.irtree.type_key); - for(E_Type *t = lens_type; t->kind == E_TypeKind_Lens; t = e_type_from_key__cached(t->direct_type_key)) + E_Type *lens_type = e_type_from_key(eval.irtree.type_key); + for(E_Type *t = lens_type; t->kind == E_TypeKind_Lens; t = e_type_from_key(t->direct_type_key)) { if(str8_match(t->name, str8_lit("color"), 0)) { @@ -3940,7 +3940,7 @@ RD_VIEW_UI_FUNCTION_DEF(color) if(ui_dragging(h_sig) || ui_dragging(sv_sig) || ui_dragging(a_sig)) { // TODO(rjf): hard-coding U32 committing for now - E_Type *type = e_type_from_key__cached(e_type_key_unwrap(eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative)); + E_Type *type = e_type_from_key(e_type_key_unwrap(eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative)); if(type->kind == E_TypeKind_U32 || type->kind == E_TypeKind_S32 || type->kind == E_TypeKind_U64 ||