From 23c7fcf09906a25aefa1d294b10360c3159026d8 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Thu, 24 Apr 2025 15:57:57 -0700 Subject: [PATCH] plug tab opening back in --- .../eval_visualization_core.c | 2 - src/raddbg/generated/raddbg.meta.c | 46 ++++++++++++++++- src/raddbg/generated/raddbg.meta.h | 7 ++- src/raddbg/raddbg.mdesk | 13 +++++ src/raddbg/raddbg_core.c | 49 ++++++++++--------- 5 files changed, 88 insertions(+), 29 deletions(-) diff --git a/src/eval_visualization/eval_visualization_core.c b/src/eval_visualization/eval_visualization_core.c index 086b1605..40a1710d 100644 --- a/src/eval_visualization/eval_visualization_core.c +++ b/src/eval_visualization/eval_visualization_core.c @@ -587,7 +587,6 @@ ev_block_tree_from_eval(Arena *arena, EV_View *view, String8 filter, E_Eval eval } // rjf: get top-level lookup/expansion info - // TODO(rjf): @eval before expanding a type, ALWAYS select the parent key E_TypeExpandInfo type_expand_info = type_expand_rule->info(arena, t->eval, filter); EV_ExpandInfo viz_expand_info = viz_expand_rule->info(arena, view, filter, t->eval.expr); @@ -2101,7 +2100,6 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string) expand_data = it->top_task->user_data = push_array(arena, EV_ExpandedTypeData, 1); expand_data->type = e_type_from_key__cached(type_key); expand_data->expand_rule = e_expand_rule_from_type_key(type_key); - // TODO(rjf): @eval before expanding a type, ALWAYS select the parent key expand_data->expand_info = expand_data->expand_rule->info(arena, eval, params->filter); } switch(task_idx) diff --git a/src/raddbg/generated/raddbg.meta.c b/src/raddbg/generated/raddbg.meta.c index 140107a7..cbd8d88f 100644 --- a/src/raddbg/generated/raddbg.meta.c +++ b/src/raddbg/generated/raddbg.meta.c @@ -4,7 +4,47 @@ //- GENERATED CODE C_LINKAGE_BEGIN -RD_VocabInfo rd_vocab_info_table[309] = +String8 rd_tab_fast_path_view_name_table[16] = +{ +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +str8_lit_comp("watch"), +}; + +String8 rd_tab_fast_path_query_name_table[16] = +{ +str8_lit_comp("query:watches"), +str8_lit_comp("query:locals"), +str8_lit_comp("query:registers"), +str8_lit_comp("query:globals"), +str8_lit_comp("query:thread_locals"), +str8_lit_comp("query:types"), +str8_lit_comp("query:procedures"), +str8_lit_comp("query:call_stack"), +str8_lit_comp("query:targets"), +str8_lit_comp("query:breakpoints"), +str8_lit_comp("query:watch_pins"), +str8_lit_comp("query:threads"), +str8_lit_comp("query:processes"), +str8_lit_comp("query:machines"), +str8_lit_comp("query:modules"), +str8_lit_comp("query:file_path_maps"), +}; + +RD_VocabInfo rd_vocab_info_table[310] = { {str8_lit_comp("auto_view_rule"), str8_lit_comp("auto_view_rules"), str8_lit_comp("Auto View Rule"), str8_lit_comp("Auto View Rules"), 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}, @@ -315,6 +355,7 @@ RD_VocabInfo rd_vocab_info_table[309] = {str8_lit_comp("processes"), str8_lit_comp(""), str8_lit_comp("Processes"), str8_lit_comp(""), RD_IconKind_Scheduler}, {str8_lit_comp("machines"), str8_lit_comp(""), str8_lit_comp("Machines"), str8_lit_comp(""), RD_IconKind_Machine}, {str8_lit_comp("modules"), str8_lit_comp(""), str8_lit_comp("Modules"), str8_lit_comp(""), RD_IconKind_Module}, +{str8_lit_comp("file_path_maps"), str8_lit_comp(""), str8_lit_comp("File Path Map"), str8_lit_comp(""), RD_IconKind_FileOutline}, }; RD_NameSchemaInfo rd_name_schema_info_table[21] = @@ -388,7 +429,7 @@ Rng1U64 rd_reg_slot_range_table[42] = {OffsetOf(RD_Regs, os_event), OffsetOf(RD_Regs, os_event) + sizeof(OS_Event *)}, }; -RD_CmdKindInfo rd_cmd_kind_info_table[205] = +RD_CmdKindInfo rd_cmd_kind_info_table[206] = { {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_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}}, @@ -595,6 +636,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[205] = { str8_lit_comp("processes"), str8_lit_comp("Opens a Processes tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs}, { str8_lit_comp("machines"), str8_lit_comp("Opens a Machines tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs}, { str8_lit_comp("modules"), str8_lit_comp("Opens a Modules tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs}, +{ str8_lit_comp("file_path_maps"), str8_lit_comp("Opens a File Path Map tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs}, }; struct {String8 string; RD_Binding binding;} rd_default_binding_table[108] = diff --git a/src/raddbg/generated/raddbg.meta.h b/src/raddbg/generated/raddbg.meta.h index e9f68d10..7b3d99cc 100644 --- a/src/raddbg/generated/raddbg.meta.h +++ b/src/raddbg/generated/raddbg.meta.h @@ -260,7 +260,9 @@ RD_CmdKind_OpenThreads, RD_CmdKind_OpenProcesses, RD_CmdKind_OpenMachines, RD_CmdKind_OpenModules, +RD_CmdKind_OpenFilePathMaps, RD_CmdKind_COUNT, +RD_CmdKind_FirstTabFastPathCmd = RD_CmdKind_OpenWatch, } RD_CmdKind; typedef enum RD_IconKind @@ -607,6 +609,7 @@ X(threads)\ X(processes)\ X(machines)\ X(modules)\ +X(file_path_maps)\ Y(output, text, "query:output")\ Y(disasm, disasm, "")\ Y(memory, memory, "")\ @@ -656,7 +659,9 @@ Z(getting_started)\ .os_event = rd_regs()->os_event,\ C_LINKAGE_BEGIN -extern RD_VocabInfo rd_vocab_info_table[309]; +extern String8 rd_tab_fast_path_view_name_table[16]; +extern String8 rd_tab_fast_path_query_name_table[16]; +extern RD_VocabInfo rd_vocab_info_table[310]; extern RD_NameSchemaInfo rd_name_schema_info_table[21]; extern Rng1U64 rd_reg_slot_range_table[42]; extern String8 rd_binding_version_remap_old_name_table[8]; diff --git a/src/raddbg/raddbg.mdesk b/src/raddbg/raddbg.mdesk index 76864e27..6333b451 100644 --- a/src/raddbg/raddbg.mdesk +++ b/src/raddbg/raddbg.mdesk @@ -32,6 +32,7 @@ RD_WatchTabFastPathTable: {Processes "Processes" processes Scheduler } {Machines "Machines" machines Machine } {Modules "Modules" modules Module } + {FilePathMaps "File Path Map" file_path_maps FileOutline } } @table(name display_name name_lower view query icon) @@ -57,6 +58,16 @@ RD_FixedTabTable: ``; } +@data(String8) rd_tab_fast_path_view_name_table: +{ + @expand(RD_WatchTabFastPathTable a) `str8_lit_comp("watch")`, +} + +@data(String8) rd_tab_fast_path_query_name_table: +{ + @expand(RD_WatchTabFastPathTable a) `str8_lit_comp("query:$(a.name_lower)")`, +} + //////////////////////////////// //~ rjf: Vocabulary Map @@ -831,6 +842,8 @@ RD_CmdTable: // | | | | @expand(RD_CmdTable, a) `$(a.name)`, @expand(RD_WatchTabFastPathTable, a) `Open$(a.name)`, COUNT, + + `FirstTabFastPathCmd = RD_CmdKind_OpenWatch`, } @struct RD_Query: diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index ef277746..9f30aefa 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -3005,7 +3005,7 @@ rd_view_ui(Rng2F32 rect) if(evt->kind == UI_EventKind_Press && evt->slot == UI_EventActionSlot_Accept && selection_tbl.min.y == selection_tbl.max.y && - (rd_cfg_child_from_string(view, str8_lit("lister")) != &rd_nil_cfg || view_is_floating)) + (rd_cfg_child_from_string(view, str8_lit("lister")) != &rd_nil_cfg)) { RD_Cfg *query = rd_cfg_child_from_string(view, str8_lit("query")); RD_Cfg *cmd = rd_cfg_child_from_string(query, str8_lit("cmd")); @@ -4756,11 +4756,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? -> move cursor & accept - else + // rjf: other cases, but this watch window is floating? -> push query + else if(view_is_floating) { - ewv->next_cursor = ewv->next_mark = cell_pt; - rd_cmd(RD_CmdKind_Accept); + rd_cmd(RD_CmdKind_PushQuery, .expr = cell->eval.string); } } @@ -6485,7 +6484,7 @@ rd_window_frame(void) Rng2F32 rect = {0}; RD_RegsScope(.view = view->id) { - F32 row_height_px = ui_top_px_height(); + F32 row_height_px = ui_top_font_size() * rd_setting_f32_from_name(str8_lit("row_height")); Vec2F32 content_rect_center = center_2f32(content_rect); Vec2F32 content_rect_dim = dim_2f32(content_rect); EV_BlockTree predicted_block_tree = ev_block_tree_from_eval(scratch.arena, rd_view_eval_view(), rd_view_query_input(), query_eval); @@ -6494,7 +6493,8 @@ rd_window_frame(void) F32 query_height_px = max_query_height_px; if(size_query_by_expr_eval) { - query_height_px = row_height_px * (predicted_block_tree.total_row_count - !root_is_explicit); + F32 search_row_open_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "search_row_open_%p", view), (F32)!!vs->query_is_selected, .initial = (F32)!!vs->query_is_selected, .epsilon = 0.01f); + query_height_px = row_height_px * (predicted_block_tree.total_row_count - !root_is_explicit) + ui_top_px_height()*search_row_open_t; query_height_px = Min(query_height_px, max_query_height_px); } rect = r2f32p(content_rect_center.x - query_width_px/2, @@ -6867,6 +6867,7 @@ rd_window_frame(void) rd_cmd_kind_info_table[RD_CmdKind_OpenMachines].string, rd_cmd_kind_info_table[RD_CmdKind_OpenProcesses].string, rd_cmd_kind_info_table[RD_CmdKind_OpenThreads].string, + rd_cmd_kind_info_table[RD_CmdKind_OpenCallStack].string, //rd_cmd_kind_info_table[RD_CmdKind_Output].string, //rd_cmd_kind_info_table[RD_CmdKind_Memory].string, //rd_cmd_kind_info_table[RD_CmdKind_Disassembly].string, @@ -6879,7 +6880,7 @@ rd_window_frame(void) rd_cmd_kind_info_table[RD_CmdKind_OpenProcedures].string, rd_cmd_kind_info_table[RD_CmdKind_OpenBreakpoints].string, rd_cmd_kind_info_table[RD_CmdKind_OpenWatchPins].string, - // rd_cmd_kind_info_table[RD_CmdKind_OpenFilePathMap].string, + rd_cmd_kind_info_table[RD_CmdKind_OpenFilePathMaps].string, // rd_cmd_kind_info_table[RD_CmdKind_OpenAutoViewRules].string, // rd_cmd_kind_info_table[RD_CmdKind_GettingStarted].string, }; @@ -6898,6 +6899,8 @@ rd_window_frame(void) 0, 0, 0, + 0, + 0, }; Assert(ArrayCount(codepoints) == ArrayCount(cmds)); rd_cmd_list_menu_buttons(ArrayCount(cmds), cmds, codepoints); @@ -8565,16 +8568,14 @@ rd_window_frame(void) UI_Signal sig = ui_signal_from_box(add_new_box); if(ui_pressed(sig)) { - rd_cmd(RD_CmdKind_FocusPanel); - UI_Key tab_menu_key = ui_key_from_string(ui_key_zero(), str8_lit("_tab_menu_key_")); - if(ui_ctx_menu_is_open(tab_menu_key)) - { - ui_ctx_menu_close(); - } - else - { - ui_ctx_menu_open(tab_menu_key, add_new_box->key, v2f32(0, tab_bar_vheight)); - } + rd_cmd(RD_CmdKind_FocusPanel, .panel = panel->cfg->id); + rd_cmd(RD_CmdKind_PushQuery, .expr = str8_lit("query:commands"), + .panel = panel->cfg->id, + .do_implicit_root = 1, + .do_lister = 1, + .do_big_rows = 1, + .ui_key = add_new_box->key, + .off_px = v2f32(0, dim_2f32(add_new_box->rect).y)); } } } @@ -12544,14 +12545,14 @@ rd_frame(void) d_push_cmd((D_CmdKind)kind, ¶ms); } - // rjf: try to open tabs for "view driver" commands -#if 0 // TODO(rjf): @cfg (tab opening) - RD_ViewRuleInfo *view_rule_info = rd_view_rule_info_from_string(cmd->name); - if(view_rule_info != &rd_nil_view_rule_info) + // rjf: try to open tabs, if this is a tab-fastpath-opener + if(kind >= RD_CmdKind_FirstTabFastPathCmd) { - rd_cmd(RD_CmdKind_OpenTab, .string = str8_zero(), .params_tree = md_tree_from_string(scratch.arena, cmd->name)->first); + U64 fast_path_idx = (kind - RD_CmdKind_FirstTabFastPathCmd); + String8 view_name = rd_tab_fast_path_view_name_table[fast_path_idx]; + String8 query_name = rd_tab_fast_path_query_name_table[fast_path_idx]; + rd_cmd(RD_CmdKind_OpenTab, .string = view_name, .expr = query_name); } -#endif }break; //- rjf: open palette