mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
switch reg cmd name parameterization from using general string slot, to its own dedicated slot, so that the string can be used
This commit is contained in:
@@ -206,7 +206,7 @@ RD_EntityKindFlags rd_entity_kind_flags_table[30] =
|
||||
(0*RD_EntityKindFlag_CanDelete) | (0*RD_EntityKindFlag_CanFreeze) | (0*RD_EntityKindFlag_CanEdit) | (1*RD_EntityKindFlag_CanRename) | (0*RD_EntityKindFlag_CanEnable) | (0*RD_EntityKindFlag_CanCondition) | (0*RD_EntityKindFlag_CanDuplicate) | (0*RD_EntityKindFlag_NameIsCode) | (0*RD_EntityKindFlag_NameIsPath) | (0*RD_EntityKindFlag_UserDefinedLifetime) | (0*RD_EntityKindFlag_IsSerializedToConfig),
|
||||
};
|
||||
|
||||
Rng1U64 rd_reg_slot_range_table[33] =
|
||||
Rng1U64 rd_reg_slot_range_table[34] =
|
||||
{
|
||||
{0},
|
||||
{OffsetOf(RD_Regs, machine), OffsetOf(RD_Regs, machine) + sizeof(CTRL_Handle)},
|
||||
@@ -239,6 +239,7 @@ Rng1U64 rd_reg_slot_range_table[33] =
|
||||
{OffsetOf(RD_Regs, prefer_disasm), OffsetOf(RD_Regs, prefer_disasm) + sizeof(B32)},
|
||||
{OffsetOf(RD_Regs, dir2), OffsetOf(RD_Regs, dir2) + sizeof(Dir2)},
|
||||
{OffsetOf(RD_Regs, string), OffsetOf(RD_Regs, string) + sizeof(String8)},
|
||||
{OffsetOf(RD_Regs, cmd_name), OffsetOf(RD_Regs, cmd_name) + sizeof(String8)},
|
||||
{OffsetOf(RD_Regs, params_tree), OffsetOf(RD_Regs, params_tree) + sizeof(MD_Node *)},
|
||||
{OffsetOf(RD_Regs, os_event), OffsetOf(RD_Regs, os_event) + sizeof(OS_Event *)},
|
||||
};
|
||||
@@ -280,7 +281,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[215] =
|
||||
{ str8_lit_comp("set_entity_name"), str8_lit_comp("Sets the passed entity's name."), str8_lit_comp(""), str8_lit_comp("Set Entity Name"), 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("attach"), str8_lit_comp("Attaches to a process that is already running on the local machine."), str8_lit_comp(""), str8_lit_comp("Attach"), 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*1), RD_RegSlot_PID, str8_lit_comp(""), RD_EntityKind_Nil}},
|
||||
{ str8_lit_comp("exit"), str8_lit_comp("Exits the debugger."), str8_lit_comp("quit,close,abort"), str8_lit_comp("Exit"), RD_IconKind_X, (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("run_command"), str8_lit_comp("Runs a command from the command palette."), str8_lit_comp("help,cmd"), str8_lit_comp("Run Command"), 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*1), RD_RegSlot_String, str8_lit_comp("commands"), RD_EntityKind_Nil}},
|
||||
{ str8_lit_comp("run_command"), str8_lit_comp("Runs a command from the command palette."), str8_lit_comp("help,cmd"), str8_lit_comp("Run Command"), 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*1), RD_RegSlot_CmdName, str8_lit_comp("commands"), RD_EntityKind_Nil}},
|
||||
{ str8_lit_comp("os_event"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("OS Event"), 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("select_thread"), str8_lit_comp("Selects a thread."), str8_lit_comp(""), str8_lit_comp("Select Thread"), 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*1), RD_RegSlot_Entity, str8_lit_comp(""), RD_EntityKind_Thread}},
|
||||
{ str8_lit_comp("select_unwind"), str8_lit_comp("Selects an unwind frame number for the selected thread."), str8_lit_comp(""), str8_lit_comp("Select Unwind"), RD_IconKind_Null, (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*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
|
||||
|
||||
@@ -83,6 +83,7 @@ RD_RegSlot_ForceConfirm,
|
||||
RD_RegSlot_PreferDisasm,
|
||||
RD_RegSlot_Dir2,
|
||||
RD_RegSlot_String,
|
||||
RD_RegSlot_CmdName,
|
||||
RD_RegSlot_ParamsTree,
|
||||
RD_RegSlot_OSEvent,
|
||||
RD_RegSlot_COUNT,
|
||||
@@ -573,6 +574,7 @@ B32 force_confirm;
|
||||
B32 prefer_disasm;
|
||||
Dir2 dir2;
|
||||
String8 string;
|
||||
String8 cmd_name;
|
||||
MD_Node * params_tree;
|
||||
OS_Event * os_event;
|
||||
};
|
||||
@@ -642,6 +644,7 @@ RD_ViewRuleUIFunctionType *ui;
|
||||
.prefer_disasm = rd_regs()->prefer_disasm,\
|
||||
.dir2 = rd_regs()->dir2,\
|
||||
.string = rd_regs()->string,\
|
||||
.cmd_name = rd_regs()->cmd_name,\
|
||||
.params_tree = rd_regs()->params_tree,\
|
||||
.os_event = rd_regs()->os_event,\
|
||||
|
||||
@@ -743,7 +746,7 @@ extern String8 d_entity_kind_name_lower_table[30];
|
||||
extern String8 d_entity_kind_name_lower_plural_table[30];
|
||||
extern String8 d_entity_kind_name_label_table[30];
|
||||
extern RD_EntityKindFlags rd_entity_kind_flags_table[30];
|
||||
extern Rng1U64 rd_reg_slot_range_table[33];
|
||||
extern Rng1U64 rd_reg_slot_range_table[34];
|
||||
extern RD_StringBindingPair rd_default_binding_table[110];
|
||||
extern String8 rd_binding_version_remap_old_name_table[7];
|
||||
extern String8 rd_binding_version_remap_new_name_table[7];
|
||||
|
||||
@@ -194,6 +194,7 @@ RD_RegTable:
|
||||
{B32 prefer_disasm PreferDisasm }
|
||||
{Dir2 dir2 Dir2 }
|
||||
{String8 string String }
|
||||
{String8 cmd_name CmdName }
|
||||
{`MD_Node *` params_tree ParamsTree }
|
||||
{`OS_Event *` os_event OSEvent }
|
||||
}
|
||||
@@ -235,7 +236,7 @@ RD_CmdTable: // | | | |
|
||||
{Exit 1 1 Null null Nil 0 0 0 0 0 0 X "exit" "Exit" "Exits the debugger." "quit,close,abort" }
|
||||
|
||||
//- rjf: command runner
|
||||
{RunCommand 1 1 String commands Nil 0 0 0 0 0 1 Null "run_command" "Run Command" "Runs a command from the command palette." "help,cmd" }
|
||||
{RunCommand 1 1 CmdName commands Nil 0 0 0 0 0 1 Null "run_command" "Run Command" "Runs a command from the command palette." "help,cmd" }
|
||||
|
||||
//- rjf: os event passthrough
|
||||
{OSEvent 0 0 Null null Nil 0 0 0 0 0 0 Null "os_event" "OS Event" "" "" }
|
||||
|
||||
@@ -135,6 +135,7 @@ rd_regs_copy_contents(Arena *arena, RD_Regs *dst, RD_Regs *src)
|
||||
dst->lines = d_line_list_copy(arena, &src->lines);
|
||||
dst->dbgi_key = di_key_copy(arena, &src->dbgi_key);
|
||||
dst->string = push_str8_copy(arena, src->string);
|
||||
dst->cmd_name = push_str8_copy(arena, src->cmd_name);
|
||||
dst->params_tree = md_tree_copy(arena, src->params_tree);
|
||||
if(dst->entity_list.count == 0 && !rd_handle_match(rd_handle_zero(), dst->entity))
|
||||
{
|
||||
@@ -2007,7 +2008,7 @@ rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, Vec4F32 secon
|
||||
Vec4F32 process_color = rd_rgba_from_ctrl_entity(process);
|
||||
if(process_name.size != 0)
|
||||
{
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Code), size, process_color, process_name);
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Main), size, process_color, process_name);
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Code), size, secondary_color, str8_lit(" / "));
|
||||
}
|
||||
}
|
||||
@@ -5860,7 +5861,7 @@ rd_window_frame(RD_Window *ws)
|
||||
UI_Signal user_sig = ui_signal_from_box(user_box);
|
||||
if(ui_clicked(user_sig))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_RunCommand, .string = rd_cmd_kind_info_table[RD_CmdKind_OpenUser].string);
|
||||
rd_cmd(RD_CmdKind_RunCommand, .cmd_name = rd_cmd_kind_info_table[RD_CmdKind_OpenUser].string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5893,7 +5894,7 @@ rd_window_frame(RD_Window *ws)
|
||||
UI_Signal prof_sig = ui_signal_from_box(prof_box);
|
||||
if(ui_clicked(prof_sig))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_RunCommand, .string = rd_cmd_kind_info_table[RD_CmdKind_OpenProject].string);
|
||||
rd_cmd(RD_CmdKind_RunCommand, .cmd_name = rd_cmd_kind_info_table[RD_CmdKind_OpenProject].string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11362,7 +11363,7 @@ rd_frame(void)
|
||||
U32 hit_char = os_codepoint_from_modifiers_and_key(event->modifiers, event->key);
|
||||
if(hit_char == 0 || allow_text_hotkeys)
|
||||
{
|
||||
rd_cmd(RD_CmdKind_RunCommand, .string = spec_candidates.first->string);
|
||||
rd_cmd(RD_CmdKind_RunCommand, .cmd_name = spec_candidates.first->string);
|
||||
if(allow_text_hotkeys)
|
||||
{
|
||||
os_text(&events, event->window, hit_char);
|
||||
@@ -11800,12 +11801,12 @@ rd_frame(void)
|
||||
//- rjf: command fast path
|
||||
case RD_CmdKind_RunCommand:
|
||||
{
|
||||
RD_CmdKindInfo *info = rd_cmd_kind_info_from_string(cmd->regs->string);
|
||||
RD_CmdKindInfo *info = rd_cmd_kind_info_from_string(cmd->regs->cmd_name);
|
||||
|
||||
// rjf: command does not have a query - simply execute with the current registers
|
||||
if(!(info->query.flags & RD_QueryFlag_Required))
|
||||
{
|
||||
RD_RegsScope(.string = str8_zero()) rd_push_cmd(cmd->regs->string, rd_regs());
|
||||
RD_RegsScope(.cmd_name = str8_zero()) rd_push_cmd(cmd->regs->cmd_name, rd_regs());
|
||||
}
|
||||
|
||||
// rjf: command has required query -> prep query
|
||||
@@ -11815,7 +11816,7 @@ rd_frame(void)
|
||||
if(window != 0)
|
||||
{
|
||||
arena_clear(window->query_cmd_arena);
|
||||
window->query_cmd_name = push_str8_copy(window->query_cmd_arena, cmd->regs->string);
|
||||
window->query_cmd_name = push_str8_copy(window->query_cmd_arena, cmd->regs->cmd_name);
|
||||
window->query_cmd_regs = rd_regs_copy(window->query_cmd_arena, rd_regs());
|
||||
MemoryZeroArray(window->query_cmd_regs_mask);
|
||||
window->query_view_selected = 1;
|
||||
@@ -11920,7 +11921,6 @@ rd_frame(void)
|
||||
{
|
||||
os_window_set_minimized(w->os, 0);
|
||||
os_window_focus(last_focused_window->os);
|
||||
//os_window_bring_to_front(w->os);
|
||||
}
|
||||
if(last_focused_window != 0)
|
||||
{
|
||||
|
||||
@@ -2505,7 +2505,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
ui_set_next_focus_hot(row_selected ? UI_FocusKind_On : UI_FocusKind_Off);
|
||||
if(ui_clicked(rd_cmd_spec_button(rd_cmd_kind_info_table[RD_CmdKind_AddTarget].string)))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_RunCommand, .string = rd_cmd_kind_info_table[RD_CmdKind_AddTarget].string);
|
||||
rd_cmd(RD_CmdKind_RunCommand, .cmd_name = rd_cmd_kind_info_table[RD_CmdKind_AddTarget].string);
|
||||
}
|
||||
}
|
||||
if(rd_entity_is_nil(entity) && collection_entity_kind == RD_EntityKind_Breakpoint)
|
||||
@@ -2514,12 +2514,12 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
ui_set_next_focus_hot(row_selected && selection_tbl.min.x == 1 ? UI_FocusKind_On : UI_FocusKind_Off);
|
||||
if(ui_clicked(rd_cmd_spec_button(rd_cmd_kind_info_table[RD_CmdKind_AddAddressBreakpoint].string)))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_RunCommand, .string = rd_cmd_kind_info_table[RD_CmdKind_AddAddressBreakpoint].string);
|
||||
rd_cmd(RD_CmdKind_RunCommand, .cmd_name = rd_cmd_kind_info_table[RD_CmdKind_AddAddressBreakpoint].string);
|
||||
}
|
||||
ui_set_next_focus_hot(row_selected && selection_tbl.min.x == 2 ? UI_FocusKind_On : UI_FocusKind_Off);
|
||||
if(ui_clicked(rd_cmd_spec_button(rd_cmd_kind_info_table[RD_CmdKind_AddFunctionBreakpoint].string)))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_RunCommand, .string = rd_cmd_kind_info_table[RD_CmdKind_AddFunctionBreakpoint].string);
|
||||
rd_cmd(RD_CmdKind_RunCommand, .cmd_name = rd_cmd_kind_info_table[RD_CmdKind_AddFunctionBreakpoint].string);
|
||||
}
|
||||
}
|
||||
if(rd_entity_is_nil(entity) && collection_entity_kind == RD_EntityKind_WatchPin)
|
||||
@@ -2528,7 +2528,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
ui_set_next_focus_hot(row_selected && selection_tbl.min.x == 1 ? UI_FocusKind_On : UI_FocusKind_Off);
|
||||
if(ui_clicked(rd_cmd_spec_button(rd_cmd_kind_info_table[RD_CmdKind_AddWatchPin].string)))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_RunCommand, .string = rd_cmd_kind_info_table[RD_CmdKind_AddWatchPin].string);
|
||||
rd_cmd(RD_CmdKind_RunCommand, .cmd_name = rd_cmd_kind_info_table[RD_CmdKind_AddWatchPin].string);
|
||||
}
|
||||
}
|
||||
if(rd_entity_is_nil(entity) && collection_entity_kind == RD_EntityKind_FilePathMap)
|
||||
@@ -3387,7 +3387,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(getting_started)
|
||||
RD_Palette(RD_PaletteCode_NeutralPopButton)
|
||||
if(ui_clicked(rd_icon_buttonf(RD_IconKind_Add, 0, "Add Target")))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_RunCommand, .string = rd_cmd_kind_info_table[RD_CmdKind_AddTarget].string);
|
||||
rd_cmd(RD_CmdKind_RunCommand, .cmd_name = rd_cmd_kind_info_table[RD_CmdKind_AddTarget].string);
|
||||
}
|
||||
}break;
|
||||
|
||||
@@ -3614,7 +3614,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(commands)
|
||||
//- rjf: submit best match when hitting enter w/ no selection
|
||||
if(cv->selected_cmd_hash == 0 && ui_slot_press(UI_EventActionSlot_Accept))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_CompleteQuery, .string = (cmd_array.count > 0 ? cmd_array.v[0].cmd_name : str8_zero()));
|
||||
rd_cmd(RD_CmdKind_CompleteQuery, .cmd_name = (cmd_array.count > 0 ? cmd_array.v[0].cmd_name : str8_zero()));
|
||||
}
|
||||
|
||||
//- rjf: selected kind -> cursor
|
||||
@@ -3727,7 +3727,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(commands)
|
||||
UI_Signal sig = ui_signal_from_box(box);
|
||||
if(ui_clicked(sig))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_CompleteQuery, .string = item->cmd_name);
|
||||
rd_cmd(RD_CmdKind_CompleteQuery, .cmd_name = item->cmd_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6114,7 +6114,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(text)
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
if(ui_clicked(ui_buttonf("Find alternative...")))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_RunCommand, .string = rd_cmd_kind_info_table[RD_CmdKind_PickFile].string);
|
||||
rd_cmd(RD_CmdKind_RunCommand, .cmd_name = rd_cmd_kind_info_table[RD_CmdKind_PickFile].string);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ rd_cmd_list_menu_buttons(U64 count, String8 *cmd_names, U32 *fastpath_codepoints
|
||||
UI_Signal sig = rd_cmd_spec_button(cmd_names[idx]);
|
||||
if(ui_clicked(sig))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_RunCommand, .string = cmd_names[idx]);
|
||||
rd_cmd(RD_CmdKind_RunCommand, .cmd_name = cmd_names[idx]);
|
||||
ui_ctx_menu_close();
|
||||
RD_Window *window = rd_window_from_handle(rd_regs()->window);
|
||||
window->menu_bar_focused = 0;
|
||||
|
||||
Reference in New Issue
Block a user