diff --git a/src/dbg_engine/dbg_engine_core.c b/src/dbg_engine/dbg_engine_core.c index 0a58ff42..4a07328b 100644 --- a/src/dbg_engine/dbg_engine_core.c +++ b/src/dbg_engine/dbg_engine_core.c @@ -3413,8 +3413,8 @@ d_ctrl_run(D_RunKind run, D_Entity *run_thread, CTRL_RunFlags flags, CTRL_TrapLi d_state->ctrl_is_running = 1; // rjf: reset selected frame to top unwind - d_state->base_interact_regs.v.unwind_count = 0; - d_state->base_interact_regs.v.inline_depth = 0; + d_state->base_regs.v.unwind_count = 0; + d_state->base_regs.v.inline_depth = 0; scratch_end(scratch); } @@ -5386,38 +5386,38 @@ d_time_in_seconds(void) //- rjf: interaction registers -internal D_InteractRegs * -d_interact_regs(void) +internal D_Regs * +d_regs(void) { - D_InteractRegs *regs = &d_state->top_interact_regs->v; + D_Regs *regs = &d_state->top_regs->v; return regs; } -internal D_InteractRegs * -d_base_interact_regs(void) +internal D_Regs * +d_base_regs(void) { - D_InteractRegs *regs = &d_state->base_interact_regs.v; + D_Regs *regs = &d_state->base_regs.v; return regs; } -internal D_InteractRegs * -d_push_interact_regs(void) +internal D_Regs * +d_push_regs(void) { - D_InteractRegs *top = d_interact_regs(); - D_InteractRegsNode *n = push_array(d_frame_arena(), D_InteractRegsNode, 1); + D_Regs *top = d_regs(); + D_RegsNode *n = push_array(d_frame_arena(), D_RegsNode, 1); MemoryCopyStruct(&n->v, top); - SLLStackPush(d_state->top_interact_regs, n); + SLLStackPush(d_state->top_regs, n); return &n->v; } -internal D_InteractRegs * -d_pop_interact_regs(void) +internal D_Regs * +d_pop_regs(void) { - D_InteractRegs *regs = &d_state->top_interact_regs->v; - SLLStackPop(d_state->top_interact_regs); - if(d_state->top_interact_regs == 0) + D_Regs *regs = &d_state->top_regs->v; + SLLStackPop(d_state->top_regs); + if(d_state->top_regs == 0) { - d_state->top_interact_regs = &d_state->base_interact_regs; + d_state->top_regs = &d_state->base_regs; } return regs; } @@ -6189,7 +6189,7 @@ d_init(CmdLine *cmdln, D_StateDeltaHistory *hist) d_state->view_rule_spec_table = push_array(arena, D_ViewRuleSpec *, d_state->view_rule_spec_table_size); d_state->seconds_til_autosave = 0.5f; d_state->hist = hist; - d_state->top_interact_regs = &d_state->base_interact_regs; + d_state->top_regs = &d_state->base_regs; // rjf: set up initial exception filtering rules for(CTRL_ExceptionCodeKind k = (CTRL_ExceptionCodeKind)0; k < CTRL_ExceptionCodeKind_COUNT; k = (CTRL_ExceptionCodeKind)(k+1)) @@ -6318,10 +6318,10 @@ d_begin_frame(Arena *arena, D_CmdList *cmds, F32 dt) d_state->frame_eval_memread_endt_us = os_now_microseconds() + 5000; d_state->dt = dt; d_state->time_in_seconds += dt; - d_state->top_interact_regs = &d_state->base_interact_regs; - d_state->top_interact_regs->v.file_path = push_str8_copy(d_frame_arena(), d_state->top_interact_regs->v.file_path); - d_state->top_interact_regs->v.lines = d_line_list_copy(d_frame_arena(), &d_state->top_interact_regs->v.lines); - d_state->top_interact_regs->v.dbgi_key = di_key_copy(d_frame_arena(), &d_state->top_interact_regs->v.dbgi_key); + d_state->top_regs = &d_state->base_regs; + d_state->top_regs->v.file_path = push_str8_copy(d_frame_arena(), d_state->top_regs->v.file_path); + d_state->top_regs->v.lines = d_line_list_copy(d_frame_arena(), &d_state->top_regs->v.lines); + d_state->top_regs->v.dbgi_key = di_key_copy(d_frame_arena(), &d_state->top_regs->v.dbgi_key); //- rjf: sync with ctrl thread ProfScope("sync with ctrl thread") @@ -6385,7 +6385,7 @@ d_begin_frame(Arena *arena, D_CmdList *cmds, F32 dt) // rjf: if no stop-causing thread, and if selected thread, snap to selected if(should_snap && d_entity_is_nil(stop_thread)) { - D_Entity *selected_thread = d_entity_from_handle(d_interact_regs()->thread); + D_Entity *selected_thread = d_entity_from_handle(d_regs()->thread); if(!d_entity_is_nil(selected_thread)) { D_CmdParams params = d_cmd_params_zero(); @@ -6552,10 +6552,10 @@ d_begin_frame(Arena *arena, D_CmdList *cmds, F32 dt) d_entity_equip_color_rgba(entity, thread_color); // rjf: automatically select if we don't have a selected thread - D_Entity *selected_thread = d_entity_from_handle(d_state->base_interact_regs.v.thread); + D_Entity *selected_thread = d_entity_from_handle(d_state->base_regs.v.thread); if(d_entity_is_nil(selected_thread)) { - d_state->base_interact_regs.v.thread = d_handle_from_entity(entity); + d_state->base_regs.v.thread = d_handle_from_entity(entity); } // rjf: do initial snap @@ -7201,27 +7201,27 @@ d_begin_frame(Arena *arena, D_CmdList *cmds, F32 dt) D_Entity *thread = d_entity_from_handle(params.entity); D_Entity *module = d_module_from_thread(thread); D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process); - d_state->base_interact_regs.v.unwind_count = 0; - d_state->base_interact_regs.v.inline_depth = 0; - d_state->base_interact_regs.v.thread = d_handle_from_entity(thread); - d_state->base_interact_regs.v.module = d_handle_from_entity(module); - d_state->base_interact_regs.v.process = d_handle_from_entity(process); + d_state->base_regs.v.unwind_count = 0; + d_state->base_regs.v.inline_depth = 0; + d_state->base_regs.v.thread = d_handle_from_entity(thread); + d_state->base_regs.v.module = d_handle_from_entity(module); + d_state->base_regs.v.process = d_handle_from_entity(process); }break; case D_CmdKind_SelectUnwind: { DI_Scope *di_scope = di_scope_open(); - D_Entity *thread = d_entity_from_handle(d_state->base_interact_regs.v.thread); + D_Entity *thread = d_entity_from_handle(d_state->base_regs.v.thread); D_Entity *process = d_entity_ancestor_from_kind(thread, D_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); if(params.unwind_index < rich_unwind.frames.concrete_frame_count) { D_UnwindFrame *frame = &rich_unwind.frames.v[params.unwind_index]; - d_state->base_interact_regs.v.unwind_count = params.unwind_index; - d_state->base_interact_regs.v.inline_depth = 0; + d_state->base_regs.v.unwind_count = params.unwind_index; + d_state->base_regs.v.inline_depth = 0; if(params.inline_depth <= frame->inline_frame_count) { - d_state->base_interact_regs.v.inline_depth = params.inline_depth; + d_state->base_regs.v.inline_depth = params.inline_depth; } } di_scope_close(di_scope); @@ -7230,12 +7230,12 @@ d_begin_frame(Arena *arena, D_CmdList *cmds, F32 dt) case D_CmdKind_DownOneFrame: { DI_Scope *di_scope = di_scope_open(); - D_Entity *thread = d_entity_from_handle(d_state->base_interact_regs.v.thread); + D_Entity *thread = d_entity_from_handle(d_state->base_regs.v.thread); D_Entity *process = d_entity_ancestor_from_kind(thread, D_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); - U64 crnt_unwind_idx = d_state->base_interact_regs.v.unwind_count; - U64 crnt_inline_dpt = d_state->base_interact_regs.v.inline_depth; + U64 crnt_unwind_idx = d_state->base_regs.v.unwind_count; + U64 crnt_inline_dpt = d_state->base_regs.v.inline_depth; U64 next_unwind_idx = crnt_unwind_idx; U64 next_inline_dpt = crnt_inline_dpt; if(crnt_unwind_idx < rich_unwind.frames.concrete_frame_count) @@ -8132,7 +8132,7 @@ d_begin_frame(Arena *arena, D_CmdList *cmds, F32 dt) //- rjf: cursor operations case D_CmdKind_ToggleBreakpointAtCursor: { - D_InteractRegs *regs = d_interact_regs(); + D_Regs *regs = d_regs(); D_CmdParams p = d_cmd_params_zero(); p.file_path = regs->file_path; p.text_point = regs->cursor; @@ -8141,7 +8141,7 @@ d_begin_frame(Arena *arena, D_CmdList *cmds, F32 dt) }break; case D_CmdKind_ToggleWatchPinAtCursor: { - D_InteractRegs *regs = d_interact_regs(); + D_Regs *regs = d_regs(); D_CmdParams p = d_cmd_params_zero(); p.file_path = regs->file_path; p.text_point = regs->cursor; @@ -8154,7 +8154,7 @@ d_begin_frame(Arena *arena, D_CmdList *cmds, F32 dt) { HS_Scope *hs_scope = hs_scope_open(); TXT_Scope *txt_scope = txt_scope_open(); - D_InteractRegs *regs = d_interact_regs(); + D_Regs *regs = d_regs(); U128 text_key = regs->text_key; TXT_LangKind lang_kind = regs->lang_kind; TxtRng range = txt_rng(regs->cursor, regs->mark); @@ -8181,24 +8181,24 @@ d_begin_frame(Arena *arena, D_CmdList *cmds, F32 dt) }break; case D_CmdKind_RunToCursor: { - String8 file_path = d_interact_regs()->file_path; + String8 file_path = d_regs()->file_path; if(file_path.size != 0) { - d_cmd(D_CmdKind_RunToLine, .file_path = file_path, .text_point = d_interact_regs()->cursor); + d_cmd(D_CmdKind_RunToLine, .file_path = file_path, .text_point = d_regs()->cursor); } else { - d_cmd(D_CmdKind_RunToAddress, .vaddr = d_interact_regs()->vaddr_range.min); + d_cmd(D_CmdKind_RunToAddress, .vaddr = d_regs()->vaddr_range.min); } }break; case D_CmdKind_SetNextStatement: { - D_Entity *thread = d_entity_from_handle(d_interact_regs()->thread); - String8 file_path = d_interact_regs()->file_path; - U64 new_rip_vaddr = d_interact_regs()->vaddr_range.min; + D_Entity *thread = d_entity_from_handle(d_regs()->thread); + String8 file_path = d_regs()->file_path; + U64 new_rip_vaddr = d_regs()->vaddr_range.min; if(file_path.size != 0) { - D_LineList *lines = &d_interact_regs()->lines; + D_LineList *lines = &d_regs()->lines; for(D_LineNode *n = lines->first; n != 0; n = n->next) { D_EntityList modules = d_modules_from_dbgi_key(scratch.arena, &n->v.dbgi_key); @@ -8345,10 +8345,10 @@ d_begin_frame(Arena *arena, D_CmdList *cmds, F32 dt) } //- rjf: unpack eval-dependent info - D_Entity *process = d_entity_from_handle(d_interact_regs()->process); - D_Entity *thread = d_entity_from_handle(d_interact_regs()->thread); + D_Entity *process = d_entity_from_handle(d_regs()->process); + D_Entity *thread = d_entity_from_handle(d_regs()->thread); Architecture arch = d_architecture_from_entity(thread); - U64 unwind_count = d_interact_regs()->unwind_count; + U64 unwind_count = d_regs()->unwind_count; U64 rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_count); CTRL_Unwind unwind = d_query_cached_unwind_from_thread(thread); D_Entity *module = d_module_from_process_vaddr(process, rip_vaddr); diff --git a/src/dbg_engine/dbg_engine_core.h b/src/dbg_engine/dbg_engine_core.h index 601e6639..15fc4977 100644 --- a/src/dbg_engine/dbg_engine_core.h +++ b/src/dbg_engine/dbg_engine_core.h @@ -484,8 +484,8 @@ struct D_LineListArray //////////////////////////////// //~ rjf: Interaction Context Register Types -typedef struct D_InteractRegs D_InteractRegs; -struct D_InteractRegs +typedef struct D_Regs D_Regs; +struct D_Regs { D_Handle module; D_Handle process; @@ -506,11 +506,11 @@ struct D_InteractRegs DI_Key dbgi_key; }; -typedef struct D_InteractRegsNode D_InteractRegsNode; -struct D_InteractRegsNode +typedef struct D_RegsNode D_RegsNode; +struct D_RegsNode { - D_InteractRegsNode *next; - D_InteractRegs v; + D_RegsNode *next; + D_Regs v; }; //////////////////////////////// @@ -1023,8 +1023,8 @@ struct D_State DI_Scope *frame_di_scope; // rjf: interaction registers - D_InteractRegsNode base_interact_regs; - D_InteractRegsNode *top_interact_regs; + D_RegsNode base_regs; + D_RegsNode *top_regs; // rjf: top-level command batch Arena *root_cmd_arena; @@ -1533,12 +1533,12 @@ internal U64 d_frame_index(void); internal Arena *d_frame_arena(void); internal F64 d_time_in_seconds(void); -//- rjf: interaction registers -internal D_InteractRegs *d_interact_regs(void); -internal D_InteractRegs *d_base_interact_regs(void); -internal D_InteractRegs *d_push_interact_regs(void); -internal D_InteractRegs *d_pop_interact_regs(void); -#define D_InteractRegsScope DeferLoop(d_push_interact_regs(), d_pop_interact_regs()) +//- rjf: registers +internal D_Regs *d_regs(void); +internal D_Regs *d_base_regs(void); +internal D_Regs *d_push_regs(void); +internal D_Regs *d_pop_regs(void); +#define D_RegsScope DeferLoop(d_push_regs(), d_pop_regs()) //- rjf: undo/redo history internal D_StateDeltaHistory *d_state_delta_history(void); @@ -1585,13 +1585,13 @@ internal E_String2NumMap *d_query_cached_member_map_from_dbgi_key_voff(DI_Key *d internal void d_push_cmd(D_CmdSpec *spec, D_CmdParams *params); internal void d_error(String8 string); internal void d_errorf(char *fmt, ...); -#define d_cmd(kind, ...) d_push_cmd(d_cmd_spec_from_kind(kind), \ -&(D_CmdParams) \ -{ \ -.window = d_interact_regs()->window, \ -.panel = d_interact_regs()->panel, \ -.view = d_interact_regs()->view, \ -__VA_ARGS__ \ +#define d_cmd(kind, ...) d_push_cmd(d_cmd_spec_from_kind(kind), \ +&(D_CmdParams) \ +{ \ +.window = d_regs()->window, \ +.panel = d_regs()->panel, \ +.view = d_regs()->view, \ +__VA_ARGS__ \ }) //////////////////////////////// diff --git a/src/dbg_frontend/dbg_frontend_core.c b/src/dbg_frontend/dbg_frontend_core.c index 08d0b7b7..a85c5e25 100644 --- a/src/dbg_frontend/dbg_frontend_core.c +++ b/src/dbg_frontend/dbg_frontend_core.c @@ -505,9 +505,9 @@ df_cmd_params_from_window(DF_Window *window) p.panel = df_handle_from_panel(window->focused_panel); p.view = df_handle_from_view(df_selected_tab_from_panel(window->focused_panel)); p.prefer_dasm = df_prefer_dasm_from_window(window); - p.entity = d_interact_regs()->thread; - p.unwind_index = d_interact_regs()->unwind_count; - p.inline_depth = d_interact_regs()->inline_depth; + p.entity = d_regs()->thread; + p.unwind_index = d_regs()->unwind_count; + p.inline_depth = d_regs()->inline_depth; return p; } @@ -519,9 +519,9 @@ df_cmd_params_from_panel(DF_Window *window, DF_Panel *panel) p.panel = df_handle_from_panel(panel); p.view = df_handle_from_view(df_selected_tab_from_panel(panel)); p.prefer_dasm = df_prefer_dasm_from_window(window); - p.entity = d_interact_regs()->thread; - p.unwind_index = d_interact_regs()->unwind_count; - p.inline_depth = d_interact_regs()->inline_depth; + p.entity = d_regs()->thread; + p.unwind_index = d_regs()->unwind_count; + p.inline_depth = d_regs()->inline_depth; return p; } @@ -533,9 +533,9 @@ df_cmd_params_from_view(DF_Window *window, DF_Panel *panel, DF_View *view) p.panel = df_handle_from_panel(panel); p.view = df_handle_from_view(view); p.prefer_dasm = df_prefer_dasm_from_window(window); - p.entity = d_interact_regs()->thread; - p.unwind_index = d_interact_regs()->unwind_count; - p.inline_depth = d_interact_regs()->inline_depth; + p.entity = d_regs()->thread; + p.unwind_index = d_regs()->unwind_count; + p.inline_depth = d_regs()->inline_depth; return p; } @@ -1139,9 +1139,9 @@ df_window_open(Vec2F32 size, OS_Handle preferred_monitor, D_CfgSrc cfg_src) { os_window_set_monitor(window->os, preferred_monitor); } - if(df_state->first_window == 0) D_InteractRegsScope + if(df_state->first_window == 0) D_RegsScope { - d_interact_regs()->window = df_handle_from_window(window); + d_regs()->window = df_handle_from_window(window); DF_FontSlot english_font_slots[] = {DF_FontSlot_Main, DF_FontSlot_Code}; DF_FontSlot icon_font_slot = DF_FontSlot_Icons; for(U64 idx = 0; idx < ArrayCount(english_font_slots); idx += 1) @@ -2731,11 +2731,11 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds) }break; case D_CmdKind_FindSelectedThread: { - D_Entity *selected_thread = d_entity_from_handle(d_base_interact_regs()->thread); + D_Entity *selected_thread = d_entity_from_handle(d_base_regs()->thread); D_CmdParams params = df_cmd_params_from_window(ws); params.entity = d_handle_from_entity(selected_thread); - params.unwind_index = d_base_interact_regs()->unwind_count; - params.inline_depth = d_base_interact_regs()->inline_depth; + params.unwind_index = d_base_regs()->unwind_count; + params.inline_depth = d_base_regs()->inline_depth; d_cmd_list_push(arena, cmds, ¶ms, d_cmd_spec_from_kind(D_CmdKind_FindThread)); }break; @@ -3017,7 +3017,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds) { file_path = params.file_path; point = params.text_point; - thread = d_entity_from_handle(d_interact_regs()->thread); + thread = d_entity_from_handle(d_regs()->thread); process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process); vaddr = params.vaddr; } @@ -3398,8 +3398,8 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds) ////////////////////////////// //- rjf: fill panel/view interaction registers // - d_interact_regs()->panel = df_handle_from_panel(ws->focused_panel); - d_interact_regs()->view = ws->focused_panel->selected_tab_view; + d_regs()->panel = df_handle_from_panel(ws->focused_panel); + d_regs()->view = ws->focused_panel->selected_tab_view; ////////////////////////////// //- rjf: process view-level commands on leaf panels @@ -3417,15 +3417,15 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds) DF_View *view = df_selected_tab_from_panel(panel); if(!df_view_is_nil(view)) { - d_push_interact_regs(); - d_interact_regs()->panel = df_handle_from_panel(panel); - d_interact_regs()->view = df_handle_from_view(view); + d_push_regs(); + d_regs()->panel = df_handle_from_panel(panel); + d_regs()->view = df_handle_from_view(view); DF_ViewCmdFunctionType *do_view_cmds_function = view->spec->info.cmd_hook; do_view_cmds_function(view, view->params_roots[view->params_read_gen%ArrayCount(view->params_roots)], str8(view->query_buffer, view->query_string_size), cmds); - D_InteractRegs *view_regs = d_pop_interact_regs(); + D_Regs *view_regs = d_pop_regs(); if(panel == ws->focused_panel) { - MemoryCopyStruct(d_interact_regs(), view_regs); + MemoryCopyStruct(d_regs(), view_regs); } } } @@ -3693,7 +3693,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds) //- rjf: draw current interaction regs { - D_InteractRegs *regs = d_interact_regs(); + D_Regs *regs = d_regs(); #define Handle(name) ui_labelf("%s: [0x%I64x, 0x%I64x]", #name, (regs->name).u64[0], (regs->name).u64[1]) Handle(window); Handle(panel); @@ -3825,7 +3825,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds) } if(range.min.line == range.max.line && ui_clicked(df_icon_buttonf(DF_IconKind_RightArrow, 0, "Set Next Statement"))) { - D_Entity *thread = d_entity_from_handle(d_interact_regs()->thread); + D_Entity *thread = d_entity_from_handle(d_regs()->thread); U64 new_rip_vaddr = ws->code_ctx_menu_vaddr; if(ws->code_ctx_menu_file_path.size != 0) { @@ -3911,7 +3911,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds) } if(ws->code_ctx_menu_file_path.size != 0 && range.min.line == range.max.line && ui_clicked(df_icon_buttonf(DF_IconKind_FileOutline, 0, "Go To Disassembly"))) { - D_Entity *thread = d_entity_from_handle(d_interact_regs()->thread); + D_Entity *thread = d_entity_from_handle(d_regs()->thread); U64 vaddr = 0; for(D_LineNode *n = lines.first; n != 0; n = n->next) { @@ -4140,7 +4140,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds) { if(entity->kind == D_EntityKind_Thread) { - B32 is_selected = d_handle_match(d_base_interact_regs()->thread, d_handle_from_entity(entity)); + B32 is_selected = d_handle_match(d_base_regs()->thread, d_handle_from_entity(entity)); if(is_selected) { df_icon_buttonf(DF_IconKind_Thread, 0, "[Selected]###select_entity"); @@ -4566,8 +4566,8 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds) Temp scratch = scratch_begin(&arena, 1); //- rjf: unpack lister params - D_Entity *thread = d_entity_from_handle(d_base_interact_regs()->thread); - U64 thread_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, d_base_interact_regs()->unwind_count); + D_Entity *thread = d_entity_from_handle(d_base_regs()->thread); + U64 thread_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, d_base_regs()->unwind_count); D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process); D_Entity *module = d_module_from_process_vaddr(process, thread_rip_vaddr); U64 thread_rip_voff = d_voff_from_vaddr(module, thread_rip_vaddr); @@ -6097,9 +6097,9 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds) { Temp scratch = scratch_begin(&arena, 1); DI_Scope *scope = di_scope_open(); - D_Entity *thread = d_entity_from_handle(d_base_interact_regs()->thread); + D_Entity *thread = d_entity_from_handle(d_base_regs()->thread); D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process); - U64 thread_unwind_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, d_base_interact_regs()->unwind_count); + U64 thread_unwind_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, d_base_regs()->unwind_count); String8 expr = ws->hover_eval_string; E_Eval eval = e_eval_from_string(scratch.arena, expr); D_CfgTable top_level_cfg_table = {0}; @@ -7030,12 +7030,12 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds) UI_WidthFill { //- rjf: push interaction registers, fill with per-view states - d_push_interact_regs(); + d_push_regs(); { DF_View *view = df_selected_tab_from_panel(panel); - d_interact_regs()->panel = df_handle_from_panel(panel); - d_interact_regs()->view = df_handle_from_view(view); - d_interact_regs()->file_path = d_file_path_from_eval_string(d_frame_arena(), str8(view->query_buffer, view->query_string_size)); + d_regs()->panel = df_handle_from_panel(panel); + d_regs()->view = df_handle_from_view(view); + d_regs()->file_path = d_file_path_from_eval_string(d_frame_arena(), str8(view->query_buffer, view->query_string_size)); } //- rjf: build view container @@ -7062,10 +7062,10 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds) } //- rjf: pop interaction registers; commit if this is the selected view - D_InteractRegs *view_regs = d_pop_interact_regs(); + D_Regs *view_regs = d_pop_regs(); if(ws->focused_panel == panel) { - MemoryCopyStruct(d_interact_regs(), view_regs); + MemoryCopyStruct(d_regs(), view_regs); } } @@ -8223,7 +8223,7 @@ df_append_value_strings_from_eval(Arena *arena, D_EvalVizStringFlags flags, U32 E_Eval value_eval = e_value_eval_from_eval(eval); B32 ptee_has_content = (direct_type_kind != E_TypeKind_Null && direct_type_kind != E_TypeKind_Void); B32 ptee_has_string = (E_TypeKind_Char8 <= direct_type_kind && direct_type_kind <= E_TypeKind_UChar32); - D_Entity *thread = d_entity_from_handle(d_interact_regs()->thread); + D_Entity *thread = d_entity_from_handle(d_regs()->thread); D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process); String8 symbol_name = d_symbol_name_from_process_vaddr(arena, process, value_eval.value.u64, 1); @@ -8511,7 +8511,7 @@ df_value_string_from_eval(Arena *arena, D_EvalVizStringFlags flags, U32 default_ internal void df_set_hover_eval(Vec2F32 pos, String8 file_path, TxtPt pt, U64 vaddr, String8 string) { - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); if(window->hover_eval_last_frame_idx+1 < d_frame_index() && ui_key_match(ui_active_key(UI_MouseButtonKind_Left), ui_key_zero()) && ui_key_match(ui_active_key(UI_MouseButtonKind_Middle), ui_key_zero()) && @@ -8753,7 +8753,7 @@ df_view_rule_autocomp_lister_params_from_input_cursor(Arena *arena, String8 stri internal void df_set_autocomp_lister_query(UI_Key root_key, DF_AutoCompListerParams *params, String8 input, U64 cursor_off) { - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); String8 query = df_autocomp_query_word_from_input_string_off(input, cursor_off); String8 current_query = str8(window->autocomp_lister_query_buffer, window->autocomp_lister_query_size); if(cursor_off != window->autocomp_cursor_off) @@ -8970,7 +8970,7 @@ df_theme_color_from_txt_token_kind(TXT_TokenKind kind) internal UI_Palette * df_palette_from_code(DF_PaletteCode code) { - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); UI_Palette *result = &window->cfg_palettes[code]; return result; } @@ -8988,7 +8988,7 @@ internal F32 df_font_size_from_slot(DF_FontSlot slot) { F32 result = 0; - DF_Window *ws = df_window_from_handle(d_interact_regs()->window); + DF_Window *ws = df_window_from_handle(d_regs()->window); F32 dpi = os_dpi_from_window(ws->os); if(dpi != ws->last_dpi) { @@ -9042,7 +9042,7 @@ df_raster_flags_from_slot(DF_FontSlot slot) internal DF_SettingVal df_setting_val_from_code(DF_SettingCode code) { - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); DF_SettingVal result = {0}; if(window != 0) { @@ -9902,7 +9902,7 @@ df_cmd_list_menu_buttons(U64 count, D_CmdKind *cmds, U32 *fastpath_codepoints) { d_cmd(D_CmdKind_RunCommand, .cmd_spec = spec); ui_ctx_menu_close(); - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); window->menu_bar_focused = 0; } } @@ -10150,7 +10150,7 @@ df_entity_desc_button(D_Entity *entity, FuzzyMatchRangeList *name_matches, Strin { CTRL_Event stop_event = d_ctrl_last_stop_event(); D_Entity *stopped_thread = d_entity_from_ctrl_handle(stop_event.machine_id, stop_event.entity); - D_Entity *selected_thread = d_entity_from_handle(d_base_interact_regs()->thread); + D_Entity *selected_thread = d_entity_from_handle(d_base_regs()->thread); if(selected_thread == entity) { palette = df_palette_from_code(DF_PaletteCode_NeutralPopButton); @@ -10305,7 +10305,7 @@ df_entity_desc_button(D_Entity *entity, FuzzyMatchRangeList *name_matches, Strin else if(ui_right_clicked(sig)) { D_Handle handle = d_handle_from_entity(entity); - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); ui_ctx_menu_open(df_state->entity_ctx_menu_key, sig.box->key, v2f32(0, sig.box->rect.y1 - sig.box->rect.y0)); window->entity_ctx_menu_entity = handle; } @@ -10509,9 +10509,9 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe DF_CodeSliceSignal result = {0}; ProfBeginFunction(); Temp scratch = scratch_begin(0, 0); - D_Entity *selected_thread = d_entity_from_handle(d_interact_regs()->thread); + D_Entity *selected_thread = d_entity_from_handle(d_regs()->thread); D_Entity *selected_thread_process = d_entity_ancestor_from_kind(selected_thread, D_EntityKind_Process); - U64 selected_thread_rip_unwind_vaddr = d_query_cached_rip_from_thread_unwind(selected_thread, d_interact_regs()->unwind_count); + U64 selected_thread_rip_unwind_vaddr = d_query_cached_rip_from_thread_unwind(selected_thread, d_regs()->unwind_count); D_Entity *selected_thread_module = d_module_from_process_vaddr(selected_thread_process, selected_thread_rip_unwind_vaddr); CTRL_Event stop_event = d_ctrl_last_stop_event(); D_Entity *stopper_thread = d_entity_from_ctrl_handle(stop_event.machine_id, stop_event.entity); @@ -10609,7 +10609,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe { continue; } - U64 unwind_count = (thread == selected_thread) ? d_interact_regs()->unwind_count : 0; + U64 unwind_count = (thread == selected_thread) ? d_regs()->unwind_count : 0; U64 thread_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_count); D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process); D_Entity *module = d_module_from_process_vaddr(process, thread_rip_vaddr); @@ -10709,7 +10709,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe { D_Handle handle = d_handle_from_entity(thread); ui_ctx_menu_open(df_state->entity_ctx_menu_key, thread_box->key, v2f32(0, thread_box->rect.y1-thread_box->rect.y0)); - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); window->entity_ctx_menu_entity = handle; } @@ -10767,7 +10767,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe { continue; } - U64 unwind_count = (thread == selected_thread) ? d_interact_regs()->unwind_count : 0; + U64 unwind_count = (thread == selected_thread) ? d_regs()->unwind_count : 0; U64 thread_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_count); D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process); D_Entity *module = d_module_from_process_vaddr(process, thread_rip_vaddr); @@ -10830,7 +10830,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe // rjf: fill out progress t (progress into range of current line's // voff range) - if(d_interact_regs()->file_path.size != 0 && params->line_infos[line_idx].first != 0) + if(d_regs()->file_path.size != 0 && params->line_infos[line_idx].first != 0) { D_LineList *lines = ¶ms->line_infos[line_idx]; D_Line *line = 0; @@ -10865,7 +10865,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe { D_Handle handle = d_handle_from_entity(thread); ui_ctx_menu_open(df_state->entity_ctx_menu_key, thread_box->key, v2f32(0, thread_box->rect.y1-thread_box->rect.y0)); - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); window->entity_ctx_menu_entity = handle; } @@ -10907,7 +10907,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe bp_draw->alive_t = bp->alive_t; bp_draw->do_lines = df_setting_val_from_code(DF_SettingCode_BreakpointLines).s32; bp_draw->do_glow = df_setting_val_from_code(DF_SettingCode_BreakpointGlow).s32; - if(d_interact_regs()->file_path.size != 0) + if(d_regs()->file_path.size != 0) { D_LineList *lines = ¶ms->line_infos[line_idx]; for(D_LineNode *n = lines->first; n != 0; n = n->next) @@ -10966,7 +10966,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe { D_Handle handle = d_handle_from_entity(bp); ui_ctx_menu_open(df_state->entity_ctx_menu_key, bp_box->key, v2f32(0, bp_box->rect.y1-bp_box->rect.y0)); - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); window->entity_ctx_menu_entity = handle; } } @@ -11024,7 +11024,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe { D_Handle handle = d_handle_from_entity(pin); ui_ctx_menu_open(df_state->entity_ctx_menu_key, pin_box->key, v2f32(0, pin_box->rect.y1-pin_box->rect.y0)); - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); window->entity_ctx_menu_entity = handle; } } @@ -11035,7 +11035,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe if(ui_clicked(line_margin_sig)) { d_cmd(D_CmdKind_AddBreakpoint, - .file_path = d_interact_regs()->file_path, + .file_path = d_regs()->file_path, .text_point = txt_pt(line_num, 1), .vaddr = params->line_vaddrs[line_idx]); } @@ -11080,7 +11080,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe { if(n->v.dbgi_key.min_timestamp >= best_stamp) { - has_line_info = (n->v.pt.line == line_num || d_interact_regs()->file_path.size == 0); + has_line_info = (n->v.pt.line == line_num || d_regs()->file_path.size == 0); line_info_line_num = n->v.pt.line; best_stamp = n->v.dbgi_key.min_timestamp; } @@ -11250,7 +11250,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe if(ui_right_clicked(sig)) { ui_ctx_menu_open(df_state->entity_ctx_menu_key, sig.box->key, v2f32(0, sig.box->rect.y1-sig.box->rect.y0)); - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); window->entity_ctx_menu_entity = d_handle_from_entity(pin); } } @@ -11391,11 +11391,11 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe *cursor = *mark = mouse_pt; } ui_ctx_menu_open(df_state->code_ctx_menu_key, ui_key_zero(), sub_2f32(ui_mouse(), v2f32(2, 2))); - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); arena_clear(window->code_ctx_menu_arena); - window->code_ctx_menu_file_path = push_str8_copy(window->code_ctx_menu_arena, d_interact_regs()->file_path); - window->code_ctx_menu_text_key = d_interact_regs()->text_key; - window->code_ctx_menu_lang_kind = d_interact_regs()->lang_kind; + window->code_ctx_menu_file_path = push_str8_copy(window->code_ctx_menu_arena, d_regs()->file_path); + window->code_ctx_menu_text_key = d_regs()->text_key; + window->code_ctx_menu_lang_kind = d_regs()->lang_kind; window->code_ctx_menu_range = txt_rng(*cursor, *mark); if(params->line_num_range.min <= cursor->line && cursor->line < params->line_num_range.max) { @@ -11438,14 +11438,14 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe { d_cmd(D_CmdKind_RelocateEntity, .entity = d_handle_from_entity(dropped_entity), - .file_path = d_interact_regs()->file_path, + .file_path = d_regs()->file_path, .text_point = txt_pt(line_num, 1), .vaddr = line_vaddr); }break; case D_EntityKind_Thread: { U64 new_rip_vaddr = line_vaddr; - if(d_interact_regs()->file_path.size != 0) + if(d_regs()->file_path.size != 0) { D_LineList *lines = ¶ms->line_infos[line_idx]; for(D_LineNode *n = lines->first; n != 0; n = n->next) @@ -11518,7 +11518,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe { U64 line_slice_idx = mouse_pt.line-params->line_num_range.min; D_LineList *lines = ¶ms->line_infos[line_slice_idx]; - if(lines->first != 0 && (d_interact_regs()->file_path.size == 0 || lines->first->v.pt.line == mouse_pt.line)) + if(lines->first != 0 && (d_regs()->file_path.size == 0 || lines->first->v.pt.line == mouse_pt.line)) { DF_RichHoverInfo info = {0}; info.process = d_handle_from_entity(selected_thread_process); @@ -11544,7 +11544,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe U64 line_idx = mouse_pt.line-params->line_num_range.min; line_vaddr = params->line_vaddrs[line_idx]; } - df_set_hover_eval(mouse_expr_baseline_pos, d_interact_regs()->file_path, mouse_pt, line_vaddr, mouse_expr); + df_set_hover_eval(mouse_expr_baseline_pos, d_regs()->file_path, mouse_pt, line_vaddr, mouse_expr); } } @@ -11907,7 +11907,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe D_LineList *lines = ¶ms->line_infos[line_idx]; for(D_LineNode *n = lines->first; n != 0; n = n->next) { - if((n->v.pt.line == line_num || d_interact_regs()->file_path.size == 0) && + if((n->v.pt.line == line_num || d_regs()->file_path.size == 0) && ((di_key_match(&n->v.dbgi_key, &rich_hover.dbgi_key) && n->v.voff_range.min <= rich_hover_voff_range.min && rich_hover_voff_range.min < n->v.voff_range.max) || (params->line_vaddrs[line_idx] == rich_hover.vaddr_range.min && rich_hover.vaddr_range.min != 0))) @@ -12287,7 +12287,7 @@ df_fancy_string_list_from_code_string(Arena *arena, F32 alpha, B32 indirection_s } else { - D_Entity *module = d_entity_from_handle(d_interact_regs()->module); + D_Entity *module = d_entity_from_handle(d_regs()->module); DI_Key dbgi_key = d_dbgi_key_from_module(module); U64 symbol_voff = d_voff_from_dbgi_key_symbol_name(&dbgi_key, token_string); if(symbol_voff != 0) diff --git a/src/dbg_frontend/dbg_frontend_views.c b/src/dbg_frontend/dbg_frontend_views.c index 1d25a2b7..bc90180f 100644 --- a/src/dbg_frontend/dbg_frontend_views.c +++ b/src/dbg_frontend/dbg_frontend_views.c @@ -26,8 +26,8 @@ df_code_view_cmds(DF_View *view, DF_CodeViewState *cv, D_CmdList *cmds, String8 D_Cmd *cmd = &n->cmd; // rjf: mismatched window/panel => skip - if(!d_handle_match(d_interact_regs()->window, cmd->params.window) || - !d_handle_match(d_interact_regs()->panel, cmd->params.panel)) + if(!d_handle_match(d_regs()->window, cmd->params.window) || + !d_handle_match(d_regs()->panel, cmd->params.panel)) { continue; } @@ -88,7 +88,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie F32 scroll_bar_dim = floor_f32(ui_top_font_size()*1.5f); Vec2F32 code_area_dim = v2f32(panel_box_dim.x - scroll_bar_dim, panel_box_dim.y - scroll_bar_dim); S64 num_possible_visible_lines = (S64)(code_area_dim.y/code_line_height)+1; - D_Entity *thread = d_entity_from_handle(d_interact_regs()->thread); + D_Entity *thread = d_entity_from_handle(d_regs()->thread); D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process); ////////////////////////////// @@ -144,7 +144,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie Side search_query_side = Side_Invalid; B32 search_query_is_active = 0; { - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); D_CmdKind query_cmd_kind = d_cmd_kind_from_string(window->query_cmd_spec->info.string); if(query_cmd_kind == D_CmdKind_FindTextForward || query_cmd_kind == D_CmdKind_FindTextBackward) @@ -206,7 +206,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie { D_Entity *bp = n->entity; D_Entity *loc = d_entity_child_from_kind(bp, D_EntityKind_Location); - if(path_match_normalized(loc->name, d_interact_regs()->file_path) && + if(path_match_normalized(loc->name, d_regs()->file_path) && visible_line_num_range.min <= loc->text_point.line && loc->text_point.line <= visible_line_num_range.max) { U64 slice_line_idx = (loc->text_point.line-visible_line_num_range.min); @@ -218,15 +218,15 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie // rjf: find live threads mapping to source code ProfScope("find live threads mapping to this file") { - String8 file_path = d_interact_regs()->file_path; - D_Entity *selected_thread = d_entity_from_handle(d_interact_regs()->thread); + String8 file_path = d_regs()->file_path; + D_Entity *selected_thread = d_entity_from_handle(d_regs()->thread); D_EntityList threads = d_query_cached_entity_list_with_kind(D_EntityKind_Thread); for(D_EntityNode *thread_n = threads.first; thread_n != 0; thread_n = thread_n->next) { D_Entity *thread = thread_n->entity; D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process); - U64 unwind_count = (thread == selected_thread) ? d_interact_regs()->unwind_count : 0; - U64 inline_depth = (thread == selected_thread) ? d_interact_regs()->inline_depth : 0; + U64 unwind_count = (thread == selected_thread) ? d_regs()->unwind_count : 0; + U64 inline_depth = (thread == selected_thread) ? d_regs()->inline_depth : 0; U64 rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_count); U64 last_inst_on_unwound_rip_vaddr = rip_vaddr - !!unwind_count; D_Entity *module = d_module_from_process_vaddr(process, last_inst_on_unwound_rip_vaddr); @@ -252,7 +252,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie { D_Entity *wp = n->entity; D_Entity *loc = d_entity_child_from_kind(wp, D_EntityKind_Location); - if(path_match_normalized(loc->name, d_interact_regs()->file_path) && + if(path_match_normalized(loc->name, d_regs()->file_path) && visible_line_num_range.min <= loc->text_point.line && loc->text_point.line <= visible_line_num_range.max) { U64 slice_line_idx = (loc->text_point.line-visible_line_num_range.min); @@ -264,7 +264,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie // rjf: find all src -> dasm info ProfScope("find all src -> dasm info") { - String8 file_path = d_interact_regs()->file_path; + String8 file_path = d_regs()->file_path; D_LineListArray lines_array = d_lines_array_from_file_path_line_range(scratch.arena, file_path, visible_line_num_range); if(lines_array.count != 0) { @@ -276,12 +276,12 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie // rjf: find live threads mapping to disasm if(dasm_lines) ProfScope("find live threads mapping to this disassembly") { - D_Entity *selected_thread = d_entity_from_handle(d_interact_regs()->thread); + D_Entity *selected_thread = d_entity_from_handle(d_regs()->thread); D_EntityList threads = d_query_cached_entity_list_with_kind(D_EntityKind_Thread); for(D_EntityNode *thread_n = threads.first; thread_n != 0; thread_n = thread_n->next) { D_Entity *thread = thread_n->entity; - U64 unwind_count = (thread == selected_thread) ? d_interact_regs()->unwind_count : 0; + U64 unwind_count = (thread == selected_thread) ? d_regs()->unwind_count : 0; U64 rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_count); if(d_entity_ancestor_from_kind(thread, D_EntityKind_Process) == process && contains_1u64(dasm_vaddr_range, rip_vaddr)) { @@ -396,7 +396,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie Temp scratch = scratch_begin(0, 0); B32 found = 0; B32 first = 1; - S64 line_num_start = d_interact_regs()->cursor.line; + S64 line_num_start = d_regs()->cursor.line; S64 line_num_last = (S64)text_info->lines_count; for(S64 line_num = line_num_start;; first = 0) { @@ -406,18 +406,18 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie // rjf: gather line info String8 line_string = str8_substr(text_data, text_info->lines_ranges[line_num-1]); U64 search_start = 0; - if(d_interact_regs()->cursor.line == line_num && first) + if(d_regs()->cursor.line == line_num && first) { - search_start = d_interact_regs()->cursor.column; + search_start = d_regs()->cursor.column; } // rjf: search string U64 needle_pos = str8_find_needle(line_string, search_start, cv->find_text_fwd, StringMatchFlag_CaseInsensitive); if(needle_pos < line_string.size) { - d_interact_regs()->cursor.line = line_num; - d_interact_regs()->cursor.column = needle_pos+1; - d_interact_regs()->mark = d_interact_regs()->cursor; + d_regs()->cursor.line = line_num; + d_regs()->cursor.column = needle_pos+1; + d_regs()->mark = d_regs()->cursor; found = 1; break; } @@ -449,7 +449,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie Temp scratch = scratch_begin(0, 0); B32 found = 0; B32 first = 1; - S64 line_num_start = d_interact_regs()->cursor.line; + S64 line_num_start = d_regs()->cursor.line; S64 line_num_last = (S64)text_info->lines_count; for(S64 line_num = line_num_start;; first = 0) { @@ -458,9 +458,9 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie // rjf: gather line info String8 line_string = str8_substr(text_data, text_info->lines_ranges[line_num-1]); - if(d_interact_regs()->cursor.line == line_num && first) + if(d_regs()->cursor.line == line_num && first) { - line_string = str8_prefix(line_string, d_interact_regs()->cursor.column-1); + line_string = str8_prefix(line_string, d_regs()->cursor.column-1); } // rjf: search string @@ -476,9 +476,9 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie } if(next_needle_pos < line_string.size) { - d_interact_regs()->cursor.line = line_num; - d_interact_regs()->cursor.column = next_needle_pos+1; - d_interact_regs()->mark = d_interact_regs()->cursor; + d_regs()->cursor.line = line_num; + d_regs()->cursor.column = next_needle_pos+1; + d_regs()->mark = d_regs()->cursor; found = 1; break; } @@ -517,7 +517,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie S64 line_num = cv->goto_line_num; cv->goto_line_num = 0; line_num = Clamp(1, line_num, text_info->lines_count); - d_interact_regs()->cursor = d_interact_regs()->mark = txt_pt(line_num, 1); + d_regs()->cursor = d_regs()->mark = txt_pt(line_num, 1); cv->center_cursor = !cv->contain_cursor || (line_num < target_visible_line_num_range.min+4 || target_visible_line_num_range.max-4 < line_num); } @@ -529,7 +529,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie { if(ui_is_focus_active() && visible_line_num_range.max >= visible_line_num_range.min) { - snap[Axis2_X] = snap[Axis2_Y] = df_do_txt_controls(text_info, text_data, ClampBot(num_possible_visible_lines, 10) - 10, &d_interact_regs()->cursor, &d_interact_regs()->mark, &cv->preferred_column); + snap[Axis2_X] = snap[Axis2_Y] = df_do_txt_controls(text_info, text_data, ClampBot(num_possible_visible_lines, 10) - 10, &d_regs()->cursor, &d_regs()->mark, &cv->preferred_column); } } @@ -546,7 +546,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie DF_CodeSliceSignal sig = {0}; UI_Focus(UI_FocusKind_On) { - sig = df_code_slicef(&code_slice_params, &d_interact_regs()->cursor, &d_interact_regs()->mark, &cv->preferred_column, "txt_view_%p", view); + sig = df_code_slicef(&code_slice_params, &d_regs()->cursor, &d_regs()->mark, &cv->preferred_column, "txt_view_%p", view); } //- rjf: press code slice? -> focus panel @@ -583,9 +583,9 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie } //- rjf: selected text on single line, no query? -> set search text - if(!txt_pt_match(d_interact_regs()->cursor, d_interact_regs()->mark) && d_interact_regs()->cursor.line == d_interact_regs()->mark.line && search_query.size == 0) + if(!txt_pt_match(d_regs()->cursor, d_regs()->mark) && d_regs()->cursor.line == d_regs()->mark.line && search_query.size == 0) { - String8 text = txt_string_from_info_data_txt_rng(text_info, text_data, txt_rng(d_interact_regs()->cursor, d_interact_regs()->mark)); + String8 text = txt_string_from_info_data_txt_rng(text_info, text_data, txt_rng(d_regs()->cursor, d_regs()->mark)); df_set_search_string(text); } } @@ -606,8 +606,8 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie if(cv->center_cursor) { cv->center_cursor = 0; - String8 cursor_line = str8_substr(text_data, text_info->lines_ranges[d_interact_regs()->cursor.line-1]); - F32 cursor_advance = fnt_dim_from_tag_size_string(code_font, code_font_size, 0, code_tab_size, str8_prefix(cursor_line, d_interact_regs()->cursor.column-1)).x; + String8 cursor_line = str8_substr(text_data, text_info->lines_ranges[d_regs()->cursor.line-1]); + F32 cursor_advance = fnt_dim_from_tag_size_string(code_font, code_font_size, 0, code_tab_size, str8_prefix(cursor_line, d_regs()->cursor.column-1)).x; // rjf: scroll x { @@ -619,7 +619,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie // rjf: scroll y { - S64 new_idx = (d_interact_regs()->cursor.line-1) - num_possible_visible_lines/2 + 2; + S64 new_idx = (d_regs()->cursor.line-1) - num_possible_visible_lines/2 + 2; new_idx = Clamp(scroll_idx_rng[Axis2_Y].min, new_idx, scroll_idx_rng[Axis2_Y].max); ui_scroll_pt_target_idx(&view->scroll_pos.y, new_idx); snap[Axis2_Y] = 0; @@ -629,8 +629,8 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie // rjf: snap in X if(snap[Axis2_X]) { - String8 cursor_line = str8_substr(text_data, text_info->lines_ranges[d_interact_regs()->cursor.line-1]); - S64 cursor_off = (S64)(fnt_dim_from_tag_size_string(code_font, code_font_size, 0, code_tab_size, str8_prefix(cursor_line, d_interact_regs()->cursor.column-1)).x + priority_margin_width_px + catchall_margin_width_px + line_num_width_px); + String8 cursor_line = str8_substr(text_data, text_info->lines_ranges[d_regs()->cursor.line-1]); + S64 cursor_off = (S64)(fnt_dim_from_tag_size_string(code_font, code_font_size, 0, code_tab_size, str8_prefix(cursor_line, d_regs()->cursor.column-1)).x + priority_margin_width_px + catchall_margin_width_px + line_num_width_px); Rng1S64 visible_pixel_range = { view->scroll_pos.x.idx, @@ -651,7 +651,7 @@ df_code_view_build(Arena *arena, DF_View *view, DF_CodeViewState *cv, DF_CodeVie // rjf: snap in Y if(snap[Axis2_Y]) { - Rng1S64 cursor_visibility_range = r1s64(d_interact_regs()->cursor.line-4, d_interact_regs()->cursor.line+4); + Rng1S64 cursor_visibility_range = r1s64(d_regs()->cursor.line-4, d_regs()->cursor.line+4); cursor_visibility_range.min = ClampBot(0, cursor_visibility_range.min); cursor_visibility_range.max = ClampBot(0, cursor_visibility_range.max); S64 min_delta = Min(0, cursor_visibility_range.min-(target_visible_line_num_range.min)); @@ -845,7 +845,7 @@ df_string_from_eval_viz_row_column(Arena *arena, D_EvalView *ev, D_EvalVizRow *r case DF_WatchViewColumnKind_Module: { E_Eval eval = e_eval_from_expr(arena, row->expr); - D_Entity *process = d_entity_from_handle(d_interact_regs()->process); + D_Entity *process = d_entity_from_handle(d_regs()->process); D_Entity *module = d_module_from_process_vaddr(process, eval.value.u64); result = d_display_string_from_entity(arena, module); }break; @@ -984,12 +984,12 @@ df_watch_view_build(DF_View *view, DF_WatchViewState *ewv, B32 modifiable, U32 d //- rjf: unpack arguments // FNT_Tag code_font = df_font_from_slot(DF_FontSlot_Code); - D_Entity *thread = d_entity_from_handle(d_interact_regs()->thread); + D_Entity *thread = d_entity_from_handle(d_regs()->thread); Architecture arch = d_architecture_from_entity(thread); CTRL_Unwind base_unwind = d_query_cached_unwind_from_thread(thread); D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process); D_Unwind rich_unwind = d_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind); - U64 thread_ip_vaddr = d_query_cached_rip_from_thread_unwind(thread, d_interact_regs()->unwind_count); + U64 thread_ip_vaddr = d_query_cached_rip_from_thread_unwind(thread, d_regs()->unwind_count); D_EvalViewKey eval_view_key = df_eval_view_key_from_eval_watch_view(ewv); D_EvalView *eval_view = d_eval_view_from_key(eval_view_key); String8 filter = str8(view->query_buffer, view->query_string_size); @@ -1234,7 +1234,7 @@ df_watch_view_build(DF_View *view, DF_WatchViewState *ewv, B32 modifiable, U32 d // case DF_WatchViewFillKind_Registers: { - D_Entity *thread = d_entity_from_handle(d_interact_regs()->thread); + D_Entity *thread = d_entity_from_handle(d_regs()->thread); Architecture arch = d_architecture_from_entity(thread); U64 reg_count = regs_reg_code_count_from_architecture(arch); String8 *reg_strings = regs_reg_code_string_table_from_architecture(arch); @@ -1685,7 +1685,7 @@ df_watch_view_build(DF_View *view, DF_WatchViewState *ewv, B32 modifiable, U32 d { FrameRow *frame_row = &frame_rows[selection_tbl.min.y-1]; d_cmd(D_CmdKind_SelectUnwind, - .entity = d_interact_regs()->thread, + .entity = d_regs()->thread, .unwind_index = frame_row->unwind_idx, .inline_depth = frame_row->inline_depth); } @@ -2364,10 +2364,10 @@ df_watch_view_build(DF_View *view, DF_WatchViewState *ewv, B32 modifiable, U32 d df_loading_overlay(canvas_rect, canvas_view->loading_t, canvas_view->loading_progress_v, canvas_view->loading_progress_v_target); //- rjf: push interaction registers, fill with per-view states - d_push_interact_regs(); + d_push_regs(); { - d_interact_regs()->view = df_handle_from_view(canvas_view); - d_interact_regs()->file_path = d_file_path_from_eval_string(d_frame_arena(), str8(canvas_view->query_buffer, canvas_view->query_string_size)); + d_regs()->view = df_handle_from_view(canvas_view); + d_regs()->file_path = d_file_path_from_eval_string(d_frame_arena(), str8(canvas_view->query_buffer, canvas_view->query_string_size)); } //- rjf: build @@ -2377,7 +2377,7 @@ df_watch_view_build(DF_View *view, DF_WatchViewState *ewv, B32 modifiable, U32 d } //- rjf: pop interaction registers - d_pop_interact_regs(); + d_pop_regs(); } } } @@ -2525,10 +2525,10 @@ df_watch_view_build(DF_View *view, DF_WatchViewState *ewv, B32 modifiable, U32 d }break; case DF_WatchViewColumnKind_FrameSelection: { - if(semantic_idx == d_interact_regs()->unwind_count - d_interact_regs()->inline_depth) + if(semantic_idx == d_regs()->unwind_count - d_regs()->inline_depth) { cell_icon = DF_IconKind_RightArrow; - cell_base_color = d_rgba_from_entity(d_entity_from_handle(d_interact_regs()->thread)); + cell_base_color = d_rgba_from_entity(d_entity_from_handle(d_regs()->thread)); } }break; } @@ -2684,7 +2684,7 @@ df_watch_view_build(DF_View *view, DF_WatchViewState *ewv, B32 modifiable, U32 d { FrameRow *frame_row = &frame_rows[semantic_idx]; d_cmd(D_CmdKind_SelectUnwind, - .entity = d_interact_regs()->thread, + .entity = d_regs()->thread, .unwind_index = frame_row->unwind_idx, .inline_depth = frame_row->inline_depth); } @@ -3461,7 +3461,7 @@ DF_VIEW_UI_FUNCTION_DEF(file_system) DF_PathQuery path_query = df_path_query_from_string(query_normalized_with_opt_slash); F32 row_height_px = floor_f32(ui_top_font_size()*2.5f); F32 scroll_bar_dim = floor_f32(ui_top_font_size()*1.5f); - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); B32 file_selection = !!(window->query_cmd_spec->info.query.flags & D_CmdQueryFlag_AllowFiles); B32 dir_selection = !!(window->query_cmd_spec->info.query.flags & D_CmdQueryFlag_AllowFolders); @@ -4286,7 +4286,7 @@ DF_VIEW_UI_FUNCTION_DEF(entity_lister) { ProfBeginFunction(); Temp scratch = scratch_begin(0, 0); - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); D_CmdSpec *spec = window->query_cmd_spec; D_EntityKind entity_kind = spec->info.query.entity_kind; D_EntityFlags entity_flags_omit = D_EntityFlag_IsFolder; @@ -4632,8 +4632,8 @@ DF_VIEW_CMD_FUNCTION_DEF(target) D_Cmd *cmd = &n->cmd; // rjf: mismatched window/panel => skip - if(!d_handle_match(d_interact_regs()->window, cmd->params.window) || - !d_handle_match(d_interact_regs()->panel, cmd->params.panel)) + if(!d_handle_match(d_regs()->window, cmd->params.window) || + !d_handle_match(d_regs()->panel, cmd->params.panel)) { continue; } @@ -5119,8 +5119,8 @@ DF_VIEW_CMD_FUNCTION_DEF(file_path_map) D_Cmd *cmd = &n->cmd; // rjf: mismatched window/panel => skip - if(!d_handle_match(d_interact_regs()->window, cmd->params.window) || - !d_handle_match(d_interact_regs()->panel, cmd->params.panel)) + if(!d_handle_match(d_regs()->window, cmd->params.window) || + !d_handle_match(d_regs()->panel, cmd->params.panel)) { continue; } @@ -5761,8 +5761,8 @@ DF_VIEW_CMD_FUNCTION_DEF(modules) D_Cmd *cmd = &n->cmd; // rjf: mismatched window/panel => skip - if(!d_handle_match(d_interact_regs()->window, cmd->params.window) || - !d_handle_match(d_interact_regs()->panel, cmd->params.panel)) + if(!d_handle_match(d_regs()->window, cmd->params.window) || + !d_handle_match(d_regs()->panel, cmd->params.panel)) { continue; } @@ -6234,8 +6234,8 @@ DF_VIEW_CMD_FUNCTION_DEF(pending_file) D_Cmd *cmd = &n->cmd; // rjf: mismatched window/panel => skip - if(!d_handle_match(d_interact_regs()->window, cmd->params.window) || - !d_handle_match(d_interact_regs()->panel, cmd->params.panel)) + if(!d_handle_match(d_regs()->window, cmd->params.window) || + !d_handle_match(d_regs()->panel, cmd->params.panel)) { continue; } @@ -6364,10 +6364,10 @@ DF_VIEW_CMD_FUNCTION_DEF(text) TXT_Scope *txt_scope = txt_scope_open(); E_Eval eval = e_eval_from_string(scratch.arena, string); Rng1U64 range = d_range_from_eval_params(eval, params); - d_interact_regs()->text_key = d_key_from_eval_space_range(eval.space, range, 1); - d_interact_regs()->lang_kind = d_lang_kind_from_eval_params(eval, params); + d_regs()->text_key = d_key_from_eval_space_range(eval.space, range, 1); + d_regs()->lang_kind = d_lang_kind_from_eval_params(eval, params); U128 hash = {0}; - TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, d_interact_regs()->text_key, d_interact_regs()->lang_kind, &hash); + TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, d_regs()->text_key, d_regs()->lang_kind, &hash); String8 data = hs_data_from_hash(hs_scope, hash); //- rjf: process general code-view commands @@ -6379,8 +6379,8 @@ DF_VIEW_CMD_FUNCTION_DEF(text) D_Cmd *cmd = &n->cmd; // rjf: mismatched window/panel => skip - if(!d_handle_match(d_interact_regs()->window, cmd->params.window) || - !d_handle_match(d_interact_regs()->panel, cmd->params.panel)) + if(!d_handle_match(d_regs()->window, cmd->params.window) || + !d_handle_match(d_regs()->panel, cmd->params.panel)) { continue; } @@ -6431,17 +6431,17 @@ DF_VIEW_UI_FUNCTION_DEF(text) ////////////////////////////// //- rjf: unpack parameterization info // - d_interact_regs()->cursor.line = d_value_from_params_key(params, str8_lit("cursor_line")).s64; - d_interact_regs()->cursor.column = d_value_from_params_key(params, str8_lit("cursor_column")).s64; - d_interact_regs()->mark.line = d_value_from_params_key(params, str8_lit("mark_line")).s64; - d_interact_regs()->mark.column = d_value_from_params_key(params, str8_lit("mark_column")).s64; + d_regs()->cursor.line = d_value_from_params_key(params, str8_lit("cursor_line")).s64; + d_regs()->cursor.column = d_value_from_params_key(params, str8_lit("cursor_column")).s64; + d_regs()->mark.line = d_value_from_params_key(params, str8_lit("mark_line")).s64; + d_regs()->mark.column = d_value_from_params_key(params, str8_lit("mark_column")).s64; String8 path = d_file_path_from_eval_string(scratch.arena, string); E_Eval eval = e_eval_from_string(scratch.arena, string); Rng1U64 range = d_range_from_eval_params(eval, params); - d_interact_regs()->text_key = d_key_from_eval_space_range(eval.space, range, 1); - d_interact_regs()->lang_kind = d_lang_kind_from_eval_params(eval, params); + d_regs()->text_key = d_key_from_eval_space_range(eval.space, range, 1); + d_regs()->lang_kind = d_lang_kind_from_eval_params(eval, params); U128 hash = {0}; - TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, d_interact_regs()->text_key, d_interact_regs()->lang_kind, &hash); + TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, d_regs()->text_key, d_regs()->lang_kind, &hash); String8 data = hs_data_from_hash(hs_scope, hash); B32 file_is_missing = (path.size != 0 && os_properties_from_file_path(path).modified == 0); B32 key_has_data = !u128_match(hash, u128_zero()) && info.lines_count; @@ -6501,7 +6501,7 @@ DF_VIEW_UI_FUNCTION_DEF(text) // if(path.size != 0) { - d_interact_regs()->lines = d_lines_from_file_path_line_num(d_frame_arena(), path, d_interact_regs()->cursor.line); + d_regs()->lines = d_lines_from_file_path_line_num(d_frame_arena(), path, d_regs()->cursor.line); } ////////////////////////////// @@ -6570,7 +6570,7 @@ DF_VIEW_UI_FUNCTION_DEF(text) ui_label(path); ui_spacer(ui_em(1.5f, 1)); } - ui_labelf("Line: %I64d, Column: %I64d", d_interact_regs()->cursor.line, d_interact_regs()->cursor.column); + ui_labelf("Line: %I64d, Column: %I64d", d_regs()->cursor.line, d_regs()->cursor.column); ui_spacer(ui_pct(1, 0)); ui_labelf("(read only)"); ui_labelf("%s", @@ -6584,10 +6584,10 @@ DF_VIEW_UI_FUNCTION_DEF(text) ////////////////////////////// //- rjf: store params // - df_view_store_param_s64(view, str8_lit("cursor_line"), d_interact_regs()->cursor.line); - df_view_store_param_s64(view, str8_lit("cursor_column"), d_interact_regs()->cursor.column); - df_view_store_param_s64(view, str8_lit("mark_line"), d_interact_regs()->mark.line); - df_view_store_param_s64(view, str8_lit("mark_column"), d_interact_regs()->mark.column); + df_view_store_param_s64(view, str8_lit("cursor_line"), d_regs()->cursor.line); + df_view_store_param_s64(view, str8_lit("cursor_column"), d_regs()->cursor.column); + df_view_store_param_s64(view, str8_lit("mark_line"), d_regs()->mark.line); + df_view_store_param_s64(view, str8_lit("mark_column"), d_regs()->mark.column); txt_scope_close(txt_scope); hs_scope_close(hs_scope); @@ -6648,7 +6648,7 @@ DF_VIEW_CMD_FUNCTION_DEF(disasm) E_Space space = eval.space; if(auto_selected_thread) { - space = d_eval_space_from_entity(d_entity_from_handle(d_interact_regs()->process)); + space = d_eval_space_from_entity(d_entity_from_handle(d_regs()->process)); } Rng1U64 range = d_range_from_eval_params(eval, params); Architecture arch = d_architecture_from_eval_params(eval, params); @@ -6679,10 +6679,10 @@ DF_VIEW_CMD_FUNCTION_DEF(disasm) dasm_params.dbgi_key = dbgi_key; } DASM_Info dasm_info = dasm_info_from_key_params(dasm_scope, dasm_key, &dasm_params, &dasm_data_hash); - d_interact_regs()->text_key = dasm_info.text_key; - d_interact_regs()->lang_kind = txt_lang_kind_from_architecture(arch); + d_regs()->text_key = dasm_info.text_key; + d_regs()->lang_kind = txt_lang_kind_from_architecture(arch); U128 dasm_text_hash = {0}; - TXT_TextInfo dasm_text_info = txt_text_info_from_key_lang(txt_scope, d_interact_regs()->text_key, d_interact_regs()->lang_kind, &dasm_text_hash); + TXT_TextInfo dasm_text_info = txt_text_info_from_key_lang(txt_scope, d_regs()->text_key, d_regs()->lang_kind, &dasm_text_hash); String8 dasm_text_data = hs_data_from_hash(hs_scope, dasm_text_hash); B32 has_disasm = (dasm_info.lines.count != 0 && dasm_text_info.lines_count != 0); B32 is_loading = (!has_disasm && dim_1u64(range) != 0 && eval.msgs.max_kind == E_MsgKind_Null); @@ -6701,8 +6701,8 @@ DF_VIEW_CMD_FUNCTION_DEF(disasm) D_CmdParams params = cmd->params; // rjf: mismatched window/panel => skip - if(!d_handle_match(d_interact_regs()->window, cmd->params.window) || - !d_handle_match(d_interact_regs()->panel, cmd->params.panel)) + if(!d_handle_match(d_regs()->window, cmd->params.window) || + !d_handle_match(d_regs()->panel, cmd->params.panel)) { continue; } @@ -6770,8 +6770,8 @@ DF_VIEW_UI_FUNCTION_DEF(disasm) F32 bottom_bar_height = ui_top_font_size()*2.f; Rng2F32 code_area_rect = r2f32p(rect.x0, rect.y0, rect.x1, rect.y1 - bottom_bar_height); Rng2F32 bottom_bar_rect = r2f32p(rect.x0, rect.y1 - bottom_bar_height, rect.x1, rect.y1); - d_interact_regs()->cursor = dv->cursor; - d_interact_regs()->mark = dv->mark; + d_regs()->cursor = dv->cursor; + d_regs()->mark = dv->mark; ////////////////////////////// //- rjf: unpack parameterization info @@ -6780,7 +6780,7 @@ DF_VIEW_UI_FUNCTION_DEF(disasm) E_Space space = eval.space; if(auto_selected_thread) { - space = d_eval_space_from_entity(d_entity_from_handle(d_interact_regs()->process)); + space = d_eval_space_from_entity(d_entity_from_handle(d_regs()->process)); } Rng1U64 range = d_range_from_eval_params(eval, params); Architecture arch = d_architecture_from_eval_params(eval, params); @@ -6811,10 +6811,10 @@ DF_VIEW_UI_FUNCTION_DEF(disasm) dasm_params.dbgi_key = dbgi_key; } DASM_Info dasm_info = dasm_info_from_key_params(dasm_scope, dasm_key, &dasm_params, &dasm_data_hash); - d_interact_regs()->text_key = dasm_info.text_key; - d_interact_regs()->lang_kind = txt_lang_kind_from_architecture(arch); + d_regs()->text_key = dasm_info.text_key; + d_regs()->lang_kind = txt_lang_kind_from_architecture(arch); U128 dasm_text_hash = {0}; - TXT_TextInfo dasm_text_info = txt_text_info_from_key_lang(txt_scope, d_interact_regs()->text_key, d_interact_regs()->lang_kind, &dasm_text_hash); + TXT_TextInfo dasm_text_info = txt_text_info_from_key_lang(txt_scope, d_regs()->text_key, d_regs()->lang_kind, &dasm_text_hash); String8 dasm_text_data = hs_data_from_hash(hs_scope, dasm_text_hash); B32 has_disasm = (dasm_info.lines.count != 0 && dasm_text_info.lines_count != 0); B32 is_loading = (!has_disasm && dim_1u64(range) != 0 && eval.msgs.max_kind == E_MsgKind_Null); @@ -6852,10 +6852,10 @@ DF_VIEW_UI_FUNCTION_DEF(disasm) // if(!is_loading && has_disasm) { - U64 off = dasm_line_array_code_off_from_idx(&dasm_info.lines, d_interact_regs()->cursor.line-1); - d_interact_regs()->vaddr_range = r1u64(base_vaddr+off, base_vaddr+off); - d_interact_regs()->voff_range = d_voff_range_from_vaddr_range(dasm_module, d_interact_regs()->vaddr_range); - d_interact_regs()->lines = d_lines_from_dbgi_key_voff(d_frame_arena(), &dbgi_key, d_interact_regs()->voff_range.min); + U64 off = dasm_line_array_code_off_from_idx(&dasm_info.lines, d_regs()->cursor.line-1); + d_regs()->vaddr_range = r1u64(base_vaddr+off, base_vaddr+off); + d_regs()->voff_range = d_voff_range_from_vaddr_range(dasm_module, d_regs()->vaddr_range); + d_regs()->lines = d_lines_from_dbgi_key_voff(d_frame_arena(), &dbgi_key, d_regs()->voff_range.min); } ////////////////////////////// @@ -6871,13 +6871,13 @@ DF_VIEW_UI_FUNCTION_DEF(disasm) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) DF_Font(DF_FontSlot_Code) { - U64 cursor_vaddr = (1 <= d_interact_regs()->cursor.line && d_interact_regs()->cursor.line <= dasm_info.lines.count) ? (range.min+dasm_info.lines.v[d_interact_regs()->cursor.line-1].code_off) : 0; + U64 cursor_vaddr = (1 <= d_regs()->cursor.line && d_regs()->cursor.line <= dasm_info.lines.count) ? (range.min+dasm_info.lines.v[d_regs()->cursor.line-1].code_off) : 0; if(!d_entity_is_nil(dasm_module)) { ui_labelf("%S", path_normalized_from_string(scratch.arena, dasm_module->name)); ui_spacer(ui_em(1.5f, 1)); } - ui_labelf("Address: 0x%I64x, Line: %I64d, Column: %I64d", cursor_vaddr, d_interact_regs()->cursor.line, d_interact_regs()->cursor.column); + ui_labelf("Address: 0x%I64x, Line: %I64d, Column: %I64d", cursor_vaddr, d_regs()->cursor.line, d_regs()->cursor.column); ui_spacer(ui_pct(1, 0)); ui_labelf("(read only)"); ui_labelf("bin"); @@ -6887,8 +6887,8 @@ DF_VIEW_UI_FUNCTION_DEF(disasm) ////////////////////////////// //- rjf: commit storage // - dv->cursor = d_interact_regs()->cursor; - dv->mark = d_interact_regs()->mark; + dv->cursor = d_regs()->cursor; + dv->mark = d_regs()->mark; txt_scope_close(txt_scope); dasm_scope_close(dasm_scope); @@ -6911,10 +6911,10 @@ DF_VIEW_CMD_FUNCTION_DEF(output) Temp scratch = scratch_begin(0, 0); HS_Scope *hs_scope = hs_scope_open(); TXT_Scope *txt_scope = txt_scope_open(); - d_interact_regs()->text_key = d_state->output_log_key; - d_interact_regs()->lang_kind = TXT_LangKind_Null; + d_regs()->text_key = d_state->output_log_key; + d_regs()->lang_kind = TXT_LangKind_Null; U128 hash = {0}; - TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, d_interact_regs()->text_key, d_interact_regs()->lang_kind, &hash); + TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, d_regs()->text_key, d_regs()->lang_kind, &hash); String8 data = hs_data_from_hash(hs_scope, hash); df_code_view_cmds(view, cv, cmds, data, &info, 0, r1u64(0, 0), di_key_zero()); txt_scope_close(txt_scope); @@ -6972,7 +6972,7 @@ DF_VIEW_UI_FUNCTION_DEF(output) { ui_labelf("(Debug String Output)"); ui_spacer(ui_em(1.5f, 1)); - ui_labelf("Line: %I64d, Column: %I64d", d_interact_regs()->cursor.line, d_interact_regs()->cursor.column); + ui_labelf("Line: %I64d, Column: %I64d", d_regs()->cursor.line, d_regs()->cursor.column); ui_spacer(ui_pct(1, 0)); ui_labelf("(read only)"); } @@ -7052,7 +7052,7 @@ DF_VIEW_UI_FUNCTION_DEF(memory) E_Eval eval = e_eval_from_string(scratch.arena, string); if(u128_match(eval.space, u128_zero())) { - eval.space = d_eval_space_from_entity(d_entity_from_handle(d_interact_regs()->process)); + eval.space = d_eval_space_from_entity(d_entity_from_handle(d_regs()->process)); } Rng1U64 space_range = d_whole_range_from_eval_space(eval.space); U64 cursor = d_value_from_params_key(params, str8_lit("cursor_vaddr")).u64; @@ -7274,7 +7274,7 @@ DF_VIEW_UI_FUNCTION_DEF(memory) }; AnnotationList *visible_memory_annotations = push_array(scratch.arena, AnnotationList, visible_memory_size); { - D_Entity *thread = d_entity_from_handle(d_interact_regs()->thread); + D_Entity *thread = d_entity_from_handle(d_regs()->thread); D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process); CTRL_Unwind unwind = d_query_cached_unwind_from_thread(thread); @@ -7346,7 +7346,7 @@ DF_VIEW_UI_FUNCTION_DEF(memory) df_rgba_from_theme_color(DF_ThemeColor_Thread6), df_rgba_from_theme_color(DF_ThemeColor_Thread7), }; - U64 thread_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, d_interact_regs()->unwind_count); + U64 thread_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, d_regs()->unwind_count); for(E_String2NumMapNode *n = e_parse_ctx->locals_map->first; n != 0; n = n->order_next) { String8 local_name = n->string; @@ -8572,7 +8572,7 @@ DF_VIEW_UI_FUNCTION_DEF(settings) Temp scratch = scratch_begin(0, 0); F32 row_height_px = floor_f32(ui_top_font_size()*2.5f); String8 query = string; - DF_Window *window = df_window_from_handle(d_interact_regs()->window); + DF_Window *window = df_window_from_handle(d_regs()->window); ////////////////////////////// //- rjf: get state diff --git a/src/raddbg/raddbg.c b/src/raddbg/raddbg.c index 7c8f2d0e..325f60a8 100644 --- a/src/raddbg/raddbg.c +++ b/src/raddbg/raddbg.c @@ -332,13 +332,13 @@ update_and_render(OS_Handle repaint_window_handle, void *user_data) { last_focused_window = df_handle_from_window(w); } - d_push_interact_regs(); - d_interact_regs()->window = df_handle_from_window(w); + d_push_regs(); + d_regs()->window = df_handle_from_window(w); df_window_update_and_render(scratch.arena, w, &cmds); - D_InteractRegs *window_regs = d_pop_interact_regs(); + D_Regs *window_regs = d_pop_regs(); if(df_window_from_handle(last_focused_window) == w) { - MemoryCopyStruct(d_interact_regs(), window_regs); + MemoryCopyStruct(d_regs(), window_regs); } } }