diff --git a/src/eval/eval_core.c b/src/eval/eval_core.c index 3212437d..de8979e7 100644 --- a/src/eval/eval_core.c +++ b/src/eval/eval_core.c @@ -1219,6 +1219,24 @@ e_base_offset_from_eval(E_Eval eval) return eval.value.u64; } +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(e_type_kind_is_pointer_or_ref(type_unwrapped_kind) || + type_unwrapped_kind == E_TypeKind_Function) + { + result = KB(16); + } + else + { + result = e_type_byte_size_from_key(type_unwrapped); + } + return result; +} + //////////////////////////////// //~ rjf: Debug Functions diff --git a/src/eval/eval_core.h b/src/eval/eval_core.h index d9249a87..5138e754 100644 --- a/src/eval/eval_core.h +++ b/src/eval/eval_core.h @@ -1179,6 +1179,7 @@ internal E_Key e_key_wrapf(E_Key key, char *fmt, ...); //~ rjf: Eval Info Extraction internal U64 e_base_offset_from_eval(E_Eval eval); +internal U64 e_range_size_from_eval(E_Eval eval); //////////////////////////////// //~ rjf: Debug Functions diff --git a/src/raddbg/generated/raddbg.meta.c b/src/raddbg/generated/raddbg.meta.c index 3d6fe3db..8fb1115f 100644 --- a/src/raddbg/generated/raddbg.meta.c +++ b/src/raddbg/generated/raddbg.meta.c @@ -60,7 +60,7 @@ str8_lit_comp(""), str8_lit_comp(""), }; -RD_VocabInfo rd_vocab_info_table[334] = +RD_VocabInfo rd_vocab_info_table[335] = { {str8_lit_comp("type_view"), str8_lit_comp("type_views"), str8_lit_comp("Type View"), str8_lit_comp("Type Views"), RD_IconKind_Binoculars}, {str8_lit_comp("file_path_map"), str8_lit_comp("file_path_maps"), str8_lit_comp("File Path Map"), str8_lit_comp("File Path Maps"), RD_IconKind_FileOutline}, @@ -354,6 +354,7 @@ RD_VocabInfo rd_vocab_info_table[334] = {str8_lit_comp("add_theme_color"), str8_lit_comp(""), str8_lit_comp("Add Theme Color"), str8_lit_comp(""), RD_IconKind_Palette}, {str8_lit_comp("fork_theme"), str8_lit_comp(""), str8_lit_comp("Fork Theme"), str8_lit_comp(""), RD_IconKind_Palette}, {str8_lit_comp("save_theme"), str8_lit_comp(""), str8_lit_comp("Save Theme"), str8_lit_comp(""), RD_IconKind_Save}, +{str8_lit_comp("save_and_set_theme"), str8_lit_comp(""), str8_lit_comp("Save And Set Theme"), str8_lit_comp(""), RD_IconKind_Save}, {str8_lit_comp("set_next_statement"), str8_lit_comp(""), str8_lit_comp("Set Next Statement"), str8_lit_comp(""), RD_IconKind_RightArrow}, {str8_lit_comp("add_target"), str8_lit_comp(""), str8_lit_comp("Add Target"), str8_lit_comp(""), RD_IconKind_Target}, {str8_lit_comp("select_target"), str8_lit_comp(""), str8_lit_comp("Select Target"), str8_lit_comp(""), RD_IconKind_Target}, @@ -402,7 +403,7 @@ RD_NameSchemaInfo rd_name_schema_info_table[24] = { {str8_lit_comp("user"), str8_lit_comp("@expand_commands(edit_user_theme) x:\n{\n //- rjf: animations\n @default(1) 'hover_animations': bool,\n @default(1) 'press_animations': bool,\n @default(0) 'focus_animations': bool,\n @default(1) 'tooltip_animations': bool,\n @default(1) 'menu_animations': bool,\n @default(1) 'scrolling_animations': bool,\n\n //- rjf: fonts\n @display_name('UI Font') @description(\"The name of, or path to, the font used when displaying non-code UI elements.\")\n 'main_font': string,\n @display_name('Code Font') @description(\"The name of, or path to, the font used when displaying code.\")\n 'code_font': string,\n\n //- rjf: theme\n @default(\"Default (Dark)\") @display_name('User Theme')\n @description(\"The user's theme, which describes all colors used throughout the UI.\")\n 'theme': string,\n @no_expand @display_name('User Theme')\n 'theme_colors': query,\n\n //- rjf: autocompletion\n @display_name('Autocompletion Lister') @description(\"Enables the autocompletion lister while typing expressions.\") @default(1)\n 'autocompletion_lister': bool,\n\n //- rjf: thread & breakpoint decorations\n @default(1) @display_name('Thread Lines') @description(\"Controls whether or not a long horizontal line is drawn before the next line or instruction that the selected thread will execute in source and disassembly views.\")\n 'thread_lines': bool,\n @default(1) @display_name('Thread Glow') @description(\"Controls whether or not a glowing effect is drawn on the selected thread in source and disassembly views.\")\n 'thread_glow': bool,\n @default(1) @display_name('Breakpoint Lines') @description(\"Controls whether or not a long horizontal line is drawn before the line or instruction at which a breakpoint is placed, in source and disassembly views.\")\n 'breakpoint_lines': bool,\n @default(1) @display_name('Breakpoint Glow') @description(\"Controls whether or not a glowing effect is drawn on breakpoints in source and disassembly views.\")\n 'breakpoint_glow': bool,\n\n //- rjf: occluding background settings\n @default(0) @display_name('Opaque Backgrounds') @description(\"Controls whether or not all floating background colors are forced to be fully opaque.\")\n 'opaque_backgrounds': bool,\n @default(1) @display_name('Background Blur') @description(\"Controls whether or not occluded regions behind floating elements are blurred.\")\n 'background_blur': bool,\n\n //- rjf: appearance settings\n @default(1) @display_name('Drop Shadows') @description(\"Controls whether or not drop shadows are drawn.\")\n 'drop_shadows': bool,\n @default(1.f) @display_name('Rounded Corner Amount') @description(\"Controls the degree to which UI corners are rounded.\")\n 'rounded_corner_amount': @range[0, 1] f32,\n\n //- rjf: code formatting settings\n @default(2) @display_name('User Tab Width') 'tab_width': @range[1, 32] u64,\n\n //- rjf: windows style menu bar\n @default(1) @display_name('Focus Menu Bar With Alt') @description(\"Mimics standard Windows behavior of focusing the menu bar using the Alt key.\")\n 'focus_menu_bar_with_alt': bool,\n}\n")}, {str8_lit_comp("project"), str8_lit_comp("@expand_commands(edit_project_theme) x:\n{\n @default(2) @display_name('Project Tab Width') 'tab_width': @range[1, 32] u64,\n\n //- rjf: visualizers\n @display_name('Use Default C++ STL Type Visualizers') @description(\"Enables the built-in type views for C++ STL types.\")\n @default(1) use_default_stl_type_views: bool,\n @display_name('Use Default Unreal Engine Type Visualizers') @description(\"Enables the built-in type views for Unreal Engine types.\")\n @default(1) use_default_ue_type_views: bool,\n\n //- rjf: theme\n @default(\"None\") @display_name('Project Theme') @description(\"The project's theme, which describes all colors used throughout the UI, and can override the user's theme.\")\n 'theme': string,\n @no_expand @display_name('Project Theme') @description(\"The project's theme, which describes all colors used throughout the UI, and can override the user's theme.\")\n 'theme_colors': query,\n\n //- rjf: exception settings\n @default(1) @display_name(\"Break On Win32 Control-C Exceptions\") @description(\"Code: 0x40010005\")\n win32_ctrl_c: bool;\n @default(1) @display_name(\"Break On Win32 Control-Break Exceptions\") @description(\"Code: 0x40010008\")\n win32_ctrl_break: bool;\n @default(0) @display_name(\"Break On Win32 WinRT Originate Error Exceptions\") @description(\"Code: 0x40080201\")\n win32_win_rt_originate_error: bool;\n @default(0) @display_name(\"Break On Win32 WinRT Transform Error Exceptions\") @description(\"Code: 0x40080202\")\n win32_win_rt_transform_error: bool;\n @default(0) @display_name(\"Break On Win32 RPC Call Cancelled Exceptions\") @description(\"Code: 0x0000071a\")\n win32_rpc_call_cancelled: bool;\n @default(0) @display_name(\"Break On Win32 Data Type Misalignment Exceptions\") @description(\"Code: 0x80000002\")\n win32_datatype_misalignment: bool;\n @default(1) @display_name(\"Break On Win32 Access Violation Exceptions\") @description(\"Code: 0xc0000005\")\n win32_access_violation: bool;\n @default(0) @display_name(\"Break On Win32 In Page Error Exceptions\") @description(\"Code: 0xc0000006\")\n win32_in_page_error: bool;\n @default(1) @display_name(\"Break On Win32 Invalid Handle Specified Exceptions\") @description(\"Code: 0xc0000008\")\n win32_invalid_handle: bool;\n @default(0) @display_name(\"Break On Win32 Not Enough Quota Exceptions\") @description(\"Code: 0xc0000017\")\n win32_not_enough_quota: bool;\n @default(0) @display_name(\"Break On Win32 Illegal Instruction Exceptions\") @description(\"Code: 0xc000001d\")\n win32_illegal_instruction: bool;\n @default(0) @display_name(\"Break On Win32 Cannot Continue From Exception Exceptions\") @description(\"Code: 0xc0000025\")\n win32_cannot_continue_exception: bool;\n @default(0) @display_name(\"Break On Win32 Invalid Exception Disposition Returned By Handler Exceptions\") @description(\"Code: 0xc0000026\")\n win32_invalid_exception_disposition: bool;\n @default(0) @display_name(\"Break On Win32 Array Bounds Exceeded Exceptions\") @description(\"Code: 0xc000008c\")\n win32_array_bounds_exceeded: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Denormal Operand Exceptions\") @description(\"Code: 0xc000008d\")\n win32_floating_point_denormal_operand: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Division By Zero Exceptions\") @description(\"Code: 0xc000008e\")\n win32_floating_point_division_by_zero: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Inexact Result Exceptions\") @description(\"Code: 0xc000008f\")\n win32_floating_point_inexact_result: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Invalid Operation Exceptions\") @description(\"Code: 0xc0000090\")\n win32_floating_point_invalid_operation: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Overflow Exceptions\") @description(\"Code: 0xc0000091\")\n win32_floating_point_overflow: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Stack Check Exceptions\") @description(\"Code: 0xc0000092\")\n win32_floating_point_stack_check: bool;\n @default(0) @display_name(\"Break On Win32 Floating-Point Underflow Exceptions\") @description(\"Code: 0xc0000093\")\n win32_floating_point_underflow: bool;\n @default(0) @display_name(\"Break On Win32 Integer Division By Zero Exceptions\") @description(\"Code: 0xc0000094\")\n win32_integer_division_by_zero: bool;\n @default(0) @display_name(\"Break On Win32 Integer Overflow Exceptions\") @description(\"Code: 0xc0000095\")\n win32_integer_overflow: bool;\n @default(0) @display_name(\"Break On Win32 Privileged Instruction Exceptions\") @description(\"Code: 0xc0000096\")\n win32_privileged_instruction: bool;\n @default(0) @display_name(\"Break On Win32 Stack Overflow Exceptions\") @description(\"Code: 0xc00000fd\")\n win32_stack_overflow: bool;\n @default(0) @display_name(\"Break On Win32 Unable To Locate DLL Exceptions\") @description(\"Code: 0xc0000135\")\n win32_unable_to_locate_dll: bool;\n @default(0) @display_name(\"Break On Win32 Ordinal Not Found Exceptions\") @description(\"Code: 0xc0000138\")\n win32_ordinal_not_found: bool;\n @default(0) @display_name(\"Break On Win32 Entry Point Not Found Exceptions\") @description(\"Code: 0xc0000139\")\n win32_entry_point_not_found: bool;\n @default(0) @display_name(\"Break On Win32 DLL Initialization Failed Exceptions\") @description(\"Code: 0xc0000142\")\n win32_dll_initialization_failed: bool;\n @default(0) @display_name(\"Break On Win32 Floating Point SSE Multiple Faults Exceptions\") @description(\"Code: 0xc00002b4\")\n win32_floating_point_sse_multiple_faults: bool;\n @default(0) @display_name(\"Break On Win32 Floating Point SSE Multiple Traps Exceptions\") @description(\"Code: 0xc00002b5\")\n win32_floating_point_sse_multiple_traps: bool;\n @default(1) @display_name(\"Break On Win32 Assertion Failed Exceptions\") @description(\"Code: 0xc0000420\")\n win32_assertion_failed: bool;\n @default(0) @display_name(\"Break On Win32 Module Not Found Exceptions\") @description(\"Code: 0xc06d007e\")\n win32_module_not_found: bool;\n @default(0) @display_name(\"Break On Win32 Procedure Not Found Exceptions\") @description(\"Code: 0xc06d007f\")\n win32_procedure_not_found: bool;\n @default(1) @display_name(\"Break On Win32 Sanitizer Error Detected Exceptions\") @description(\"Code: 0xe073616e\")\n win32_sanitizer_error_detected: bool;\n @default(0) @display_name(\"Break On Win32 Sanitizer Raw Access Violation Exceptions\") @description(\"Code: 0xe0736171\")\n win32_sanitizer_raw_access_violation: bool;\n @default(1) @display_name(\"Break On Win32 DirectX Debug Layer Exceptions\") @description(\"Code: 0x0000087a\")\n win32_directx_debug_layer: bool;\n}\n")}, -{str8_lit_comp("theme_color"), str8_lit_comp("@collection_commands(add_theme_color, fork_theme, save_theme)\n@row_commands(duplicate_cfg, remove_cfg)\nx:\n{\n @display_name('Tags') tags: string,\n @display_name('Value') value: @color @hex u32,\n}\n")}, +{str8_lit_comp("theme_color"), str8_lit_comp("@collection_commands(add_theme_color, fork_theme, save_theme, save_and_set_theme)\n@row_commands(duplicate_cfg, remove_cfg)\nx:\n{\n @display_name('Tags') tags: string,\n @display_name('Value') value: @color @hex u32,\n}\n")}, {str8_lit_comp("window"), str8_lit_comp("x:\n{\n //- rjf: text rasterization settings\n @default(1) @display_name('Smooth UI Text') @description(\"Controls whether or not UI text is fully anti-aliased, for a smoother appearance.\")\n 'smooth_ui_text': bool,\n @default(1) @display_name('Hint UI Text') @description(\"Controls whether or not UI text is hinted, for better text readability at small sizes.\")\n 'hint_ui_text': bool,\n @default(0) @display_name('Smooth Code Text') @description(\"Controls whether or not code text is fully anti-aliased, for a smoother appearance.\")\n 'smooth_code_text': bool,\n @default(1) @display_name('Hint Code Text') @description(\"Controls whether or not code text is hinted, for better text readability at small sizes.\")\n 'hint_code_text': bool,\n @default(11) @display_name('Window Font Size') @description(\"Controls the window's default font size. Does not apply to tabs with their own font size set.\")\n 'font_size': @range[6, 72] u64,\n\n //- rjf: size settings\n @default(3.f) @display_name('Window Row Height') @description(\"Controls the window's default row height, in multiples of the font size. Does not apply to tabs with their own row height set.\")\n 'row_height': @range[1.75f, 5.f] f32,\n @default(3.f) @description(\"Controls the height of tabs, in multiples of the font size.\")\n 'tab_height': @range[1.75f, 5.f] f32,\n\n //- rjf: theme settings\n @default(1) @display_name('Use Project Theme') @description(\"Prefer using the project theme for this window, if any. If off, only the user's theme settings will be used.\")\n 'use_project_theme': bool,\n}\n")}, {str8_lit_comp("tab"), str8_lit_comp("@row_commands(@file copy_tab_full_path, @file show_file_in_explorer, duplicate_tab, close_tab)\nx:\n{\n @default(11) @display_name('Tab Font Size') @description(\"Controls the tab's font size.\")\n 'font_size': @range[6, 72] u64,\n}\n")}, {str8_lit_comp("watch"), str8_lit_comp("@inherit(tab) x:\n{\n @default(3.f) @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': code_string,\n @no_expand 'watches': query,\n}\n")}, @@ -473,7 +474,7 @@ Rng1U64 rd_reg_slot_range_table[43] = {OffsetOf(RD_Regs, os_event), OffsetOf(RD_Regs, os_event) + sizeof(OS_Event *)}, }; -RD_CmdKindInfo rd_cmd_kind_info_table[227] = +RD_CmdKindInfo rd_cmd_kind_info_table[228] = { {0}, { str8_lit_comp("launch_and_run"), str8_lit_comp("Starts debugging a new instance of a target, then runs."), str8_lit_comp("launch,start,run,target"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Cfg, str8_lit_comp("query:targets"), str8_lit_comp(""), CTRL_EntityKind_Null}}, @@ -660,6 +661,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[227] = { str8_lit_comp("add_theme_color"), str8_lit_comp("Adds a new theme color."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}}, { str8_lit_comp("fork_theme"), str8_lit_comp("Imports all colors from the current theme so they can be individually edited."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}}, { str8_lit_comp("save_theme"), str8_lit_comp("Saves all theme colors to a new theme file."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*1)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_String, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}}, +{ str8_lit_comp("save_and_set_theme"), str8_lit_comp("Saves all theme colors to a new theme file, and then sets that theme as the selected theme."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*1)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_String, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}}, { str8_lit_comp("set_next_statement"), str8_lit_comp("Sets the selected thread's instruction pointer to the cursor's position."), str8_lit_comp(""), str8_lit_comp("$text_pt,"), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*1)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), str8_lit_comp(""), CTRL_EntityKind_Null}}, { str8_lit_comp("add_target"), str8_lit_comp("Adds a new target."), str8_lit_comp("application,executable,debug"), str8_lit_comp("$targets,"), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*1)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_FilePath, str8_lit_comp("folder:\"$input\""), str8_lit_comp(""), CTRL_EntityKind_Null}}, { str8_lit_comp("select_target"), str8_lit_comp("Selects a target."), str8_lit_comp(""), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Cfg, str8_lit_comp("query:targets"), str8_lit_comp(""), CTRL_EntityKind_Null}}, diff --git a/src/raddbg/generated/raddbg.meta.h b/src/raddbg/generated/raddbg.meta.h index e59c41cd..46514db7 100644 --- a/src/raddbg/generated/raddbg.meta.h +++ b/src/raddbg/generated/raddbg.meta.h @@ -241,6 +241,7 @@ RD_CmdKind_EditProjectTheme, RD_CmdKind_AddThemeColor, RD_CmdKind_ForkTheme, RD_CmdKind_SaveTheme, +RD_CmdKind_SaveAndSetTheme, RD_CmdKind_SetNextStatement, RD_CmdKind_AddTarget, RD_CmdKind_SelectTarget, @@ -560,7 +561,7 @@ Z(getting_started)\ C_LINKAGE_BEGIN extern String8 rd_tab_fast_path_view_name_table[24]; extern String8 rd_tab_fast_path_query_name_table[24]; -extern RD_VocabInfo rd_vocab_info_table[334]; +extern RD_VocabInfo rd_vocab_info_table[335]; extern RD_NameSchemaInfo rd_name_schema_info_table[24]; extern Rng1U64 rd_reg_slot_range_table[43]; extern String8 rd_binding_version_remap_old_name_table[8]; diff --git a/src/raddbg/raddbg.mdesk b/src/raddbg/raddbg.mdesk index 8c1f523f..25a49063 100644 --- a/src/raddbg/raddbg.mdesk +++ b/src/raddbg/raddbg.mdesk @@ -384,7 +384,7 @@ RD_VocabTable: { theme_color, ``` - @collection_commands(add_theme_color, fork_theme, save_theme) + @collection_commands(add_theme_color, fork_theme, save_theme, save_and_set_theme) @row_commands(duplicate_cfg, remove_cfg) x: { @@ -990,6 +990,7 @@ RD_CmdTable: // | | | | {AddThemeColor 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Palette "add_theme_color" "Add Theme Color" "Adds a new theme color." "" "" } {ForkTheme 0 0 0 0 "" Null null Nil Null 0 0 0 0 0 0 0 Palette "fork_theme" "Fork Theme" "Imports all colors from the current theme so they can be individually edited." "" "" } {SaveTheme 0 0 0 0 "" String null Nil Null 1 0 0 0 0 1 1 Save "save_theme" "Save Theme" "Saves all theme colors to a new theme file." "" "" } + {SaveAndSetTheme 0 0 0 0 "" String null Nil Null 1 0 0 0 0 1 1 Save "save_and_set_theme" "Save And Set Theme" "Saves all theme colors to a new theme file, and then sets that theme as the selected theme." "" "" } //- rjf: line operations {SetNextStatement 1 1 1 0 "" Null null Nil Null 0 0 0 0 0 0 0 RightArrow "set_next_statement" "Set Next Statement" "Sets the selected thread's instruction pointer to the cursor's position." "" "$text_pt," } diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index 8508ad0a..c9e58895 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -5188,10 +5188,10 @@ rd_view_ui(Rng2F32 rect) rd_cmd(RD_CmdKind_SelectThread, .thread = cell_info.entity->handle); } - // rjf: other cases, but this watch window is floating? -> push query - else if(view_is_floating) + // rjf: other cases, but this watch window is floating, and this has a cfg/entity? -> push query + else if(view_is_floating && (cell_info.entity != &ctrl_entity_nil || cell_info.cfg != &rd_nil_cfg)) { - rd_cmd(RD_CmdKind_PushQuery, .expr = cell->eval.string); + rd_cmd(RD_CmdKind_PushQuery, .expr = e_full_expr_string_from_key(scratch.arena, cell->eval.key)); } } @@ -5815,33 +5815,10 @@ rd_window_frame(void) } //- rjf: map the theme config to the associated tree (either from a preset, or from a file) - MD_Node *theme_tree = rd_state->theme_preset_trees[RD_ThemePreset_DefaultDark]; - if(theme_cfg != &rd_nil_cfg) + MD_Node *theme_tree = rd_theme_tree_from_name(scratch.arena, hs_scope, theme_cfg->first->string); + if(colors_cfgs.count == 0 && theme_tree == &md_nil_node) { - String8 theme_name = theme_cfg->first->string; - if(theme_name.size != 0) - { - for EachEnumVal(RD_ThemePreset, p) - { - if(str8_match(theme_name, rd_theme_preset_display_string_table[p], 0)) - { - theme_tree = rd_state->theme_preset_trees[p]; - break; - } - } - if(theme_tree == &md_nil_node) - { - String8 path = push_str8f(scratch.arena, "%S/raddbg/themes/%S", os_get_process_info()->user_program_data_path, theme_name); - U64 endt_us = os_now_microseconds()+100; - if(ws->frames_alive == 0) - { - endt_us = os_now_microseconds()+50000; - } - U128 hash = fs_hash_from_path_range(path, r1u64(0, max_U64), endt_us); - String8 data = hs_data_from_hash(hs_scope, hash); - theme_tree = md_tree_from_string(scratch.arena, data); - } - } + theme_tree = rd_state->theme_preset_trees[RD_ThemePreset_DefaultDark]; } //- rjf: build tasks for color applications - each task comprises of a metadesk @@ -9769,6 +9746,38 @@ rd_set_autocomp_regs_(RD_Regs *regs) //- rjf: colors +internal MD_Node * +rd_theme_tree_from_name(Arena *arena, HS_Scope *scope, String8 theme_name) +{ + Temp scratch = scratch_begin(&arena, 1); + MD_Node *theme_tree = &md_nil_node; + if(theme_name.size != 0) + { + for EachEnumVal(RD_ThemePreset, p) + { + if(str8_match(theme_name, rd_theme_preset_display_string_table[p], 0)) + { + theme_tree = rd_state->theme_preset_trees[p]; + break; + } + } + if(theme_tree == &md_nil_node) + { + String8 path = push_str8f(scratch.arena, "%S/raddbg/themes/%S", os_get_process_info()->user_program_data_path, theme_name); + U64 endt_us = os_now_microseconds()+100; + if(rd_state->frame_index <= 5) + { + endt_us = os_now_microseconds()+50000; + } + U128 hash = fs_hash_from_path_range(path, r1u64(0, max_U64), endt_us); + String8 data = hs_data_from_hash(scope, hash); + theme_tree = md_tree_from_string(arena, data); + } + } + scratch_end(scratch); + return theme_tree; +} + internal Vec4F32 rd_rgba_from_code_color_slot(RD_CodeColorSlot slot) { @@ -10121,20 +10130,6 @@ rd_frame_arena(void) //////////////////////////////// //~ rjf: Registers -internal RD_Regs * -rd_regs(void) -{ - RD_Regs *regs = &rd_state->top_regs->v; - return regs; -} - -internal RD_Regs * -rd_base_regs(void) -{ - RD_Regs *regs = &rd_state->base_regs.v; - return regs; -} - internal RD_Regs * rd_push_regs_(RD_Regs *regs) { @@ -12194,26 +12189,33 @@ rd_frame(void) RD_Cfg *window = rd_cfg_from_id(rd_regs()->window); RD_PanelTree panel_tree = rd_panel_tree_from_cfg(scratch.arena, window); RD_Cfg *tab = panel_tree.focused->selected_tab; - String8 expr = push_str8f(scratch.arena, - "query:commands, " - "query:config.$%I64x, " - "query:config.$%I64x, " - "query:targets, " - "query:breakpoints, " - "query:recent_files, " - "query:recent_projects, " - "query:machines, " - "query:processes, " - "query:threads, " - "query:modules, " - "query:user_settings, " - "query:project_settings, " - "query:procedures, " - "query:types, " - "query:globals, " - "query:thread_locals, " - , - tab->id, window->id); + String8List exprs = {0}; + { + str8_list_pushf(scratch.arena, &exprs, "query:commands"); + if(tab != &rd_nil_cfg) + { + str8_list_pushf(scratch.arena, &exprs, "query:config.$%I64x", tab->id); + } + if(window != &rd_nil_cfg) + { + str8_list_pushf(scratch.arena, &exprs, "query:config.$%I64x", window->id); + } + str8_list_pushf(scratch.arena, &exprs, "query:targets"); + str8_list_pushf(scratch.arena, &exprs, "query:breakpoints"); + str8_list_pushf(scratch.arena, &exprs, "query:recent_files"); + str8_list_pushf(scratch.arena, &exprs, "query:recent_projects"); + str8_list_pushf(scratch.arena, &exprs, "query:machines"); + str8_list_pushf(scratch.arena, &exprs, "query:processes"); + str8_list_pushf(scratch.arena, &exprs, "query:threads"); + str8_list_pushf(scratch.arena, &exprs, "query:modules"); + str8_list_pushf(scratch.arena, &exprs, "query:user_settings"); + str8_list_pushf(scratch.arena, &exprs, "query:project_settings"); + str8_list_pushf(scratch.arena, &exprs, "query:procedures"); + str8_list_pushf(scratch.arena, &exprs, "query:types"); + str8_list_pushf(scratch.arena, &exprs, "query:globals"); + str8_list_pushf(scratch.arena, &exprs, "query:thread_locals"); + } + String8 expr = str8_list_join(scratch.arena, &exprs, &(StringJoin){.sep = str8_lit(", ")}); rd_cmd(RD_CmdKind_PushQuery, .expr = expr, .do_implicit_root = 1, .do_lister = 1, .do_big_rows = 1, .view = tab->id, .tab = tab->id); }break; @@ -14749,25 +14751,36 @@ rd_frame(void) }break; case RD_CmdKind_AddThemeColor: { + HS_Scope *hs_scope = hs_scope_open(); RD_Cfg *parent = rd_cfg_from_id(rd_regs()->cfg); + RD_Cfg *theme = rd_cfg_child_from_string_or_alloc(parent, str8_lit("theme")); + MD_Node *theme_tree = rd_theme_tree_from_name(scratch.arena, hs_scope, theme->first->string); + if(theme_tree == &md_nil_node) + { + rd_cfg_new_replace(theme, rd_theme_preset_display_string_table[RD_ThemePreset_DefaultDark]); + } RD_Cfg *color = rd_cfg_new(parent, str8_lit("theme_color")); rd_cfg_new(color, str8_lit("tags")); RD_Cfg *value = rd_cfg_new(color, str8_lit("value")); rd_cfg_new(value, str8_lit("0xffffffff")); + hs_scope_close(hs_scope); }break; case RD_CmdKind_ForkTheme: { + HS_Scope *hs_scope = hs_scope_open(); RD_Cfg *parent = rd_cfg_from_id(rd_regs()->cfg); RD_CfgList colors = rd_cfg_child_list_from_string(scratch.arena, parent, str8_lit("theme_color")); for(RD_CfgNode *n = colors.first; n != 0; n = n->next) { rd_cfg_release(n->v); } - String8 color_preset = rd_setting_from_name(str8_lit("theme_preset")); - RD_ThemePreset preset = RD_ThemePreset_DefaultDark; - // TODO(rjf): map preset via string - MD_Node *theme_tree = rd_state->theme_preset_trees[preset]; - String8 color_file = rd_setting_from_name(str8_lit("theme_file")); + RD_Cfg *theme_cfg = rd_cfg_child_from_string(parent, str8_lit("theme")); + String8 theme_name = theme_cfg->first->string; + MD_Node *theme_tree = rd_theme_tree_from_name(scratch.arena, hs_scope, theme_name); + if(theme_tree == &md_nil_node) + { + theme_tree = rd_state->theme_preset_trees[RD_ThemePreset_DefaultDark]; + } for(MD_Node *n = theme_tree; !md_node_is_nil(n); n = md_node_rec_depth_first_pre(n, theme_tree).next) { if(str8_match(n->string, str8_lit("theme_color"), 0)) @@ -14779,8 +14792,11 @@ rd_frame(void) rd_cfg_new(value, md_child_from_string(n, str8_lit("value"), 0)->first->string); } } + rd_cfg_release(theme_cfg); + hs_scope_close(hs_scope); }break; case RD_CmdKind_SaveTheme: + case RD_CmdKind_SaveAndSetTheme: { String8 name = rd_regs()->string; if(name.size != 0) @@ -14797,7 +14813,19 @@ rd_frame(void) str8_list_push(scratch.arena, &strings, rd_string_from_cfg_tree(scratch.arena, dst_path, n->v)); } String8 data = str8_list_join(scratch.arena, &strings, 0); - os_write_data_to_file_path(dst_path, data); + if(os_write_data_to_file_path(dst_path, data)) + { + for(RD_CfgNode *n = colors.first; n != 0; n = n->next) + { + rd_cfg_release(n->v); + } + RD_Cfg *theme = rd_cfg_child_from_string_or_alloc(parent, str8_lit("theme")); + rd_cfg_new_replace(theme, name); + } + else + { + log_user_errorf("Could not successfully write to '%S'.", dst_path); + } } } }break; diff --git a/src/raddbg/raddbg_core.h b/src/raddbg/raddbg_core.h index 5b96ae1a..5699383d 100644 --- a/src/raddbg/raddbg_core.h +++ b/src/raddbg/raddbg_core.h @@ -968,7 +968,7 @@ internal void rd_set_autocomp_regs_(RD_Regs *regs); //~ rjf: Colors, Fonts, Config //- rjf: colors -internal UI_Theme *rd_ui_theme_from_tree(MD_Node *tree); +internal MD_Node *rd_theme_tree_from_name(Arena *arena, HS_Scope *scope, String8 theme_name); internal Vec4F32 rd_rgba_from_code_color_slot(RD_CodeColorSlot slot); internal RD_CodeColorSlot rd_code_color_slot_from_txt_token_kind(TXT_TokenKind kind); internal RD_CodeColorSlot rd_code_color_slot_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8 string); @@ -1008,8 +1008,8 @@ internal Arena *rd_frame_arena(void); //////////////////////////////// //~ rjf: Registers -internal RD_Regs *rd_regs(void); -internal RD_Regs *rd_base_regs(void); +#define rd_regs() (&rd_state->top_regs->v) +#define rd_base_regs() (&rd_state->base_regs.v) internal RD_Regs *rd_push_regs_(RD_Regs *regs); #define rd_push_regs(...) rd_push_regs_(&(RD_Regs){rd_regs_lit_init_top __VA_ARGS__}) internal RD_Regs *rd_pop_regs(void); diff --git a/src/raddbg/raddbg_eval.c b/src/raddbg/raddbg_eval.c index a70380c5..25e46912 100644 --- a/src/raddbg/raddbg_eval.c +++ b/src/raddbg/raddbg_eval.c @@ -130,7 +130,7 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(themes) FuzzyMatchRangeList name_matches = fuzzy_match_find(scratch.arena, filter, name); if(name_matches.count == name_matches.needle_part_count) { - str8_list_push(scratch.arena, &names, name); + str8_list_push(scratch.arena, &names, push_str8_copy(arena, name)); } } os_file_iter_end(it); diff --git a/src/raddbg/raddbg_views.c b/src/raddbg/raddbg_views.c index 15012f4d..90856539 100644 --- a/src/raddbg/raddbg_views.c +++ b/src/raddbg/raddbg_views.c @@ -1868,6 +1868,38 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla } dr_fstrs_push_new(arena, &fstrs, ¶ms, str8_lit(" ")); dr_fstrs_push_new(arena, &fstrs, ¶ms, name); + { + HS_Scope *hs_scope = hs_scope_open(); + MD_Node *theme_tree = rd_theme_tree_from_name(scratch.arena, hs_scope, name); + U64 color_idx = 0; + for(MD_Node *n = theme_tree; color_idx < 4 && !md_node_is_nil(n); n = md_node_rec_depth_first_pre(n, theme_tree).next) + { + if(str8_match(n->string, str8_lit("theme_color"), 0)) + { + String8 tags = md_child_from_string(n, str8_lit("tags"), 0)->first->string; + if(str8_match(tags, str8_lit("background"), 0) || + str8_match(tags, str8_lit("text"), 0) || + str8_match(tags, str8_lit("focus border"), 0) || + str8_match(tags, str8_lit("menu_bar background"), 0) || + str8_match(tags, str8_lit("tab background"), 0) || + str8_match(tags, str8_lit("code_default"), 0)) + { + U64 color = 0; + if(try_u64_from_str8_c_rules(md_child_from_string(n, str8_lit("value"), 0)->first->string, &color)) + { + dr_fstrs_push_new(arena, &fstrs, ¶ms, str8_lit(" ")); + dr_fstrs_push_new(arena, &fstrs, ¶ms, + rd_icon_kind_text_table[RD_IconKind_CircleFilled], + .font = rd_font_from_slot(RD_FontSlot_Icons), + .raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Icons), + .color = linear_from_srgba(rgba_from_u32((U32)color))); + color_idx += 1; + } + } + } + } + hs_scope_close(hs_scope); + } result.eval_fstrs = fstrs; }break; } @@ -1975,7 +2007,7 @@ RD_VIEW_UI_FUNCTION_DEF(text) U64 size = rd_view_setting_value_from_name(str8_lit("size")).u64; if(size == 0) { - size = e_type_byte_size_from_key(e_type_key_unwrap(eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative)); + size = e_range_size_from_eval(eval); } Rng1U64 range = r1u64(base_offset, base_offset+size); rd_regs()->text_key = rd_key_from_eval_space_range(eval.space, range, 1); @@ -2249,7 +2281,7 @@ RD_VIEW_UI_FUNCTION_DEF(disasm) U64 size = rd_view_setting_value_from_name(str8_lit("size")).u64; if(size == 0) { - size = KB(16); + size = e_range_size_from_eval(eval); } Rng1U64 range = r1u64(base_offset, base_offset+size); Arch arch = rd_arch_from_eval(eval); @@ -2429,7 +2461,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory) U64 size = rd_view_setting_value_from_name(str8_lit("size")).u64; if(size == 0) { - size = e_type_byte_size_from_key(e_type_key_unwrap(eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative)); + size = e_range_size_from_eval(eval); } Rng1U64 view_range = r1u64(base_offset, base_offset+size); if(eval.space.kind == 0)