From 2f9121171ccdd2e916732fad468158f4194201e1 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Tue, 24 Sep 2024 13:24:23 -0700 Subject: [PATCH] eliminate dead code, after this pass --- src/raddbg/generated/raddbg.meta.c | 8 +- src/raddbg/generated/raddbg.meta.h | 6 - src/raddbg/raddbg.mdesk | 8 +- src/raddbg/raddbg_core.c | 130 +--- src/raddbg/raddbg_views.c | 1163 ---------------------------- src/raddbg/raddbg_widgets.c | 4 +- 6 files changed, 14 insertions(+), 1305 deletions(-) diff --git a/src/raddbg/generated/raddbg.meta.c b/src/raddbg/generated/raddbg.meta.c index e5f476ea..0b6a1774 100644 --- a/src/raddbg/generated/raddbg.meta.c +++ b/src/raddbg/generated/raddbg.meta.c @@ -243,7 +243,7 @@ Rng1U64 rd_reg_slot_range_table[33] = {OffsetOf(RD_Regs, os_event), OffsetOf(RD_Regs, os_event) + sizeof(OS_Event *)}, }; -RD_CmdKindInfo rd_cmd_kind_info_table[219] = +RD_CmdKindInfo rd_cmd_kind_info_table[213] = { {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("Launch and Run"), RD_IconKind_Play, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_EntityList, str8_lit_comp(""), RD_EntityKind_Target}}, @@ -406,14 +406,12 @@ RD_CmdKindInfo rd_cmd_kind_info_table[219] = { str8_lit_comp("disable_entity"), str8_lit_comp("Disables an entity."), str8_lit_comp(""), str8_lit_comp("Disable Entity"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, { str8_lit_comp("remove_entity"), str8_lit_comp("Removes an entity."), str8_lit_comp(""), str8_lit_comp("Remove Entity"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, { str8_lit_comp("name_entity"), str8_lit_comp("Equips an entity with a name."), str8_lit_comp(""), str8_lit_comp("Name Entity"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, -{ str8_lit_comp("edit_entity"), str8_lit_comp("Opens the editor for an entity."), str8_lit_comp(""), str8_lit_comp("Edit Entity"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, { str8_lit_comp("duplicate_entity"), str8_lit_comp("Duplicates an entity."), str8_lit_comp(""), str8_lit_comp("Duplicate Entity"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, { str8_lit_comp("relocate_entity"), str8_lit_comp("Relocates an entity."), str8_lit_comp(""), str8_lit_comp("Relocate Entity"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, { str8_lit_comp("add_breakpoint"), str8_lit_comp("Places a breakpoint at a given location (file path and line number, address, or symbol name)."), str8_lit_comp(""), str8_lit_comp("Add Breakpoint"), RD_IconKind_CircleFilled, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, { str8_lit_comp("add_address_breakpoint"), str8_lit_comp("Places a breakpoint on the specified address."), str8_lit_comp(""), str8_lit_comp("Add Address Breakpoint"), RD_IconKind_CircleFilled, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*1)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Vaddr, str8_lit_comp(""), RD_EntityKind_Nil}}, { str8_lit_comp("add_function_breakpoint"), str8_lit_comp("Places a breakpoint on the first address(es) of the specified function."), str8_lit_comp(""), str8_lit_comp("Add Function Breakpoint"), RD_IconKind_CircleFilled, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*1)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_String, str8_lit_comp("symbol_lister"), RD_EntityKind_Nil}}, { str8_lit_comp("toggle_breakpoint"), str8_lit_comp("Places or removes a breakpoint at a given location (file path and line number, address, or symbol name)."), str8_lit_comp(""), str8_lit_comp("Toggle Breakpoint"), RD_IconKind_CircleFilled, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, -{ str8_lit_comp("remove_breakpoint"), str8_lit_comp("Removes an existing breakpoint."), str8_lit_comp(""), str8_lit_comp("Remove Breakpoint"), RD_IconKind_Trash, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Entity, str8_lit_comp(""), RD_EntityKind_Breakpoint}}, { str8_lit_comp("enable_breakpoint"), str8_lit_comp("Enables a breakpoint."), str8_lit_comp(""), str8_lit_comp("Enable Breakpoint"), RD_IconKind_CheckFilled, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Entity, str8_lit_comp(""), RD_EntityKind_Breakpoint}}, { str8_lit_comp("disable_breakpoint"), str8_lit_comp("Disables a breakpoint."), str8_lit_comp(""), str8_lit_comp("Disable Breakpoint"), RD_IconKind_CheckHollow, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Entity, str8_lit_comp(""), RD_EntityKind_Breakpoint}}, { str8_lit_comp("add_watch_pin"), str8_lit_comp("Places a watch pin at a given location (file path and line number or address)."), str8_lit_comp(""), str8_lit_comp("Add Watch Pin"), RD_IconKind_Binoculars, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, @@ -421,14 +419,10 @@ RD_CmdKindInfo rd_cmd_kind_info_table[219] = { str8_lit_comp("run_to_cursor"), str8_lit_comp("Runs the selected thread to the current cursor."), str8_lit_comp("line"), str8_lit_comp("Run To Cursor"), RD_IconKind_Play, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, { 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("Set Next Statement"), RD_IconKind_RightArrow, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, { str8_lit_comp("add_target"), str8_lit_comp("Adds a new target."), str8_lit_comp("application,executable,debug"), str8_lit_comp("Add Target"), RD_IconKind_Target, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*1)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_FilePath, str8_lit_comp(""), RD_EntityKind_Nil}}, -{ str8_lit_comp("remove_target"), str8_lit_comp("Removes an existing target."), str8_lit_comp("delete,remove,target"), str8_lit_comp("Remove Target"), RD_IconKind_Trash, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Entity, str8_lit_comp(""), RD_EntityKind_Target}}, -{ str8_lit_comp("edit_target"), str8_lit_comp("Edits an existing target."), str8_lit_comp(""), str8_lit_comp("Edit Target"), RD_IconKind_Pencil, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Entity, str8_lit_comp(""), RD_EntityKind_Target}}, { str8_lit_comp("select_target"), str8_lit_comp("Selects a target."), str8_lit_comp(""), str8_lit_comp("Select Target"), RD_IconKind_Target, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Entity, str8_lit_comp(""), RD_EntityKind_Target}}, { str8_lit_comp("enable_target"), str8_lit_comp("Enables a target, in addition to all targets currently enabled."), str8_lit_comp(""), str8_lit_comp("Enable Target"), RD_IconKind_CheckFilled, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Entity, str8_lit_comp(""), RD_EntityKind_Target}}, { str8_lit_comp("disable_target"), str8_lit_comp("Disables a target."), str8_lit_comp(""), str8_lit_comp("Disable Target"), RD_IconKind_CheckHollow, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Entity, str8_lit_comp(""), RD_EntityKind_Target}}, { str8_lit_comp("register_as_jit_debugger"), str8_lit_comp("Registers the RAD debugger as the just-in-time (JIT) debugger used by the operating system."), str8_lit_comp(""), str8_lit_comp("Register As Just-In-Time (JIT) Debugger"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, -{ str8_lit_comp("entity_ref_fast_path"), str8_lit_comp("Activates the default behavior when clicking an entity reference."), str8_lit_comp(""), str8_lit_comp("Entity Reference Fast Path"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, -{ str8_lit_comp("spawn_entity_view"), str8_lit_comp("Spawns a new view, given an entity and other parameterizations."), str8_lit_comp(""), str8_lit_comp("Spawn Entity View"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, { str8_lit_comp("find_code_location"), str8_lit_comp("Finds a specific source code location given file, line, and column coordinates. Opens the file if necessary."), str8_lit_comp(""), str8_lit_comp("Find Code Location"), RD_IconKind_FileOutline, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_FilePath, str8_lit_comp(""), RD_EntityKind_Nil}}, { str8_lit_comp("filter"), str8_lit_comp("Begins filtering the active view."), str8_lit_comp("sort,search,filter,find"), str8_lit_comp("Filter"), RD_IconKind_Find, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, { str8_lit_comp("apply_filter"), str8_lit_comp("Applies the typed filter to the active view."), str8_lit_comp("sort,search,filter,find,apply"), str8_lit_comp("Apply Filter"), RD_IconKind_Find, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}}, diff --git a/src/raddbg/generated/raddbg.meta.h b/src/raddbg/generated/raddbg.meta.h index 1a4ebb70..f9854a2f 100644 --- a/src/raddbg/generated/raddbg.meta.h +++ b/src/raddbg/generated/raddbg.meta.h @@ -251,14 +251,12 @@ RD_CmdKind_EnableEntity, RD_CmdKind_DisableEntity, RD_CmdKind_RemoveEntity, RD_CmdKind_NameEntity, -RD_CmdKind_EditEntity, RD_CmdKind_DuplicateEntity, RD_CmdKind_RelocateEntity, RD_CmdKind_AddBreakpoint, RD_CmdKind_AddAddressBreakpoint, RD_CmdKind_AddFunctionBreakpoint, RD_CmdKind_ToggleBreakpoint, -RD_CmdKind_RemoveBreakpoint, RD_CmdKind_EnableBreakpoint, RD_CmdKind_DisableBreakpoint, RD_CmdKind_AddWatchPin, @@ -266,14 +264,10 @@ RD_CmdKind_ToggleWatchPin, RD_CmdKind_RunToCursor, RD_CmdKind_SetNextStatement, RD_CmdKind_AddTarget, -RD_CmdKind_RemoveTarget, -RD_CmdKind_EditTarget, RD_CmdKind_SelectTarget, RD_CmdKind_EnableTarget, RD_CmdKind_DisableTarget, RD_CmdKind_RegisterAsJITDebugger, -RD_CmdKind_EntityRefFastPath, -RD_CmdKind_SpawnEntityView, RD_CmdKind_FindCodeLocation, RD_CmdKind_Filter, RD_CmdKind_ApplyFilter, diff --git a/src/raddbg/raddbg.mdesk b/src/raddbg/raddbg.mdesk index 8b2e0c34..409aed5a 100644 --- a/src/raddbg/raddbg.mdesk +++ b/src/raddbg/raddbg.mdesk @@ -417,7 +417,6 @@ RD_CmdTable: // | | | | {DisableEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "disable_entity" "Disable Entity" "Disables an entity." "" } {RemoveEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "remove_entity" "Remove Entity" "Removes an entity." "" } {NameEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "name_entity" "Name Entity" "Equips an entity with a name." "" } - {EditEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "edit_entity" "Edit Entity" "Opens the editor for an entity." "" } {DuplicateEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "duplicate_entity" "Duplicate Entity" "Duplicates an entity." "" } {RelocateEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "relocate_entity" "Relocate Entity" "Relocates an entity." "" } @@ -426,7 +425,6 @@ RD_CmdTable: // | | | | {AddAddressBreakpoint 1 0 Vaddr null Nil 0 0 0 0 1 1 CircleFilled "add_address_breakpoint" "Add Address Breakpoint" "Places a breakpoint on the specified address." "" } {AddFunctionBreakpoint 1 0 String symbol_lister Nil 0 0 0 0 1 1 CircleFilled "add_function_breakpoint" "Add Function Breakpoint" "Places a breakpoint on the first address(es) of the specified function." "" } {ToggleBreakpoint 1 1 Null null Nil 0 0 0 0 0 0 CircleFilled "toggle_breakpoint" "Toggle Breakpoint" "Places or removes a breakpoint at a given location (file path and line number, address, or symbol name)." "" } - {RemoveBreakpoint 1 1 Entity null Breakpoint 0 0 0 0 0 1 Trash "remove_breakpoint" "Remove Breakpoint" "Removes an existing breakpoint." "" } {EnableBreakpoint 1 1 Entity null Breakpoint 0 0 0 0 0 1 CheckFilled "enable_breakpoint" "Enable Breakpoint" "Enables a breakpoint." "" } {DisableBreakpoint 1 1 Entity null Breakpoint 0 0 0 0 0 1 CheckHollow "disable_breakpoint" "Disable Breakpoint" "Disables a breakpoint." "" } @@ -440,8 +438,6 @@ RD_CmdTable: // | | | | //- rjf: targets {AddTarget 1 1 FilePath null Nil 1 0 0 0 0 1 Target "add_target" "Add Target" "Adds a new target." "application,executable,debug" } - {RemoveTarget 1 1 Entity null Target 0 0 0 0 0 1 Trash "remove_target" "Remove Target" "Removes an existing target." "delete,remove,target" } - {EditTarget 1 1 Entity null Target 0 0 0 0 0 1 Pencil "edit_target" "Edit Target" "Edits an existing target." "" } {SelectTarget 1 1 Entity null Target 0 0 0 0 0 1 Target "select_target" "Select Target" "Selects a target." "" } {EnableTarget 1 1 Entity null Target 0 0 0 0 0 1 CheckFilled "enable_target" "Enable Target" "Enables a target, in addition to all targets currently enabled." "" } {DisableTarget 1 1 Entity null Target 0 0 0 0 0 1 CheckHollow "disable_target" "Disable Target" "Disables a target." "" } @@ -449,9 +445,7 @@ RD_CmdTable: // | | | | //- rjf: attaching {RegisterAsJITDebugger 1 1 Null null Nil 0 0 0 0 0 0 Null "register_as_jit_debugger" "Register As Just-In-Time (JIT) Debugger" "Registers the RAD debugger as the just-in-time (JIT) debugger used by the operating system." "" } - //- rjf: catchall general entity activation paths (drag/drop, clicking) - {EntityRefFastPath 0 0 Null null Nil 0 0 0 0 0 0 Null "entity_ref_fast_path" "Entity Reference Fast Path" "Activates the default behavior when clicking an entity reference." "" } - {SpawnEntityView 0 0 Null null Nil 0 0 0 0 0 0 Null "spawn_entity_view" "Spawn Entity View" "Spawns a new view, given an entity and other parameterizations." "" } + //- rjf: snap-to-code-location {FindCodeLocation 0 1 FilePath null Nil 0 0 0 0 0 1 FileOutline "find_code_location" "Find Code Location" "Finds a specific source code location given file, line, and column coordinates. Opens the file if necessary." "" } //- rjf: general-purpose view filtering diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index 04791a1c..1bdfab64 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -2612,7 +2612,7 @@ rd_view_scroll_pos(void) internal String8 rd_view_expr_string(void) { - // TODO(rjf): @msgs filter and expr string need to be different + // TODO(rjf): @entity_simplification filter and expr string need to be different RD_View *view = rd_view_from_handle(rd_regs()->view); String8 expr_string = str8(view->query_buffer, view->query_string_size); return expr_string; @@ -2621,7 +2621,7 @@ rd_view_expr_string(void) internal String8 rd_view_filter(void) { - // TODO(rjf): @msgs filter and expr string need to be different + // TODO(rjf): @entity_simplification filter and expr string need to be different RD_View *view = rd_view_from_handle(rd_regs()->view); String8 filter = str8(view->query_buffer, view->query_string_size); return filter; @@ -2650,7 +2650,7 @@ rd_push_view_arena(void) internal void rd_store_view_expr_string(String8 string) { - // TODO(rjf): @msgs filter and expr string need to be different + // TODO(rjf): @entity_simplification filter and expr string need to be different RD_View *view = rd_view_from_handle(rd_regs()->view); rd_view_equip_query(view, string); } @@ -2658,7 +2658,7 @@ rd_store_view_expr_string(String8 string) internal void rd_store_view_filter(String8 string) { - // TODO(rjf): @msgs filter and expr string need to be different + // TODO(rjf): @entity_simplification filter and expr string need to be different RD_View *view = rd_view_from_handle(rd_regs()->view); rd_view_equip_query(view, string); } @@ -2923,30 +2923,6 @@ rd_window_frame(RD_Window *ws) ws->window_temporarily_focused_ipc = 0; ui_select_state(ws->ui); - ////////////////////////////// - //- rjf: auto-close tabs which have parameter entities that've been deleted - // -#if 0 // TODO(rjf): @msgs - for(RD_Panel *panel = ws->root_panel; - !rd_panel_is_nil(panel); - panel = rd_panel_rec_depth_first_pre(panel).next) - { - for(RD_View *view = panel->first_tab_view; - !rd_view_is_nil(view); - view = view->order_next) - { - RD_Entity *entity = rd_entity_from_eval_string(str8(view->query_buffer, view->query_string_size)); - if(entity->flags & RD_EntityFlag_MarkedForDeletion || - (rd_entity_is_nil(entity) && view->spec->info.flags & RD_ViewSpecFlag_ParameterizedByEntity)) - { - rd_cmd(RD_CmdKind_CloseTab, - .panel = rd_handle_from_panel(panel), - .view = rd_handle_from_view(view)); - } - } - } -#endif - ////////////////////////////// //- rjf: panels with no selected tabs? -> select. // panels with selected tabs? -> ensure they have active tabs. @@ -4799,14 +4775,10 @@ rd_window_frame(RD_Window *ws) String8 cmds[] = { rd_cmd_kind_info_table[RD_CmdKind_AddTarget].string, - rd_cmd_kind_info_table[RD_CmdKind_EditTarget].string, - rd_cmd_kind_info_table[RD_CmdKind_RemoveTarget].string, }; U32 codepoints[] = { 'a', - 'e', - 'r', }; Assert(ArrayCount(codepoints) == ArrayCount(cmds)); rd_cmd_list_menu_buttons(ArrayCount(cmds), cmds, codepoints); @@ -4825,9 +4797,12 @@ rd_window_frame(RD_Window *ws) UI_Palette(palette) sig = rd_icon_buttonf(RD_IconKind_Target, 0, "%S##%p", target_name, target); if(ui_clicked(sig)) { + // TODO(rjf): @msgs +#if 0 rd_cmd(RD_CmdKind_EditTarget, .entity = rd_handle_from_entity(target)); ui_ctx_menu_close(); ws->menu_bar_focused = 0; +#endif } } scratch_end(scratch); @@ -7163,7 +7138,7 @@ rd_window_frame(RD_Window *ws) } ////////////////////////// - //- rjf: less granular panel for tabs & entities drop-site + //- rjf: less granular panel-wide drop-site // if(catchall_drop_site_hovered) { @@ -7195,10 +7170,7 @@ rd_window_frame(RD_Window *ws) { RD_Panel *src_panel = rd_panel_from_handle(rd_state->drag_drop_regs->panel); RD_View *view = rd_view_from_handle(rd_state->drag_drop_regs->view); - RD_Entity *entity = rd_entity_from_handle(rd_state->drag_drop_regs->entity); - - // rjf: view drop - if(!rd_view_is_nil(view)) + if(rd_state->drag_drop_regs_slot == RD_RegSlot_View && !rd_view_is_nil(view)) { rd_cmd(RD_CmdKind_MoveTab, .prev_view = rd_handle_from_view(panel->last_tab_view), @@ -7206,15 +7178,6 @@ rd_window_frame(RD_Window *ws) .dst_panel = rd_handle_from_panel(panel), .view = rd_handle_from_view(view)); } - - // rjf: entity drop - if(!rd_entity_is_nil(entity)) - { - rd_cmd(RD_CmdKind_SpawnEntityView, - .panel = rd_handle_from_panel(panel), - .cursor = rd_state->drag_drop_regs->cursor, - .entity = rd_handle_from_entity(entity)); - } } } } @@ -13383,77 +13346,7 @@ rd_frame(void) } }break; - //- rjf: editors - case RD_CmdKind_EditEntity: - { -#if 0 // TODO(rjf): @msgs - RD_Entity *entity = rd_entity_from_handle(rd_regs()->entity); - switch(entity->kind) - { - default: break; - case RD_EntityKind_Target: - { - rd_push_cmd(rd_cmd_spec_from_kind(RD_CmdKind_EditTarget), params); - }break; - } -#endif - }break; - - //- rjf: targets - case RD_CmdKind_EditTarget: - { -#if 0 // TODO(rjf): @msgs - RD_Entity *entity = rd_entity_from_handle(rd_regs()->entity); - if(!rd_entity_is_nil(entity) && entity->kind == RD_EntityKind_Target) - { - rd_push_cmd(rd_cmd_spec_from_kind(RD_CmdKind_Target), params); - } - else - { - log_user_errorf("Invalid target."); - } -#endif - }break; - - //- rjf: catchall general entity activation paths (drag/drop, clicking) - case RD_CmdKind_EntityRefFastPath: - { - RD_Entity *entity = rd_entity_from_handle(rd_regs()->entity); - switch(entity->kind) - { - default: - { - rd_cmd(RD_CmdKind_SpawnEntityView, .entity = rd_handle_from_entity(entity)); - }break; - case RD_EntityKind_Thread: - { - rd_cmd(RD_CmdKind_SelectThread, .entity = rd_handle_from_entity(entity)); - }break; - case RD_EntityKind_Target: - { - rd_cmd(RD_CmdKind_SelectTarget, .entity = rd_handle_from_entity(entity)); - }break; - } - }break; - case RD_CmdKind_SpawnEntityView: - { -#if 0 // TODO(rjf): @msgs - RD_Window *ws = rd_window_from_handle(rd_regs()->window); - RD_Panel *panel = rd_panel_from_handle(rd_regs()->panel); - RD_Entity *entity = rd_entity_from_handle(rd_regs()->entity); - switch(entity->kind) - { - default:{}break; - - case RD_EntityKind_Target: - { - D_CmdParams params = df_cmd_params_from_panel(ws, panel); - params.entity = rd_handle_from_entity(entity); - rd_push_cmd(rd_cmd_spec_from_kind(RD_CmdKind_EditTarget), ¶ms); - }break; - } -#endif - }break; + //- rjf: snap-to-code-location case RD_CmdKind_FindCodeLocation: { // NOTE(rjf): This command is where a lot of high-level flow things @@ -13864,8 +13757,6 @@ rd_frame(void) rd_entity_equip_disabled(entity, 1); }break; case RD_CmdKind_RemoveEntity: - case RD_CmdKind_RemoveBreakpoint: - case RD_CmdKind_RemoveTarget: { RD_Entity *entity = rd_entity_from_handle(rd_regs()->entity); RD_EntityKindFlags kind_flags = rd_entity_kind_flags_table[entity->kind]; @@ -14135,7 +14026,6 @@ rd_frame(void) RD_Entity *execution_path = rd_entity_alloc(entity, RD_EntityKind_WorkingDirectory); rd_entity_equip_name(execution_path, working_dir_path); } - rd_cmd(RD_CmdKind_EditTarget, .entity = rd_handle_from_entity(entity)); rd_cmd(RD_CmdKind_SelectTarget, .entity = rd_handle_from_entity(entity)); }break; case RD_CmdKind_SelectTarget: diff --git a/src/raddbg/raddbg_views.c b/src/raddbg/raddbg_views.c index 5fe7f6e7..b5e37387 100644 --- a/src/raddbg/raddbg_views.c +++ b/src/raddbg/raddbg_views.c @@ -1068,362 +1068,6 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo blocks.count -= 1; blocks.total_visual_row_count -= 1; blocks.total_semantic_row_count -= 1; - -#if 0 - RDI_SectionKind fzy_target = RDI_SectionKind_UDTs; - switch(ewv->fill_kind) - { - //////////////////////////// - //- rjf: watch fill -> build blocks from top-level watch expressions - // - default: - case RD_WatchViewFillKind_Watch: - { - mutable_entity_kind = RD_EntityKind_Watch; - RD_EntityList watches = rd_query_cached_entity_list_with_kind(mutable_entity_kind); - for(RD_EntityNode *n = watches.first; n != 0; n = n->next) - { - RD_Entity *watch = n->entity; - if(watch->flags & RD_EntityFlag_MarkedForDeletion) - { - continue; - } - EV_Key parent_key = rd_parent_ev_key_from_entity(watch); - EV_Key key = rd_ev_key_from_entity(watch); - RD_Entity *view_rule = rd_entity_child_from_kind(watch, RD_EntityKind_ViewRule); - ev_key_set_view_rule(eval_view, key, view_rule->string); - String8 expr_string = watch->string; - EV_BlockList watch_blocks = ev_block_list_from_view_expr_keys(scratch.arena, eval_view, filter, &top_level_view_rules, expr_string, parent_key, key, 0); - FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, expr_string); - if(watch_blocks.total_semantic_row_count > 1 || matches.count == matches.needle_part_count) - { - ev_block_list_concat__in_place(&blocks, &watch_blocks); - } - } - }break; - - //////////////////////////// - //- rjf: breakpoint fill -> build blocks from all breakpoints - // - case RD_WatchViewFillKind_Breakpoints: - { - E_TypeKey meta_eval_type = e_type_key_cons_base(type(CTRL_MetaEval)); - mutable_entity_kind = RD_EntityKind_Breakpoint; - ev_view_rule_list_push_string(scratch.arena, &top_level_view_rules, str8_lit("no_addr")); - RD_EntityList bps = rd_query_cached_entity_list_with_kind(mutable_entity_kind); - for(RD_EntityNode *n = bps.first; n != 0; n = n->next) - { - RD_Entity *bp = n->entity; - if(bp->flags & RD_EntityFlag_MarkedForDeletion) - { - continue; - } - EV_Key parent_key = rd_parent_ev_key_from_entity(bp); - EV_Key key = rd_ev_key_from_entity(bp); - String8 title = rd_display_string_from_entity(scratch.arena, bp); - FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, title); - if(matches.count == matches.needle_part_count) - { - String8 expr_string = push_str8f(scratch.arena, "$%I64u", bp->id); - EV_BlockList watch_blocks = ev_block_list_from_view_expr_keys(scratch.arena, eval_view, str8_zero(), &top_level_view_rules, expr_string, parent_key, key, 0); - ev_block_list_concat__in_place(&blocks, &watch_blocks); - } - } - }break; - - //////////////////////////// - //- rjf: watch pin fill -> build blocks from all watch pins - // - case RD_WatchViewFillKind_WatchPins: - { - mutable_entity_kind = RD_EntityKind_WatchPin; - RD_EntityList wps = rd_query_cached_entity_list_with_kind(mutable_entity_kind); - for(RD_EntityNode *n = wps.first; n != 0; n = n->next) - { - RD_Entity *wp = n->entity; - if(wp->flags & RD_EntityFlag_MarkedForDeletion) - { - continue; - } - EV_Key parent_key = rd_parent_ev_key_from_entity(wp); - EV_Key key = rd_ev_key_from_entity(wp); - String8 title = wp->string; - FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, title); - if(matches.count == matches.needle_part_count) - { - String8 expr_string = push_str8f(scratch.arena, "$%I64u", wp->id); - EV_BlockList watch_blocks = ev_block_list_from_view_expr_keys(scratch.arena, eval_view, str8_zero(), &top_level_view_rules, expr_string, parent_key, key, 0); - ev_block_list_concat__in_place(&blocks, &watch_blocks); - } - } - }break; - - //////////////////////////// - //- rjf: call stack fill -> build blocks for each call frame - // - case RD_WatchViewFillKind_CallStack: - { - //- rjf: produce per-row info for callstack - CTRL_Entity *thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->thread); - CTRL_Entity *process = ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process); - CTRL_Unwind base_unwind = d_query_cached_unwind_from_thread(thread); - D_Unwind rich_unwind = d_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind); - frame_rows_count = rich_unwind.frames.total_frame_count; - frame_rows = push_array(scratch.arena, FrameRow, frame_rows_count); - { - U64 concrete_frame_idx = 0; - U64 row_idx = 0; - for(;concrete_frame_idx < rich_unwind.frames.concrete_frame_count; concrete_frame_idx += 1, row_idx += 1) - { - D_UnwindFrame *f = &rich_unwind.frames.v[concrete_frame_idx]; - - // rjf: fill frame_rows for inline frames - { - U64 inline_unwind_idx = 0; - for(D_UnwindInlineFrame *fin = f->last_inline_frame; fin != 0; fin = fin->prev, row_idx += 1, inline_unwind_idx += 1) - { - frame_rows[row_idx].regs = f->regs; - frame_rows[row_idx].rdi = f->rdi; - frame_rows[row_idx].inline_site = fin->inline_site; - frame_rows[row_idx].unwind_idx = concrete_frame_idx; - frame_rows[row_idx].inline_depth = f->inline_frame_count - inline_unwind_idx; - } - } - - // rjf: fill row for concrete frame - { - frame_rows[row_idx].regs = f->regs; - frame_rows[row_idx].rdi = f->rdi; - frame_rows[row_idx].procedure = f->procedure; - frame_rows[row_idx].unwind_idx= concrete_frame_idx; - } - } - } - - //- rjf: build viz blocks - for(U64 row_idx = 0; row_idx < frame_rows_count; row_idx += 1) - { - FrameRow *row = &frame_rows[row_idx]; - EV_Key parent_key = ev_key_make(5381, 0); - EV_Key key = ev_key_make(ev_hash_from_key(parent_key), row_idx+1); - EV_Block *block = ev_block_begin(scratch.arena, EV_BlockKind_Root, parent_key, key, 0); - { - E_TypeKey type_key = zero_struct; - if(row->procedure != 0) - { - type_key = e_type_key_ext(E_TypeKind_Function, row->procedure->type_idx, e_parse_ctx_module_idx_from_rdi(row->rdi)); - } - else if(row->inline_site != 0) - { - type_key = e_type_key_ext(E_TypeKind_Function, row->inline_site->type_idx, e_parse_ctx_module_idx_from_rdi(row->rdi)); - } - U64 row_vaddr = regs_rip_from_arch_block(thread->arch, row->regs); - E_OpList ops = {0}; - e_oplist_push_op(scratch.arena, &ops, RDI_EvalOp_ConstU64, e_value_u64(row_vaddr)); - String8 bytecode = e_bytecode_from_oplist(scratch.arena, &ops); - E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafBytecode, 0); - expr->bytecode = bytecode; - expr->mode = E_Mode_Value; - expr->space = rd_eval_space_from_ctrl_entity(process, RD_EvalSpaceKind_CtrlEntity); - expr->type_key = type_key; - block->expr = expr; - block->visual_idx_range = r1u64(row_idx, row_idx+1); - block->semantic_idx_range = r1u64(row_idx, row_idx+1); - } - ev_block_end(&blocks, block); - } - }break; - - //////////////////////////// - //- rjf: registers fill -> build blocks via iterating all registers/aliases as root-level expressions - // - case RD_WatchViewFillKind_Registers: - { - CTRL_Entity *thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->thread); - Arch arch = thread->arch; - U64 reg_count = regs_reg_code_count_from_arch(arch); - String8 *reg_strings = regs_reg_code_string_table_from_arch(arch); - U64 alias_count = regs_alias_code_count_from_arch(arch); - String8 *alias_strings = regs_alias_code_string_table_from_arch(arch); - U64 num = 1; - for(U64 reg_idx = 1; reg_idx < reg_count; reg_idx += 1, num += 1) - { - String8 root_expr_string = push_str8f(scratch.arena, "reg:%S", reg_strings[reg_idx]); - FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, root_expr_string); - if(matches.count == matches.needle_part_count) - { - EV_Key parent_key = ev_key_make(5381, 0); - EV_Key key = ev_key_make(ev_hash_from_key(parent_key), num); - EV_BlockList root_blocks = ev_block_list_from_view_expr_keys(scratch.arena, eval_view, str8_zero(), &top_level_view_rules, root_expr_string, parent_key, key, 0); - ev_block_list_concat__in_place(&blocks, &root_blocks); - } - } - for(U64 alias_idx = 1; alias_idx < alias_count; alias_idx += 1, num += 1) - { - String8 root_expr_string = push_str8f(scratch.arena, "reg:%S", alias_strings[alias_idx]); - FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, root_expr_string); - if(matches.count == matches.needle_part_count) - { - EV_Key parent_key = ev_key_make(5381, 0); - EV_Key key = ev_key_make(ev_hash_from_key(parent_key), num); - EV_BlockList root_blocks = ev_block_list_from_view_expr_keys(scratch.arena, eval_view, str8_zero(), &top_level_view_rules, root_expr_string, parent_key, key, 0); - ev_block_list_concat__in_place(&blocks, &root_blocks); - } - } - }break; - - //////////////////////////// - //- rjf: locals fill -> build blocks via iterating all locals as root-level expressions - // - case RD_WatchViewFillKind_Locals: - { - E_String2NumMapNodeArray nodes = e_string2num_map_node_array_from_map(scratch.arena, e_parse_ctx->locals_map); - e_string2num_map_node_array_sort__in_place(&nodes); - for(U64 idx = 0; idx < nodes.count; idx += 1) - { - E_String2NumMapNode *n = nodes.v[idx]; - String8 root_expr_string = n->string; - FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, root_expr_string); - if(matches.count == matches.needle_part_count) - { - EV_Key parent_key = ev_key_make(5381, 0); - EV_Key key = ev_key_make(ev_hash_from_key(parent_key), idx+1); - EV_BlockList root_blocks = ev_block_list_from_view_expr_keys(scratch.arena, eval_view, str8_zero(), &top_level_view_rules, root_expr_string, parent_key, key, 0); - ev_block_list_concat__in_place(&blocks, &root_blocks); - } - } - }break; - - //////////////////////////// - //- rjf: debug info table fill -> build split debug info table blocks - // - case RD_WatchViewFillKind_Globals: fzy_target = RDI_SectionKind_GlobalVariables; goto dbgi_table; - case RD_WatchViewFillKind_ThreadLocals: fzy_target = RDI_SectionKind_ThreadVariables; goto dbgi_table; - case RD_WatchViewFillKind_Types: fzy_target = RDI_SectionKind_UDTs; goto dbgi_table; - case RD_WatchViewFillKind_Procedures: fzy_target = RDI_SectionKind_Procedures; goto dbgi_table; - dbgi_table:; - { - U64 endt_us = os_now_microseconds()+200; - - //- rjf: unpack context - DI_KeyList dbgi_keys_list = d_push_active_dbgi_key_list(scratch.arena); - DI_KeyArray dbgi_keys = di_key_array_from_list(scratch.arena, &dbgi_keys_list); - U64 rdis_count = dbgi_keys.count; - RDI_Parsed **rdis = push_array(scratch.arena, RDI_Parsed *, rdis_count); - for(U64 idx = 0; idx < rdis_count; idx += 1) - { - rdis[idx] = di_rdi_from_key(di_scope, &dbgi_keys.v[idx], endt_us); - } - - //- rjf: calculate top-level keys, expand root-level, grab root expansion node - EV_Key parent_key = ev_key_make(5381, 0); - EV_Key root_key = ev_key_make(ev_hash_from_key(parent_key), 0); - ev_key_set_expansion(eval_view, ev_key_zero(), parent_key, 1); - EV_ExpandNode *root_node = ev_expand_node_from_key(eval_view, parent_key); - - //- rjf: query all filtered items from dbgi searching system - U128 fuzzy_search_key = {rd_regs()->view.u64[0], rd_regs()->view.u64[1]}; - B32 items_stale = 0; - FZY_Params params = {fzy_target, dbgi_keys}; - FZY_ItemArray items = fzy_items_from_key_params_query(fzy_scope, fuzzy_search_key, ¶ms, filter, endt_us, &items_stale); - if(items_stale) - { - rd_request_frame(); - } - - //- rjf: gather unsorted child expansion keys - // - // Nodes are sorted in the underlying expansion tree data structure, but - // ONLY by THEIR ORDER IN THE UNDERLYING DEBUG INFO TABLE. This is - // because debug info watch rows use the DEBUG INFO TABLE INDEX to form - // their key - this provides more stable/predictable behavior as rows - // are reordered, filtered, and shuffled around, as the user filters. - // - // When we actually build viz blocks, however, we want to produce viz - // blocks BY THE ORDER OF SUB-EXPANSIONS IN THE FILTERED ITEM ARRAY - // SPACE, so that all of the expansions come out in the right order. - // - EV_Key *sub_expand_keys = 0; - U64 *sub_expand_item_idxs = 0; - U64 sub_expand_keys_count = 0; - { - for(EV_ExpandNode *child = root_node->first; child != 0; child = child->next) - { - sub_expand_keys_count += 1; - } - sub_expand_keys = push_array(scratch.arena, EV_Key, sub_expand_keys_count); - sub_expand_item_idxs = push_array(scratch.arena, U64, sub_expand_keys_count); - U64 idx = 0; - for(EV_ExpandNode *child = root_node->first; child != 0; child = child->next) - { - U64 item_num = fzy_item_num_from_array_element_idx__linear_search(&items, child->key.child_num); - if(item_num != 0) - { - sub_expand_keys[idx] = child->key; - sub_expand_item_idxs[idx] = item_num-1; - idx += 1; - } - else - { - sub_expand_keys_count -= 1; - } - } - } - - //- rjf: sort child expansion keys - { - for(U64 idx1 = 0; idx1 < sub_expand_keys_count; idx1 += 1) - { - U64 min_idx2 = 0; - U64 min_item_idx = sub_expand_item_idxs[idx1]; - for(U64 idx2 = idx1+1; idx2 < sub_expand_keys_count; idx2 += 1) - { - if(sub_expand_item_idxs[idx2] < min_item_idx) - { - min_idx2 = idx2; - min_item_idx = sub_expand_item_idxs[idx2]; - } - } - if(min_idx2 != 0) - { - Swap(EV_Key, sub_expand_keys[idx1], sub_expand_keys[min_idx2]); - Swap(U64, sub_expand_item_idxs[idx1], sub_expand_item_idxs[min_idx2]); - } - } - } - - //- rjf: build blocks for all table items, split by sorted sub-expansions - EV_Block *last_vb = ev_block_begin(scratch.arena, EV_BlockKind_DebugInfoTable, parent_key, root_key, 0); - { - last_vb->visual_idx_range = last_vb->semantic_idx_range = r1u64(0, items.count); - last_vb->fzy_target = fzy_target; - last_vb->fzy_backing_items = items; - } - for(U64 sub_expand_idx = 0; sub_expand_idx < sub_expand_keys_count; sub_expand_idx += 1) - { - FZY_Item *item = &items.v[sub_expand_item_idxs[sub_expand_idx]]; - E_Expr *child_expr = ev_expr_from_block_index(scratch.arena, last_vb, sub_expand_item_idxs[sub_expand_idx]); - - // rjf: form split: truncate & complete last block; begin next block - last_vb = ev_block_split_and_continue(scratch.arena, &blocks, last_vb, sub_expand_item_idxs[sub_expand_idx]); - - // rjf: build child view rules - EV_ViewRuleList *child_view_rules = ev_view_rule_list_from_inheritance(scratch.arena, &top_level_view_rules); - { - String8 view_rule_string = ev_view_rule_from_key(eval_view, sub_expand_keys[sub_expand_idx]); - if(view_rule_string.size != 0) - { - ev_view_rule_list_push_string(scratch.arena, child_view_rules, view_rule_string); - } - } - - // rjf: recurse for child - ev_append_expr_blocks__rec(scratch.arena, eval_view, str8_zero(), parent_key, sub_expand_keys[sub_expand_idx], str8_zero(), child_expr, child_view_rules, 0, &blocks); - } - ev_block_end(&blocks, last_vb); - }break; - } -#endif } ////////////////////////// @@ -4726,336 +4370,6 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(symbol_lister) ProfEnd(); } -//////////////////////////////// -//~ rjf: target @view_hook_impl - -#if 0 -typedef struct RD_TargetViewState RD_TargetViewState; -struct RD_TargetViewState -{ - B32 initialized; - - // rjf: pick file kind - RD_EntityKind pick_dst_kind; - - // rjf: selection cursor - Vec2S64 cursor; - - // rjf: text input state - TxtPt input_cursor; - TxtPt input_mark; - U8 input_buffer[1024]; - U64 input_size; - B32 input_editing; - - // rjf: table column pcts - F32 key_pct; - F32 value_pct; -}; - -RD_VIEW_RULE_UI_FUNCTION_DEF(target) -{ - ProfBeginFunction(); - Temp scratch = scratch_begin(0, 0); -#if 0 // TODO(rjf): @msgs - RD_Entity *entity = rd_entity_from_eval_string(string); - RD_EntityList custom_entry_points = rd_push_entity_child_list_with_kind(scratch.arena, entity, RD_EntityKind_EntryPoint); - F32 row_height_px = floor_f32(ui_top_font_size()*2.5f); - - RD_TargetViewState *tv = rd_view_state(RD_TargetViewState); - RD_Entity *entity = rd_entity_from_eval_string(string); - // rjf: process commands - for(RD_Cmd *cmd = 0; rd_next_cmd(&cmd);) - { - // rjf: mismatched window/panel => skip - if(!rd_handle_match(rd_regs()->view, cmd->regs->view)) - { - continue; - } - - // rjf: process command - RD_CmdKind kind = rd_cmd_kind_from_string(cmd->spec->info.string); - switch(kind) - { - default:break; - case RD_CmdKind_PickFile: - case RD_CmdKind_PickFolder: - { - String8 pick_string = cmd->params.file_path; - RD_Entity *storage_entity = entity; - if(tv->pick_dst_kind != RD_EntityKind_Nil) - { - RD_Entity *child = rd_entity_child_from_kind(entity, tv->pick_dst_kind); - if(rd_entity_is_nil(child)) - { - child = rd_entity_alloc(entity, tv->pick_dst_kind); - } - storage_entity = child; - } - rd_entity_equip_name(storage_entity, pick_string); - }break; - } - } - - //- rjf: grab state - RD_TargetViewState *tv = rd_view_state(RD_TargetViewState); - if(tv->initialized == 0) - { - tv->initialized = 1; - tv->key_pct = 0.2f; - tv->value_pct = 0.8f; - } - - //- rjf: set up key-value-pair info - struct - { - B32 fill_with_file; - B32 fill_with_folder; - B32 use_code_font; - String8 key; - RD_EntityKind storage_child_kind; - String8 current_text; - } - kv_info[] = - { - { 0, 0, 0, str8_lit("Label"), RD_EntityKind_Nil, entity->string }, - { 1, 0, 0, str8_lit("Executable"), RD_EntityKind_Executable, rd_entity_child_from_kind(entity, RD_EntityKind_Executable)->string }, - { 0, 0, 0, str8_lit("Arguments"), RD_EntityKind_Arguments, rd_entity_child_from_kind(entity, RD_EntityKind_Arguments)->string }, - { 0, 1, 0, str8_lit("Working Directory"), RD_EntityKind_WorkingDirectory, rd_entity_child_from_kind(entity, RD_EntityKind_WorkingDirectory)->string }, - { 0, 0, 1, str8_lit("Entry Point Override"), RD_EntityKind_EntryPoint, rd_entity_child_from_kind(entity, RD_EntityKind_EntryPoint)->string }, - }; - - //- rjf: take controls to start/end editing - B32 edit_begin = 0; - B32 edit_end = 0; - B32 edit_commit = 0; - B32 edit_submit = 0; - UI_Focus(UI_FocusKind_On) if(ui_is_focus_active()) - { - if(!tv->input_editing) - { - for(UI_Event *evt = 0; ui_next_event(&evt);) - { - if(evt->string.size != 0 || evt->flags & UI_EventFlag_Paste) - { - edit_begin = 1; - break; - } - } - if(ui_slot_press(UI_EventActionSlot_Edit)) - { - edit_begin = 1; - } - if(ui_slot_press(UI_EventActionSlot_Accept)) - { - edit_begin = 1; - } - } - if(tv->input_editing) - { - if(ui_slot_press(UI_EventActionSlot_Cancel)) - { - edit_end = 1; - edit_commit = 0; - } - if(ui_slot_press(UI_EventActionSlot_Accept)) - { - edit_end = 1; - edit_commit = 1; - edit_submit = 1; - } - } - } - - //- rjf: build - Rng1S64 visible_row_range = {0}; - UI_ScrollListParams scroll_list_params = {0}; - { - scroll_list_params.flags = UI_ScrollListFlag_All; - scroll_list_params.row_height_px = row_height_px; - scroll_list_params.dim_px = dim_2f32(rect); - scroll_list_params.cursor_range = r2s64(v2s64(0, 0), v2s64(0, (S64)ArrayCount(kv_info))); - scroll_list_params.item_range = r1s64(0, (S64)ArrayCount(kv_info)); - scroll_list_params.cursor_min_is_empty_selection[Axis2_Y] = 1; - } - RD_EntityKind commit_storage_child_kind = RD_EntityKind_Nil; - Vec2S64 next_cursor = tv->cursor; - UI_ScrollListSignal scroll_list_sig = {0}; - UI_Focus(UI_FocusKind_On) - UI_ScrollList(&scroll_list_params, - &scroll_pos.y, - tv->input_editing ? 0 : &tv->cursor, - 0, - &visible_row_range, - &scroll_list_sig) - UI_Focus(UI_FocusKind_Null) - { - next_cursor = tv->cursor; - F32 *col_pcts[] = {&tv->key_pct, &tv->value_pct}; - UI_TableF(ArrayCount(col_pcts), col_pcts, "###target_%p", view) - { - //- rjf: build fixed rows - S64 row_idx = 0; - for(S64 idx = visible_row_range.min; - idx <= visible_row_range.max && idx < ArrayCount(kv_info); - idx += 1, row_idx += 1) - UI_TableVector - { - B32 row_selected = (tv->cursor.y == idx+1); - B32 has_browse = kv_info[idx].fill_with_file || kv_info[idx].fill_with_folder; - - //- rjf: key (label) - UI_TableCell UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) - { - if(kv_info[idx].storage_child_kind == RD_EntityKind_EntryPoint) - { - if(rd_help_label(str8_lit("Custom Entry Point"))) UI_Tooltip - { - ui_label_multiline(ui_top_font_size()*30.f, str8_lit("By default, the debugger attempts to find a target's entry point with a set of default names, such as:")); - ui_spacer(ui_em(1.5f, 1.f)); - RD_Font(RD_FontSlot_Code) UI_Palette(ui_build_palette(ui_top_palette(), .text = rd_rgba_from_theme_color(RD_ThemeColor_CodeSymbol))) - { - ui_label(str8_lit("WinMain")); - ui_label(str8_lit("wWinMain")); - ui_label(str8_lit("main")); - ui_label(str8_lit("wmain")); - ui_label(str8_lit("WinMainCRTStartup")); - ui_label(str8_lit("wWinMainCRTStartup")); - } - ui_spacer(ui_em(1.5f, 1.f)); - ui_label_multiline(ui_top_font_size()*30.f, str8_lit("A Custom Entry Point can be used to override these default symbol names with a symbol name of your choosing. If a symbol matching the Custom Entry Point is not found, the debugger will fall back to its default rules.")); - } - } - else - { - ui_build_box_from_string(UI_BoxFlag_Clickable|UI_BoxFlag_DrawText, kv_info[idx].key); - } - } - - //- rjf: value - UI_TableCell - { - // rjf: value editor - UI_WidthFill RD_Font(kv_info[idx].use_code_font ? RD_FontSlot_Code : RD_FontSlot_Main) - { - // rjf: * => focus - B32 value_selected = row_selected && (next_cursor.x == 0 || !has_browse); - - // rjf: begin editing - if(value_selected && edit_begin) - { - tv->input_editing = 1; - tv->input_size = Min(sizeof(tv->input_buffer), kv_info[idx].current_text.size); - MemoryCopy(tv->input_buffer, kv_info[idx].current_text.str, tv->input_size); - tv->input_cursor = txt_pt(1, 1+tv->input_size); - tv->input_mark = txt_pt(1, 1); - } - - // rjf: build main editor ui - UI_Signal sig = {0}; - UI_FocusHot(value_selected ? UI_FocusKind_On : UI_FocusKind_Off) - UI_FocusActive((value_selected && tv->input_editing) ? UI_FocusKind_On : UI_FocusKind_Off) - { - sig = rd_line_editf(RD_LineEditFlag_NoBackground, 0, 0, &tv->input_cursor, &tv->input_mark, tv->input_buffer, sizeof(tv->input_buffer), &tv->input_size, 0, kv_info[idx].current_text, "###kv_editor_%i", (S32)idx); - edit_commit = edit_commit || ui_committed(sig); - } - - // rjf: focus panel on press - if(ui_pressed(sig)) - { - rd_cmd(RD_CmdKind_FocusPanel); - } - - // rjf: begin editing on double-click - if(!tv->input_editing && ui_double_clicked(sig)) - { - ui_kill_action(); - tv->input_editing = 1; - tv->input_size = Min(sizeof(tv->input_buffer), kv_info[idx].current_text.size); - MemoryCopy(tv->input_buffer, kv_info[idx].current_text.str, tv->input_size); - tv->input_cursor = txt_pt(1, 1+tv->input_size); - tv->input_mark = txt_pt(1, 1); - } - - // rjf: press on non-selected => commit edit, change selected cell - if(ui_pressed(sig) && !value_selected) - { - edit_end = 1; - edit_commit = tv->input_editing; - next_cursor = v2s64(0, idx+1); - } - - // rjf: apply commit deltas - if(ui_committed(sig)) - { - next_cursor.y += 1; - } - - // rjf: grab commit destination - if(value_selected) - { - commit_storage_child_kind = kv_info[idx].storage_child_kind; - } - } - - // rjf: browse button to fill text field - if(has_browse) UI_PrefWidth(ui_text_dim(10, 1)) - { - UI_FocusHot((row_selected && next_cursor.x == 1) ? UI_FocusKind_On : UI_FocusKind_Off) - UI_TextAlignment(UI_TextAlign_Center) - if(ui_clicked(ui_buttonf("Browse..."))) - { - RD_CmdKind cmd_kind = kv_info[idx].fill_with_file ? RD_CmdKind_PickFile : RD_CmdKind_PickFolder; - rd_cmd(RD_CmdKind_RunCommand, .string = rd_cmd_kind_info_table[cmd_kind].string); - tv->pick_dst_kind = kv_info[idx].storage_child_kind; - } - } - } - } - } - } - - //- rjf: apply commit - if(edit_commit) - { - String8 new_string = str8(tv->input_buffer, tv->input_size); - switch(commit_storage_child_kind) - { - default: - { - RD_Entity *child = rd_entity_child_from_kind(entity, commit_storage_child_kind); - if(rd_entity_is_nil(child)) - { - child = rd_entity_alloc(entity, commit_storage_child_kind); - } - rd_entity_equip_name(child, new_string); - }break; - case RD_EntityKind_Nil: - { - rd_entity_equip_name(entity, new_string); - }break; - } - } - - //- rjf: apply editing finish - if(edit_end) - { - tv->input_editing = 0; - } - if(edit_submit) - { - next_cursor.y += 1; - } - - //- rjf: apply moves to selection - tv->cursor = next_cursor; - -#endif - scratch_end(scratch); - ProfEnd(); -} -#endif - //////////////////////////////// //~ rjf: targets @view_hook_impl @@ -5077,157 +4391,6 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(targets) ProfEnd(); } -#if 0 // TODO(rjf): @msgs -RD_VIEW_RULE_UI_FUNCTION_DEF(targets) -{ - ProfBeginFunction(); - Temp scratch = scratch_begin(0, 0); - RD_EntityList targets_list = rd_query_cached_entity_list_with_kind(RD_EntityKind_Target); - RD_EntityFuzzyItemArray targets = rd_entity_fuzzy_item_array_from_entity_list_needle(scratch.arena, &targets_list, string); - F32 row_height_px = floor_f32(ui_top_font_size()*2.5f); - - //- rjf: grab state - typedef struct RD_TargetsViewState RD_TargetsViewState; - struct RD_TargetsViewState - { - B32 selected_add; - RD_Handle selected_target_handle; - S64 selected_column; - }; - UI_ScrollPt2 scroll_pos = rd_view_scroll_pos(); - RD_TargetsViewState *tv = rd_view_state(RD_TargetsViewState); - - //- rjf: determine table bounds - Vec2S64 table_bounds = {5, (S64)targets.count+1}; - - //- rjf: selection state => cursor - // NOTE(rjf): 0 => nothing, 1 => add new, 2 => first target - Vec2S64 cursor = {0}; - { - RD_Entity *selected_target = rd_entity_from_handle(tv->selected_target_handle); - for(U64 idx = 0; idx < targets.count; idx += 1) - { - if(selected_target == targets.v[idx].entity) - { - cursor.y = (S64)idx+2; - break; - } - } - if(tv->selected_add) - { - cursor.y = 1; - } - cursor.x = tv->selected_column; - } - - //- rjf: build - Rng1S64 visible_row_range = {0}; - UI_ScrollListParams scroll_list_params = {0}; - { - scroll_list_params.flags = UI_ScrollListFlag_All; - scroll_list_params.row_height_px = row_height_px; - scroll_list_params.dim_px = dim_2f32(rect); - scroll_list_params.cursor_range = r2s64(v2s64(0, 0), v2s64(5, Max(0, (S64)targets.count+1))); - scroll_list_params.item_range = r1s64(0, Max(0, (S64)targets.count+1)); - scroll_list_params.cursor_min_is_empty_selection[Axis2_Y] = 1; - } - UI_ScrollListSignal scroll_list_sig = {0}; - UI_Focus(UI_FocusKind_On) - UI_ScrollList(&scroll_list_params, - &scroll_pos.y, - &cursor, - 0, - &visible_row_range, - &scroll_list_sig) - UI_Focus(UI_FocusKind_Null) - { - // rjf: add new ctrl - if(visible_row_range.min == 0) - { - UI_Signal add_sig = {0}; - UI_FocusHot(cursor.y == 1 ? UI_FocusKind_On : UI_FocusKind_Off) - add_sig = rd_icon_buttonf(RD_IconKind_Add, 0, "Add New Target"); - if(ui_clicked(add_sig)) - { - rd_cmd(RD_CmdKind_RunCommand, .string = rd_cmd_kind_info_table[RD_CmdKind_AddTarget].string); - } - } - - // rjf: target rows - for(S64 row_idx = Max(1, visible_row_range.min); - row_idx <= visible_row_range.max && row_idx <= targets.count; - row_idx += 1) - UI_Row - { - RD_Entity *target = targets.v[row_idx-1].entity; - B32 row_selected = ((U64)cursor.y == row_idx+1); - - // rjf: enabled - UI_PrefWidth(ui_em(2.25f, 1)) - UI_FocusHot((row_selected && cursor.x == 0) ? UI_FocusKind_On : UI_FocusKind_Off) - { - UI_Signal sig = rd_icon_buttonf(!target->disabled ? RD_IconKind_CheckFilled : RD_IconKind_CheckHollow, 0, "###ebl_%p", target); - if(ui_clicked(sig)) - { - rd_cmd(!target->disabled ? RD_CmdKind_DisableTarget : RD_CmdKind_EnableTarget, .entity = rd_handle_from_entity(target)); - } - } - - // rjf: target name - UI_WidthFill UI_FocusHot((row_selected && cursor.x == 1) ? UI_FocusKind_On : UI_FocusKind_Off) - { - rd_entity_desc_button(target, &targets.v[row_idx-1].matches, string, 0); - } - - // rjf: controls - UI_PrefWidth(ui_em(2.25f, 1.f)) - { - struct - { - RD_IconKind icon; - String8 text; - RD_CmdKind cmd; - } - ctrls[] = - { - { RD_IconKind_PlayStepForward, str8_lit("Launch and Initialize"), RD_CmdKind_LaunchAndInit }, - { RD_IconKind_Play, str8_lit("Launch and Run"), RD_CmdKind_LaunchAndRun }, - { RD_IconKind_Pencil, str8_lit("Edit"), RD_CmdKind_Target }, - { RD_IconKind_Trash, str8_lit("Delete"), RD_CmdKind_RemoveTarget }, - }; - for(U64 ctrl_idx = 0; ctrl_idx < ArrayCount(ctrls); ctrl_idx += 1) - { - UI_Signal sig = {0}; - UI_FocusHot((row_selected && cursor.x == 2+ctrl_idx) ? UI_FocusKind_On : UI_FocusKind_Off) - { - sig = rd_icon_buttonf(ctrls[ctrl_idx].icon, 0, "###%p_ctrl_%i", target, (int)ctrl_idx); - } - if(ui_hovering(sig)) UI_Tooltip - { - ui_label(ctrls[ctrl_idx].text); - } - if(ui_clicked(sig)) - { - rd_cmd(ctrls[ctrl_idx].cmd, .entity = rd_handle_from_entity(target)); - } - } - } - } - } - - //- rjf: commit cursor to selection state - { - tv->selected_column = cursor.x; - tv->selected_target_handle = (1 < cursor.y && cursor.y < targets.count+2) ? rd_handle_from_entity(targets.v[cursor.y-2].entity) : rd_handle_zero(); - tv->selected_add = (cursor.y == 1); - } - - rd_store_view_scroll_pos(scroll_pos); - scratch_end(scratch); - ProfEnd(); -} -#endif - //////////////////////////////// //~ rjf: file_path_map @view_hook_impl @@ -5882,332 +5045,6 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(modules) ProfEnd(); } -#if 0 // TODO(rjf): @msgs -typedef struct RD_ModulesViewState RD_ModulesViewState; -struct RD_ModulesViewState -{ - B32 initialized; - RD_Handle selected_entity; - S64 selected_column; - B32 txt_editing; - TxtPt txt_cursor; - TxtPt txt_mark; - U8 txt_buffer[1024]; - U64 txt_size; - RD_Handle pick_file_dst_entity; - F32 idx_col_pct; - F32 desc_col_pct; - F32 range_col_pct; - F32 dbg_col_pct; -}; - -RD_VIEW_RULE_UI_FUNCTION_DEF(modules) -{ - RD_ModulesViewState *mv = rd_view_state(RD_ModulesViewState); - if(mv->initialized == 0) - { - mv->initialized = 1; - mv->idx_col_pct = 0.05f; - mv->desc_col_pct = 0.15f; - mv->range_col_pct = 0.30f; - mv->dbg_col_pct = 0.50f; - } - RD_ModulesViewState *mv = rd_view_state(RD_ModulesViewState); - for(RD_Cmd *cmd = 0; rd_next_cmd(&cmd);) - { - // rjf: mismatched window/panel => skip - if(!rd_handle_match(rd_regs()->view, cmd->regs->view)) - { - continue; - } - - //rjf: process - RD_CmdKind kind = rd_cmd_kind_from_string(cmd->name); - switch(kind) - { - default:break; - case RD_CmdKind_PickFile: - { - Temp scratch = scratch_begin(0, 0); - String8 pick_string = cmd->regs->file_path; - RD_Entity *module = rd_entity_from_handle(mv->pick_file_dst_entity); - if(module->kind == RD_EntityKind_Module) - { - String8 exe_path = module->string; - String8 dbg_path = pick_string; - // TODO(rjf) - } - scratch_end(scratch); - }break; - } - } - ProfBeginFunction(); - Temp scratch = scratch_begin(0, 0); - DI_Scope *scope = di_scope_open(); - String8 query = str8(view->query_buffer, view->query_string_size); - - //- rjf: get state - RD_ModulesViewState *mv = rd_view_state(RD_ModulesViewState); - F32 *col_pcts[] = {&mv->idx_col_pct, &mv->desc_col_pct, &mv->range_col_pct, &mv->dbg_col_pct}; - - //- rjf: get entities - RD_EntityList processes = rd_query_cached_entity_list_with_kind(RD_EntityKind_Process); - RD_EntityList modules = rd_query_cached_entity_list_with_kind(RD_EntityKind_Module); - - //- rjf: make filtered item array - RD_EntityFuzzyItemArray items = {0}; - if(query.size == 0) - { - RD_EntityArray entities = {0}; - { - entities.count = processes.count+modules.count; - entities.v = push_array_no_zero(scratch.arena, RD_Entity *, entities.count); - U64 idx = 0; - for(RD_EntityNode *process_n = processes.first; process_n != 0; process_n = process_n->next) - { - RD_Entity *process = process_n->entity; - entities.v[idx] = process; - idx += 1; - for(RD_EntityNode *module_n = modules.first; module_n != 0; module_n = module_n->next) - { - RD_Entity *module = module_n->entity; - if(rd_entity_ancestor_from_kind(module, RD_EntityKind_Process) != process) - { - continue; - } - entities.v[idx] = module; - idx += 1; - } - } - } - items = rd_entity_fuzzy_item_array_from_entity_array_needle(scratch.arena, &entities, query); - } - else - { - items = rd_entity_fuzzy_item_array_from_entity_list_needle(scratch.arena, &modules, query); - } - - //- rjf: selected column/entity -> selected cursor - Vec2S64 cursor = {mv->selected_column}; - for(U64 idx = 0; idx < items.count; idx += 1) - { - if(items.v[idx].entity == rd_entity_from_handle(mv->selected_entity)) - { - cursor.y = (S64)(idx+1); - break; - } - } - - ////////////////////////////// - //- rjf: do start/end editing interaction - // - B32 edit_begin = 0; - B32 edit_commit = 0; - B32 edit_end = 0; - B32 edit_submit = 0; - if(!mv->txt_editing && ui_is_focus_active()) - { - for(UI_Event *evt = 0; ui_next_event(&evt);) - { - if(evt->string.size != 0 || evt->flags & UI_EventFlag_Paste) - { - edit_begin = 1; - break; - } - } - if(ui_slot_press(UI_EventActionSlot_Edit)) - { - edit_begin = 1; - } - } - if(mv->txt_editing && ui_is_focus_active()) - { - if(ui_slot_press(UI_EventActionSlot_Cancel)) - { - edit_end = 1; - edit_commit = 0; - } - if(ui_slot_press(UI_EventActionSlot_Accept)) - { - edit_end = 1; - edit_commit = 1; - edit_submit = 1; - } - } - - //- rjf: build table - RD_Entity *commit_module = &d_nil_entity; - Rng1S64 visible_row_range = {0}; - UI_ScrollListParams scroll_list_params = {0}; - { - scroll_list_params.flags = UI_ScrollListFlag_All; - scroll_list_params.row_height_px = floor_f32(ui_top_font_size()*2.5f); - scroll_list_params.dim_px = dim_2f32(rect); - scroll_list_params.cursor_range = r2s64(v2s64(0, 0), v2s64(3, items.count)); - scroll_list_params.item_range = r1s64(0, items.count); - scroll_list_params.cursor_min_is_empty_selection[Axis2_Y] = 1; - } - UI_ScrollListSignal scroll_list_sig = {0}; - UI_Focus(UI_FocusKind_On) - UI_ScrollList(&scroll_list_params, - &scroll_pos.y, - mv->txt_editing ? 0 : &cursor, - 0, - &visible_row_range, - &scroll_list_sig) - UI_Focus(UI_FocusKind_Null) - UI_TableF(ArrayCount(col_pcts), col_pcts, "modules_table") - { - Vec2S64 next_cursor = cursor; - U64 idx_in_process = 0; - for(U64 idx = 0; idx < items.count; idx += 1) - { - RD_Entity *entity = items.v[idx].entity; - B32 row_is_selected = (cursor.y == (S64)(idx+1)); - idx_in_process += (entity->kind == RD_EntityKind_Module); - if(visible_row_range.min <= idx && idx <= visible_row_range.max) - { - switch(entity->kind) - { - default:{}break; - case RD_EntityKind_Process: - { - UI_NamedTableVectorF("process_%p", entity) - { - UI_TableCellSized(ui_pct(1, 0)) UI_FocusHot((row_is_selected) ? UI_FocusKind_On : UI_FocusKind_Off) - { - rd_entity_desc_button(entity, &items.v[idx].matches, query, 0); - } - } - idx_in_process = 0; - }break; - case RD_EntityKind_Module: - UI_NamedTableVectorF("module_%p", entity) - { - UI_TableCell UI_TextAlignment(UI_TextAlign_Center) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) - { - ui_labelf("%I64u", idx_in_process); - } - UI_TableCell UI_FocusHot((row_is_selected && cursor.x == 0) ? UI_FocusKind_On : UI_FocusKind_Off) - { - rd_entity_desc_button(entity, &items.v[idx].matches, query, 1); - } - UI_TableCell RD_Font(RD_FontSlot_Code) UI_FocusHot((row_is_selected && cursor.x == 1) ? UI_FocusKind_On : UI_FocusKind_Off) - { - UI_Box *range_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable|UI_BoxFlag_DrawText, "[0x%I64x, 0x%I64x)###vaddr_range_%p", entity->vaddr_rng.min, entity->vaddr_rng.max, entity); - UI_Signal sig = ui_signal_from_box(range_box); - if(ui_pressed(sig)) - { - next_cursor = v2s64(1, (S64)idx+1); - rd_cmd(RD_CmdKind_FocusPanel); - } - } - UI_TableCell - { - B32 txt_is_selected = (row_is_selected && cursor.x == 2); - B32 brw_is_selected = (row_is_selected && cursor.x == 3); - - // rjf: unpack module info - DI_Key dbgi_key = d_dbgi_key_from_module(entity); - String8 dbgi_path = dbgi_key.path; - RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 0); - B32 dbgi_is_valid = (rdi != &di_rdi_parsed_nil); - - // rjf: begin editing - if(txt_is_selected && edit_begin) - { - mv->txt_editing = 1; - mv->txt_size = Min(sizeof(mv->txt_buffer), dbgi_path.size); - MemoryCopy(mv->txt_buffer, dbgi_path.str, mv->txt_size); - mv->txt_cursor = txt_pt(1, 1+mv->txt_size); - mv->txt_mark = txt_pt(1, 1); - } - - // rjf: build - UI_Signal sig = {0}; - UI_FocusHot(txt_is_selected ? UI_FocusKind_On : UI_FocusKind_Off) - UI_FocusActive((txt_is_selected && mv->txt_editing) ? UI_FocusKind_On : UI_FocusKind_Off) - UI_WidthFill - { - UI_Palette(dbgi_is_valid ? ui_top_palette() : ui_build_palette(ui_top_palette(), .text = rd_rgba_from_theme_color(RD_ThemeColor_TextNegative))) - sig = rd_line_editf(RD_LineEditFlag_NoBackground, 0, 0, &mv->txt_cursor, &mv->txt_mark, mv->txt_buffer, sizeof(mv->txt_buffer), &mv->txt_size, 0, dbgi_path, "###dbg_path_%p", entity); - edit_commit = (edit_commit || ui_committed(sig)); - } - - // rjf: press -> focus - if(ui_pressed(sig)) - { - edit_commit = (mv->txt_editing && !txt_is_selected); - next_cursor = v2s64(2, (S64)idx+1); - rd_cmd(RD_CmdKind_FocusPanel); - } - - // rjf: double-click -> begin editing - if(ui_double_clicked(sig) && !mv->txt_editing) - { - ui_kill_action(); - mv->txt_editing = 1; - mv->txt_size = Min(sizeof(mv->txt_buffer), dbgi_path.size); - MemoryCopy(mv->txt_buffer, dbgi_path.str, mv->txt_size); - mv->txt_cursor = txt_pt(1, 1+mv->txt_size); - mv->txt_mark = txt_pt(1, 1); - } - - // rjf: store commit info - if(txt_is_selected && edit_commit) - { - commit_module = entity; - } - - // rjf: build browse button - UI_FocusHot(brw_is_selected ? UI_FocusKind_On : UI_FocusKind_Off) UI_PrefWidth(ui_text_dim(10, 1)) - { - if(ui_clicked(ui_buttonf("Browse...")) || (brw_is_selected && edit_begin)) - { - rd_cmd(RD_CmdKind_RunCommand, .string = rd_cmd_kind_info_table[RD_CmdKind_PickFile].string); - mv->pick_file_dst_entity = rd_handle_from_entity(entity); - } - } - } - }break; - } - } - } - cursor = next_cursor; - } - - //- rjf: apply commits - if(edit_commit) - { - mv->txt_editing = 0; - if(!rd_entity_is_nil(commit_module)) - { - String8 exe_path = commit_module->string; - String8 dbg_path = str8(mv->txt_buffer, mv->txt_size); - // TODO(rjf) - } - if(edit_submit) - { - cursor.y += 1; - } - } - - //- rjf: apply edit state changes - if(edit_end) - { - mv->txt_editing = 0; - } - - //- rjf: selected num -> selected entity - mv->selected_column = cursor.x; - mv->selected_entity = (1 <= cursor.y && cursor.y <= items.count) ? rd_handle_from_entity(items.v[cursor.y-1].entity) : rd_handle_zero(); - - di_scope_close(scope); - scratch_end(scratch); - ProfEnd(); -} -#endif - //////////////////////////////// //~ rjf: watch @view_hook_impl diff --git a/src/raddbg/raddbg_widgets.c b/src/raddbg/raddbg_widgets.c index 1f85b975..05ccac72 100644 --- a/src/raddbg/raddbg_widgets.c +++ b/src/raddbg/raddbg_widgets.c @@ -741,7 +741,7 @@ rd_entity_desc_button(RD_Entity *entity, FuzzyMatchRangeList *name_matches, Stri // rjf: click => fastpath for this entity if(ui_clicked(sig)) { - rd_cmd(RD_CmdKind_EntityRefFastPath, .entity = rd_handle_from_entity(entity)); + // TODO(rjf): rd_cmd(RD_CmdKind_EntityRefFastPath, .entity = rd_handle_from_entity(entity)); } // rjf: right-click => context menu for this entity @@ -1362,7 +1362,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe // rjf: click => remove breakpoint if(ui_clicked(bp_sig)) { - rd_cmd(RD_CmdKind_RemoveBreakpoint, .entity = rd_handle_from_entity(bp)); + rd_cmd(RD_CmdKind_RemoveEntity, .entity = rd_handle_from_entity(bp)); } // rjf: drag start