From 00fd5976589fa22aa18d335fcfed282fcc623c88 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Tue, 3 Jun 2025 13:55:37 -0700 Subject: [PATCH] fix ptr/ref coverage in expansions --- src/eval/eval_ir.c | 4 ++-- src/eval/eval_types.c | 6 +++++- src/raddbg/generated/raddbg.meta.c | 4 ++-- src/raddbg/raddbg.mdesk | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/eval/eval_ir.c b/src/eval/eval_ir.c index be21074b..1dd8a8ee 100644 --- a/src/eval/eval_ir.c +++ b/src/eval/eval_ir.c @@ -511,7 +511,7 @@ E_TYPE_ACCESS_FUNCTION_DEF(default) { break; } - else if(l_restype_kind != E_TypeKind_Ptr && l_restype_kind != E_TypeKind_Array) + else if(l_restype_kind != E_TypeKind_Ptr && l_restype_kind != E_TypeKind_Array && l_restype_kind != E_TypeKind_LRef && l_restype_kind != E_TypeKind_RRef) { e_msgf(arena, &result.msgs, E_MsgKind_MalformedInput, exprl->range, "Cannot index into this type."); break; @@ -567,7 +567,7 @@ E_TYPE_ACCESS_FUNCTION_DEF(default) // rjf: ops to compute the base offset (resolve to value if addr-of-pointer) E_IRNode *base_tree = l.root; - if(l_restype_kind == E_TypeKind_Ptr && l.mode != E_Mode_Value) + if(e_type_kind_is_pointer_or_ref(l_restype_kind) && l.mode != E_Mode_Value) { base_tree = e_irtree_resolve_to_value(arena, l.mode, base_tree, l_restype); } diff --git a/src/eval/eval_types.c b/src/eval/eval_types.c index 3f7debc9..b1f22135 100644 --- a/src/eval/eval_types.c +++ b/src/eval/eval_types.c @@ -2308,7 +2308,9 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(default) { E_TypeKind array_type_kind = e_type_kind_from_key(expand_type_key); if(array_type_kind == E_TypeKind_Array || - array_type_kind == E_TypeKind_Ptr) + array_type_kind == E_TypeKind_Ptr || + array_type_kind == E_TypeKind_RRef || + array_type_kind == E_TypeKind_LRef) { E_Type *array_type = e_type_from_key(expand_type_key); result.expr_count = array_type->count; @@ -2384,6 +2386,8 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(default) //- rjf: ptr case -> the lookup-range will return a range of dereferences else if(expand_type_kind == E_TypeKind_Ptr || + expand_type_kind == E_TypeKind_LRef || + expand_type_kind == E_TypeKind_RRef || expand_type_kind == E_TypeKind_Array || expand_type_kind == E_TypeKind_Set) { diff --git a/src/raddbg/generated/raddbg.meta.c b/src/raddbg/generated/raddbg.meta.c index de5afcd8..dcf650a9 100644 --- a/src/raddbg/generated/raddbg.meta.c +++ b/src/raddbg/generated/raddbg.meta.c @@ -417,8 +417,8 @@ RD_NameSchemaInfo rd_name_schema_info_table[24] = {str8_lit_comp("watch"), str8_lit_comp("@inherit(tab) x:\n{\n @override @display_name('Tab Row Height') @description(\"Controls the tab's row height, in multiples of the font size.\")\n 'row_height': @range[1.75f, 5.f] f32,\n 'label': code_string,\n @description(\"The root expression which is evaluated to produce the watch window.\")\n 'expression': expr_string,\n @no_expand 'watches': query,\n}\n")}, {str8_lit_comp("text"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe data which should be viewed as text or code.\")\n 'expression': expr_string,\n @description(\"The language that the text should be interpreted as being within. Used for syntax highlighting and other parsing features.\")\n 'lang': code_string,\n @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers':bool,\n @no_callee_helper @default(0) @display_name('Scroll To Bottom On Change') @description(\"Scrolls to the bottom if the text is changed.\")\n 'scroll_to_bottom_on_change':bool,\n @no_callee_helper @no_revert @default(0) @display_name('Transient') @description(\"Controls whether or not this tab will be automatically replaced by the debugger when it snaps to new source code locations.\")\n 'auto': bool,\n}\n")}, {str8_lit_comp("disasm"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe the base address or offset of the disassembly.\")\n 'expression': expr_string,\n 'arch': code_string,\n 'syntax': code_string,\n 'size': expr_string,\n @no_callee_helper @default(1) @description(\"Controls whether or not addresses are shown in the disassembly text.\")\n 'show_addresses': bool,\n @no_callee_helper @default(0) @description(\"Controls whether or not code bytes are shown in the disassembly text.\")\n 'show_code_bytes': bool,\n @no_callee_helper @default(1) @description(\"Controls whether or not source lines, corresponding to disassembly instruction ranges, are shown in the disassembly text.\")\n 'show_source_lines': bool,\n @no_callee_helper @default(1) @description(\"Controls whether or not disassembly text is decorated with symbol names.\")\n 'show_symbol_names': bool,\n @no_callee_helper @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers': bool,\n}\n")}, -{str8_lit_comp("memory"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression which refers to the data which should be viewed as memory.\")\n 'expression': expr_string,\n @display_name(\"Address Range Size\") @description(\"The number of bytes of the viewed memory range.\")\n 'size': expr_string,\n @display_name(\"Cursor Address\") @description(\"The address of the cursor.\")\n 'cursor': expr_string,\n @display_name(\"Cursor Size\") @description(\"The size, in bytes, of the cursor.\")\n 'cursor_size': @range[1, 16] u64,\n @default(16) @description(\"The number of columns to build before building new rows.\")\n 'num_columns': @range[1, 64] u64,\n}\n")}, -{str8_lit_comp("bitmap"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression which refers to the data which should be viewed as a bitmap.\")\n 'expression': expr_string,\n @description(\"An expression describing the width of the bitmap, in pixels.\") @order(0) 'w': u64,\n @description(\"An expression describing the height of the bitmap, in pixels.\") @order(1) 'h': u64,\n @display_name(\"Bitmap Format\") @description(\"The pixel format that the bitmap data should be interpreted as being within.\")\n 'fmt': code_string,\n}\n")}, +{str8_lit_comp("memory"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression which refers to the base address of data which should be viewed as memory.\")\n 'expression': expr_string,\n @display_name(\"Address Range Size\") @description(\"The number of bytes of the viewed memory range.\")\n 'size': expr_string,\n @display_name(\"Cursor Address\") @description(\"The address of the cursor.\")\n 'cursor': expr_string,\n @display_name(\"Cursor Size\") @description(\"The size, in bytes, of the cursor.\")\n 'cursor_size': @range[1, 16] u64,\n @default(16) @description(\"The number of columns to build before building new rows.\")\n 'num_columns': @range[1, 64] u64,\n}\n")}, +{str8_lit_comp("bitmap"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression which refers to the base address of data which should be viewed as a bitmap.\")\n 'expression': expr_string,\n @description(\"An expression describing the width of the bitmap, in pixels.\") @order(0) 'w': u64,\n @description(\"An expression describing the height of the bitmap, in pixels.\") @order(1) 'h': u64,\n @display_name(\"Bitmap Format\") @description(\"The pixel format that the bitmap data should be interpreted as being within.\")\n 'fmt': code_string,\n}\n")}, {str8_lit_comp("color"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Value\") @description(\"An expression to describe the value or location of the color.\")\n 'expression': expr_string,\n}\n")}, {str8_lit_comp("geo3d"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Expression\") @description(\"An expression to describe the base address of the index buffer.\")\n 'expression': expr_string,\n 'count': expr_string,\n 'vtx': expr_string,\n 'vtx_size': expr_string,\n 'yaw': @range[0, 1] f32,\n 'pitch': @range[-0.5, 0] f32,\n 'zoom': @range[0, 100] f32,\n}\n")}, {str8_lit_comp("getting_started"), str8_lit_comp("@inherit(tab) x:\n{\n}\n")}, diff --git a/src/raddbg/raddbg.mdesk b/src/raddbg/raddbg.mdesk index ac64c5f2..40e17dac 100644 --- a/src/raddbg/raddbg.mdesk +++ b/src/raddbg/raddbg.mdesk @@ -507,7 +507,7 @@ RD_VocabTable: ``` @inherit(tab) x: { - @description("An expression which refers to the data which should be viewed as memory.") + @description("An expression which refers to the base address of data which should be viewed as memory.") 'expression': expr_string, @display_name("Address Range Size") @description("The number of bytes of the viewed memory range.") 'size': expr_string, @@ -525,7 +525,7 @@ RD_VocabTable: ``` @inherit(tab) x: { - @description("An expression which refers to the data which should be viewed as a bitmap.") + @description("An expression which refers to the base address of data which should be viewed as a bitmap.") 'expression': expr_string, @description("An expression describing the width of the bitmap, in pixels.") @order(0) 'w': u64, @description("An expression describing the height of the bitmap, in pixels.") @order(1) 'h': u64,