further progress on cmds -> msgs in debug frontend

This commit is contained in:
Ryan Fleury
2024-08-31 09:02:42 -07:00
parent 2696c96f75
commit 45d3702c5b
6 changed files with 593 additions and 155 deletions
+77 -72
View File
@@ -156,106 +156,106 @@ D_RegTable:
////////////////////////////////
//~ rjf: Message Tables
@table(name name_lower show_in_ui show_in_ipc_docs q_slot q_ent_kind q_allow_files q_allow_folders q_keep_oi q_select_oi q_is_code q_required canonical_icon desc)
@table(name name_display name_lower show_in_ui show_in_ipc_docs q_slot q_ent_kind q_allow_files q_allow_folders q_keep_oi q_select_oi q_is_code q_required canonical_icon desc)
D_MsgKindTable:
{
{Null null 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Null "" null 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: low level target operations
{LaunchAndRun launch_and_run 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{LaunchAndInit launch_and_init 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Kill kill 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{KillAll kill_all 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Attach attach 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Detach detach 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Continue continue 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepIntoInst step_into_inst 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepOverInst step_over_inst 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepIntoLine step_into_line 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepOverLine step_over_line 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepOut step_out 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Halt halt 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SoftHaltRefresh soft_halt_refresh 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SetThreadIP set_thread_ip 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{LaunchAndRun "Launch And Run" launch_and_run 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{LaunchAndStepInto "Launch And Step Into" launch_and_step_into 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Kill "Kill" kill 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{KillAll "Kill All" kill_all 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Attach "Attach" attach 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Detach "Detach" detach 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Continue "Continue" continue 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepIntoInst "Step Into Inst" step_into_inst 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepOverInst "Step Over Inst" step_over_inst 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepIntoLine "Step Into Line" step_into_line 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepOverLine "Step Over Line" step_over_line 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepOut "Step Out" step_out 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Halt "Halt" halt 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SoftHaltRefresh "Soft Halt Refresh" soft_halt_refresh 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SetThreadIP "Set Thread IP" set_thread_ip 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: high level target operations
{RunToLine run_to_line 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RunToAddress run_to_address 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Run run 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Restart restart 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepInto step_into 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepOver step_over 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RunToLine "Run To Line" run_to_line 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RunToAddress "Run To Address" run_to_address 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Run "Run" run 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{Restart "Restart" restart 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepInto "Step Into" step_into 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{StepOver "Step Over" step_over 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: thread / frame selection
{SelectThread select_thread 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SelectUnwind select_unwind 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{UpOneFrame up_one_frame 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{DownOneFrame down_one_frame 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SelectThread "Select Thread" select_thread 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SelectUnwind "Select Unwind" select_unwind 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{UpOneFrame "Up One Frame" up_one_frame 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{DownOneFrame "Down One Frame" down_one_frame 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: thread freezing/thawing
{FreezeThread freeze_thread 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ThawThread thaw_thread 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{FreezeProcess freeze_process 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ThawProcess thaw_process 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{FreezeMachine freeze_machine 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ThawMachine thaw_machine 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{FreezeLocalMachine freeze_local_machine 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ThawLocalMachine thaw_local_machine 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{FreezeThread "Freeze Thread" freeze_thread 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ThawThread "Thaw Thread" thaw_thread 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{FreezeProcess "Freeze Process" freeze_process 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ThawProcess "Thaw Process" thaw_process 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{FreezeMachine "Freeze Machine" freeze_machine 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ThawMachine "Thaw Machine" thaw_machine 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{FreezeLocalMachine "Freeze Local Machine" freeze_local_machine 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ThawLocalMachine "Thaw Local Machine" thaw_local_machine 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: path overrides
{SetFileOverrideLinkSrc set_file_override_link_src 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SetFileOverrideLinkDst set_file_override_link_dst 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SetFileReplacementPath set_file_replacement_path 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SetPathMapSrc "Set Path Map Source" set_path_map_src 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SetPathMapDst "Set Path Map Destination" set_path_map_dst 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SetFileReplacementPath "Set File Replacement Path" set_file_replacement_path 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: auto view rules
{SetAutoViewRuleType set_auto_view_rule_type 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SetAutoViewRuleViewRule set_auto_view_rule_view_rule 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SetAutoViewRuleType "Set Auto View Rule Type" set_auto_view_rule_type 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SetAutoViewRuleViewRule "Set Auto View Rule View Rule" set_auto_view_rule_view_rule 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: general entity operations
{EnableEntity enable_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{EnableBreakpoint enable_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{EnableTarget enable_target 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{DisableEntity disable_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{DisableBreakpoint disable_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{DisableTarget disable_target 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{FreezeEntity freeze_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ThawEntity thaw_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RemoveEntity remove_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RemoveBreakpoint remove_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RemoveTarget remove_target 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{NameEntity name_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{DuplicateEntity duplicate_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RelocateEntity relocate_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{EnableEntity "Enable Entity" enable_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{EnableBreakpoint "Enable Breakpoint" enable_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{EnableTarget "Enable Target" enable_target 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{DisableEntity "Disable Entity" disable_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{DisableBreakpoint "Disable Breakpoint" disable_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{DisableTarget "Disable Target" disable_target 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{FreezeEntity "Freeze Entity" freeze_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ThawEntity "Thaw Entity" thaw_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RemoveEntity "Remove Entity" remove_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RemoveBreakpoint "Remove Breakpoint" remove_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RemoveTarget "Remove Target" remove_target 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{NameEntity "Name Entity" name_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{DuplicateEntity "Duplicate Entity" duplicate_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RelocateEntity "Relocate Entity" relocate_entity 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: breakpoints
{AddBreakpoint add_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ToggleBreakpoint toggle_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{AddAddressBreakpoint add_address_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{AddFunctionBreakpoint add_function_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{AddBreakpoint "Add Breakpoint" add_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ToggleBreakpoint "Toggle Breakpoint" toggle_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{AddAddressBreakpoint "Add Address Breakpoint" add_address_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{AddFunctionBreakpoint "Add Function Breakpoint" add_function_breakpoint 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: watch pins
{AddWatchPin add_watch_pin 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ToggleWatchPin toggle_watch_pin 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{AddWatchPin "Add Watch Pin" add_watch_pin 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ToggleWatchPin "Toggle Watch Pin" toggle_watch_pin 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: watch expressions
{ToggleWatchExpression toggle_watch_expression 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ToggleWatchExpression "Toggle Watch Expression" toggle_watch_expression 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: at-cursor operations
{ToggleBreakpointAtCursor toggle_breakpoint_at_cursor 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ToggleWatchPinAtCursor toggle_watch_pin_at_cursor 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ToggleWatchExpressionAtCursor toggle_watch_expression_at_cursor 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{GoToNameAtCursor go_to_name_at_cursor 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RunToCursor run_to_cursor 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SetNextStatement set_next_statement 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ToggleBreakpointAtCursor "Toggle Breakpoint At Cursor" toggle_breakpoint_at_cursor 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ToggleWatchPinAtCursor "Toggle Watch Pin At Cursor" toggle_watch_pin_at_cursor 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{ToggleWatchExpressionAtCursor "Toggle Watch Expression At Cursor" toggle_watch_expression_at_cursor 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{GoToNameAtCursor "Go To Name At Cursor" go_to_name_at_cursor 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RunToCursor "Run To Cursor" run_to_cursor 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SetNextStatement "Set Next Statement" set_next_statement 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: targets
{AddTarget add_target 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SelectTarget select_target 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RetryEndedProcess retry_ended_process 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{AddTarget "Add Target" add_target 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{SelectTarget "Select Target" select_target 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RetryEndedProcess "Retry Ended Process" retry_ended_process 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: meta
{RegisterAsJITDebugger register_as_jit_debugger 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{LogMarker log_marker 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{RegisterAsJITDebugger "Register As JIT Debugger" register_as_jit_debugger 0 0 Null Nil 0 0 0 0 0 0 Null ""}
{LogMarker "Log Marker" log_marker 0 0 Null Nil 0 0 0 0 0 0 Null ""}
}
@enum D_MsgKind:
@@ -269,6 +269,11 @@ D_MsgKindTable:
@expand(D_MsgKindTable a) `str8_lit_comp("$(a.name_lower)")`
}
@data(String8) d_msg_kind_name_display_table:
{
@expand(D_MsgKindTable a) `str8_lit_comp("$(a.name_lower)")`
}
////////////////////////////////
//~ rjf: Built-In Command Tables
+7 -48
View File
@@ -5653,8 +5653,8 @@ d_cfg_strings_from_core(Arena *arena, String8 root_path, D_CfgSrc source)
entity_name_escaped = d_cfg_escaped_from_raw_string(arena, e->string);
}
EntityInfoFlags info_flags = 0;
if(entity_name_escaped.size != 0) { info_flags |= EntityInfoFlag_HasName; }
if(!!e->disabled) { info_flags |= EntityInfoFlag_HasDisabled; }
if(entity_name_escaped.size != 0) { info_flags |= EntityInfoFlag_HasName; }
if(!!e->disabled) { info_flags |= EntityInfoFlag_HasDisabled; }
if(e->flags & D_EntityFlag_HasTextPoint) { info_flags |= EntityInfoFlag_HasTxtPt; }
if(e->flags & D_EntityFlag_HasVAddr) { info_flags |= EntityInfoFlag_HasVAddr; }
if(e->flags & D_EntityFlag_HasColor) { info_flags |= EntityInfoFlag_HasColor; }
@@ -5755,47 +5755,6 @@ d_cfg_strings_from_core(Arena *arena, String8 root_path, D_CfgSrc source)
str8_list_push(arena, &strs, str8_lit("}\n\n"));
}
//- rjf: write eval view cache
#if 0
if(source == D_CfgSrc_Project)
{
B32 first = 1;
for(U64 eval_view_slot_idx = 0;
eval_view_slot_idx < d_state->eval_view_cache.slots_count;
eval_view_slot_idx += 1)
{
for(D_EvalView *ev = d_state->eval_view_cache.slots[idx].first;
ev != &d_nil_eval_view && ev != 0;
ev = ev->hash_next)
{
if(first)
{
first = 0;
str8_list_push(arena, &strs, str8_lit("/// eval view state ///////////////////////////////////////////////////////////\n"));
str8_list_push(arena, &strs, str8_lit("\n"));
}
str8_list_push(arena, &strs, str8_lit("eval_view:\n"));
str8_list_push(arena, &strs, str8_lit("{\n"));
str8_list_pushf(arena, &strs, " key: (%I64x, %I64x)\n", ev->key.u64[0], ev->key.u64[1]);
for(U64 expand_slot_idx = 0;
expand_slot_idx < ev->expand_tree_table.slots_count;
expand_slot_idx += 1)
{
for(D_ExpandNode *expand_node = ev->expand_tree_table.slots[expand_slot_idx].first;
expand_node != 0;
expand_node = expand_node->hash_next)
{
D_ExpandKey key = expand_node->key;
B32 expanded = expand_node->expanded;
str8_list_pushf(arena, &strs, " node: ()\n");
}
}
str8_list_push(arena, &strs, str8_lit("}\n\n"));
}
}
}
#endif
ProfEnd();
return strs;
}
@@ -6918,7 +6877,7 @@ d_tick(Arena *arena, DI_Scope *di_scope, D_CmdList *cmds, F32 dt)
//- rjf: [low level target operations] target launching
case D_MsgKind_LaunchAndRun:
case D_MsgKind_LaunchAndInit:
case D_MsgKind_LaunchAndStepInto:
{
// rjf: get list of targets to launch
D_EntityList targets = d_entity_list_from_handle_list(scratch.arena, regs->entity_list);
@@ -6990,7 +6949,7 @@ d_tick(Arena *arena, DI_Scope *di_scope, D_CmdList *cmds, F32 dt)
}
// rjf: run
d_ctrl_run(D_RunKind_Run, &d_nil_entity, CTRL_RunFlag_StopOnEntryPoint * (msg->kind == D_MsgKind_LaunchAndInit), 0);
d_ctrl_run(D_RunKind_Run, &d_nil_entity, CTRL_RunFlag_StopOnEntryPoint * (msg->kind == D_MsgKind_LaunchAndStepInto), 0);
}
// rjf: no targets -> error
@@ -7281,7 +7240,7 @@ d_tick(Arena *arena, DI_Scope *di_scope, D_CmdList *cmds, F32 dt)
else if(!d_ctrl_targets_running())
{
D_EntityList targets = d_push_active_target_list(scratch.arena);
d_msg(D_MsgKind_LaunchAndInit, .entity_list = d_handle_list_from_entity_list(scratch.arena, targets));
d_msg(D_MsgKind_LaunchAndStepInto, .entity_list = d_handle_list_from_entity_list(scratch.arena, targets));
}
}break;
@@ -7385,8 +7344,8 @@ d_tick(Arena *arena, DI_Scope *di_scope, D_CmdList *cmds, F32 dt)
}break;
//- rjf: path overrides (TODO(rjf))
case D_MsgKind_SetFileOverrideLinkSrc:{}break;
case D_MsgKind_SetFileOverrideLinkDst:{}break;
case D_MsgKind_SetPathMapSrc:{}break;
case D_MsgKind_SetPathMapDst:{}break;
case D_MsgKind_SetFileReplacementPath:{}break;
//- rjf: auto view rules (TODO(rjf))
+78 -3
View File
@@ -40,7 +40,7 @@ String8 d_msg_kind_name_lower_table[71] =
{
str8_lit_comp("null"),
str8_lit_comp("launch_and_run"),
str8_lit_comp("launch_and_init"),
str8_lit_comp("launch_and_step_into"),
str8_lit_comp("kill"),
str8_lit_comp("kill_all"),
str8_lit_comp("attach"),
@@ -72,8 +72,83 @@ str8_lit_comp("freeze_machine"),
str8_lit_comp("thaw_machine"),
str8_lit_comp("freeze_local_machine"),
str8_lit_comp("thaw_local_machine"),
str8_lit_comp("set_file_override_link_src"),
str8_lit_comp("set_file_override_link_dst"),
str8_lit_comp("set_path_map_src"),
str8_lit_comp("set_path_map_dst"),
str8_lit_comp("set_file_replacement_path"),
str8_lit_comp("set_auto_view_rule_type"),
str8_lit_comp("set_auto_view_rule_view_rule"),
str8_lit_comp("enable_entity"),
str8_lit_comp("enable_breakpoint"),
str8_lit_comp("enable_target"),
str8_lit_comp("disable_entity"),
str8_lit_comp("disable_breakpoint"),
str8_lit_comp("disable_target"),
str8_lit_comp("freeze_entity"),
str8_lit_comp("thaw_entity"),
str8_lit_comp("remove_entity"),
str8_lit_comp("remove_breakpoint"),
str8_lit_comp("remove_target"),
str8_lit_comp("name_entity"),
str8_lit_comp("duplicate_entity"),
str8_lit_comp("relocate_entity"),
str8_lit_comp("add_breakpoint"),
str8_lit_comp("toggle_breakpoint"),
str8_lit_comp("add_address_breakpoint"),
str8_lit_comp("add_function_breakpoint"),
str8_lit_comp("add_watch_pin"),
str8_lit_comp("toggle_watch_pin"),
str8_lit_comp("toggle_watch_expression"),
str8_lit_comp("toggle_breakpoint_at_cursor"),
str8_lit_comp("toggle_watch_pin_at_cursor"),
str8_lit_comp("toggle_watch_expression_at_cursor"),
str8_lit_comp("go_to_name_at_cursor"),
str8_lit_comp("run_to_cursor"),
str8_lit_comp("set_next_statement"),
str8_lit_comp("add_target"),
str8_lit_comp("select_target"),
str8_lit_comp("retry_ended_process"),
str8_lit_comp("register_as_jit_debugger"),
str8_lit_comp("log_marker"),
};
String8 d_msg_kind_name_display_table[71] =
{
str8_lit_comp("null"),
str8_lit_comp("launch_and_run"),
str8_lit_comp("launch_and_step_into"),
str8_lit_comp("kill"),
str8_lit_comp("kill_all"),
str8_lit_comp("attach"),
str8_lit_comp("detach"),
str8_lit_comp("continue"),
str8_lit_comp("step_into_inst"),
str8_lit_comp("step_over_inst"),
str8_lit_comp("step_into_line"),
str8_lit_comp("step_over_line"),
str8_lit_comp("step_out"),
str8_lit_comp("halt"),
str8_lit_comp("soft_halt_refresh"),
str8_lit_comp("set_thread_ip"),
str8_lit_comp("run_to_line"),
str8_lit_comp("run_to_address"),
str8_lit_comp("run"),
str8_lit_comp("restart"),
str8_lit_comp("step_into"),
str8_lit_comp("step_over"),
str8_lit_comp("select_thread"),
str8_lit_comp("select_unwind"),
str8_lit_comp("up_one_frame"),
str8_lit_comp("down_one_frame"),
str8_lit_comp("freeze_thread"),
str8_lit_comp("thaw_thread"),
str8_lit_comp("freeze_process"),
str8_lit_comp("thaw_process"),
str8_lit_comp("freeze_machine"),
str8_lit_comp("thaw_machine"),
str8_lit_comp("freeze_local_machine"),
str8_lit_comp("thaw_local_machine"),
str8_lit_comp("set_path_map_src"),
str8_lit_comp("set_path_map_dst"),
str8_lit_comp("set_file_replacement_path"),
str8_lit_comp("set_auto_view_rule_type"),
str8_lit_comp("set_auto_view_rule_view_rule"),
+4 -3
View File
@@ -42,7 +42,7 @@ typedef enum D_MsgKind
{
D_MsgKind_Null,
D_MsgKind_LaunchAndRun,
D_MsgKind_LaunchAndInit,
D_MsgKind_LaunchAndStepInto,
D_MsgKind_Kill,
D_MsgKind_KillAll,
D_MsgKind_Attach,
@@ -74,8 +74,8 @@ D_MsgKind_FreezeMachine,
D_MsgKind_ThawMachine,
D_MsgKind_FreezeLocalMachine,
D_MsgKind_ThawLocalMachine,
D_MsgKind_SetFileOverrideLinkSrc,
D_MsgKind_SetFileOverrideLinkDst,
D_MsgKind_SetPathMapSrc,
D_MsgKind_SetPathMapDst,
D_MsgKind_SetFileReplacementPath,
D_MsgKind_SetAutoViewRuleType,
D_MsgKind_SetAutoViewRuleViewRule,
@@ -572,6 +572,7 @@ struct {B32 *value_ptr; String8 name;} DEV_toggle_table[] =
C_LINKAGE_BEGIN
extern Rng1U64 d_reg_slot_range_table[28];
extern String8 d_msg_kind_name_lower_table[71];
extern String8 d_msg_kind_name_display_table[71];
extern Rng1U64 d_cmd_param_slot_range_table[23];
extern String8 d_entity_kind_display_string_table[31];
extern String8 d_entity_kind_name_lower_table[31];
+426 -28
View File
@@ -8302,6 +8302,11 @@ df_frame(OS_Handle repaint_window_handle)
D_RegsScope
{
d_regs_copy_contents(scratch.arena, d_regs(), regs);
Dir2 split_dir = Dir2_Invalid;
DF_Panel *split_panel = &df_nil_panel;
U64 panel_sib_off = 0;
U64 panel_child_off = 0;
Vec2S32 panel_change_dir = {0};
switch(msg->kind)
{
default:{}break;
@@ -8375,49 +8380,442 @@ df_frame(OS_Handle repaint_window_handle)
case DF_MsgKind_CancelQuery:{}break;
//- rjf: searching
case DF_MsgKind_FindTextForward:{}break;
case DF_MsgKind_FindTextBackward:{}break;
case DF_MsgKind_FindNext:{}break;
case DF_MsgKind_FindPrev:{}break;
case DF_MsgKind_FindTextForward:
case DF_MsgKind_FindTextBackward:
{
df_set_search_string(regs->string);
}break;
case DF_MsgKind_FindNext:{df_msg(DF_MsgKind_FindTextForward);}break;
case DF_MsgKind_FindPrev:{df_msg(DF_MsgKind_FindTextBackward);}break;
//- rjf: font sizes
case DF_MsgKind_IncUIFontScale:{}break;
case DF_MsgKind_DecUIFontScale:{}break;
case DF_MsgKind_IncCodeFontScale:{}break;
case DF_MsgKind_DecCodeFontScale:{}break;
case DF_MsgKind_IncUIFontScale:
{
DF_Window *window = df_window_from_handle(regs->window);
if(window != 0)
{
window->setting_vals[DF_SettingCode_MainFontSize].set = 1;
window->setting_vals[DF_SettingCode_MainFontSize].s32 += 1;
window->setting_vals[DF_SettingCode_MainFontSize].s32 = clamp_1s32(df_g_setting_code_s32_range_table[DF_SettingCode_MainFontSize], window->setting_vals[DF_SettingCode_MainFontSize].s32);
}
}break;
case DF_MsgKind_DecUIFontScale:
{
DF_Window *window = df_window_from_handle(regs->window);
if(window != 0)
{
window->setting_vals[DF_SettingCode_MainFontSize].set = 1;
window->setting_vals[DF_SettingCode_MainFontSize].s32 -= 1;
window->setting_vals[DF_SettingCode_MainFontSize].s32 = clamp_1s32(df_g_setting_code_s32_range_table[DF_SettingCode_MainFontSize], window->setting_vals[DF_SettingCode_MainFontSize].s32);
}
}break;
case DF_MsgKind_IncCodeFontScale:
{
DF_Window *window = df_window_from_handle(regs->window);
if(window != 0)
{
window->setting_vals[DF_SettingCode_CodeFontSize].set = 1;
window->setting_vals[DF_SettingCode_CodeFontSize].s32 += 1;
window->setting_vals[DF_SettingCode_CodeFontSize].s32 = clamp_1s32(df_g_setting_code_s32_range_table[DF_SettingCode_CodeFontSize], window->setting_vals[DF_SettingCode_CodeFontSize].s32);
}
}break;
case DF_MsgKind_DecCodeFontScale:
{
DF_Window *window = df_window_from_handle(regs->window);
if(window != 0)
{
window->setting_vals[DF_SettingCode_CodeFontSize].set = 1;
window->setting_vals[DF_SettingCode_CodeFontSize].s32 -= 1;
window->setting_vals[DF_SettingCode_CodeFontSize].s32 = clamp_1s32(df_g_setting_code_s32_range_table[DF_SettingCode_CodeFontSize], window->setting_vals[DF_SettingCode_CodeFontSize].s32);
}
}break;
//- rjf: panel creation/removal
case DF_MsgKind_NewPanelLeft:{}break;
case DF_MsgKind_NewPanelUp:{}break;
case DF_MsgKind_NewPanelRight:{}break;
case DF_MsgKind_NewPanelDown:{}break;
case DF_MsgKind_SplitPanel:{}break;
case DF_MsgKind_ClosePanel:{}break;
//- rjf: [panel creation/removal] splitting
case DF_MsgKind_NewPanelLeft: {split_dir = Dir2_Left;}goto panel_split;
case DF_MsgKind_NewPanelUp: {split_dir = Dir2_Up;}goto panel_split;
case DF_MsgKind_NewPanelRight:{split_dir = Dir2_Right;}goto panel_split;
case DF_MsgKind_NewPanelDown: {split_dir = Dir2_Down;}goto panel_split;
case DF_MsgKind_SplitPanel:
{
split_dir = regs->dir2;
split_panel = df_panel_from_handle(regs->dst_panel);
}goto panel_split;
panel_split:;
if(split_dir != Dir2_Invalid)
{
DF_Window *ws = df_window_from_handle(regs->dst_panel);
if(df_panel_is_nil(split_panel))
{
split_panel = ws->focused_panel;
}
DF_Panel *new_panel = &df_nil_panel;
Axis2 split_axis = axis2_from_dir2(split_dir);
Side split_side = side_from_dir2(split_dir);
DF_Panel *panel = split_panel;
DF_Panel *parent = panel->parent;
if(!df_panel_is_nil(parent) && parent->split_axis == split_axis)
{
DF_Panel *next = df_panel_alloc(ws);
df_panel_insert(parent, split_side == Side_Max ? panel : panel->prev, next);
next->pct_of_parent = 1.f/parent->child_count;
for(DF_Panel *child = parent->first; !df_panel_is_nil(child); child = child->next)
{
if(child != next)
{
child->pct_of_parent *= (F32)(parent->child_count-1) / (parent->child_count);
}
}
ws->focused_panel = next;
new_panel = next;
}
else
{
DF_Panel *pre_prev = panel->prev;
DF_Panel *pre_parent = parent;
DF_Panel *new_parent = df_panel_alloc(ws);
new_parent->pct_of_parent = panel->pct_of_parent;
if(!df_panel_is_nil(pre_parent))
{
df_panel_remove(pre_parent, panel);
df_panel_insert(pre_parent, pre_prev, new_parent);
}
else
{
ws->root_panel = new_parent;
}
DF_Panel *left = panel;
DF_Panel *right = df_panel_alloc(ws);
new_panel = right;
if(split_side == Side_Min)
{
Swap(DF_Panel *, left, right);
}
df_panel_insert(new_parent, &df_nil_panel, left);
df_panel_insert(new_parent, left, right);
new_parent->split_axis = split_axis;
left->pct_of_parent = 0.5f;
right->pct_of_parent = 0.5f;
ws->focused_panel = new_panel;
}
if(!df_panel_is_nil(new_panel->prev))
{
Rng2F32 prev_rect_pct = new_panel->prev->animated_rect_pct;
new_panel->animated_rect_pct = prev_rect_pct;
new_panel->animated_rect_pct.p0.v[split_axis] = new_panel->animated_rect_pct.p1.v[split_axis];
}
if(!df_panel_is_nil(new_panel->next))
{
Rng2F32 next_rect_pct = new_panel->next->animated_rect_pct;
new_panel->animated_rect_pct = next_rect_pct;
new_panel->animated_rect_pct.p1.v[split_axis] = new_panel->animated_rect_pct.p0.v[split_axis];
}
DF_Panel *move_tab_panel = df_panel_from_handle(regs->panel);
DF_View *move_tab = df_view_from_handle(regs->view);
if(!df_panel_is_nil(new_panel) && !df_view_is_nil(move_tab) && !df_panel_is_nil(move_tab_panel) &&
msg->kind == DF_MsgKind_SplitPanel)
{
df_panel_remove_tab_view(move_tab_panel, move_tab);
df_panel_insert_tab_view(new_panel, new_panel->last_tab_view, move_tab);
new_panel->selected_tab_view = df_handle_from_view(move_tab);
B32 move_tab_panel_is_empty = 1;
for(DF_View *v = move_tab_panel->first_tab_view; !df_view_is_nil(v); v = v->order_next)
{
if(!df_view_is_project_filtered(v))
{
move_tab_panel_is_empty = 0;
break;
}
}
if(move_tab_panel_is_empty && move_tab_panel != ws->root_panel &&
move_tab_panel != new_panel->prev && move_tab_panel != new_panel->next)
{
df_msg(DF_MsgKind_ClosePanel, .panel = df_handle_from_panel(move_tab_panel));
}
}
}
//- rjf: [panel creation/removal] removal
case DF_MsgKind_ClosePanel:
{
DF_Window *ws = df_window_from_handle(regs->window);
DF_Panel *panel = df_panel_from_handle(regs->panel);
DF_Panel *parent = panel->parent;
if(!df_panel_is_nil(parent))
{
Axis2 split_axis = parent->split_axis;
// NOTE(rjf): If we're removing all but the last child of this parent,
// we should just remove both children.
if(parent->child_count == 2)
{
DF_Panel *discard_child = panel;
DF_Panel *keep_child = panel == parent->first ? parent->last : parent->first;
DF_Panel *grandparent = parent->parent;
DF_Panel *parent_prev = parent->prev;
F32 pct_of_parent = parent->pct_of_parent;
// rjf: unhook kept child
df_panel_remove(parent, keep_child);
// rjf: unhook this subtree
if(!df_panel_is_nil(grandparent))
{
df_panel_remove(grandparent, parent);
}
// rjf: release the things we should discard
{
df_panel_release(ws, parent);
df_panel_release(ws, discard_child);
}
// rjf: re-hook our kept child into the overall tree
if(df_panel_is_nil(grandparent))
{
ws->root_panel = keep_child;
}
else
{
df_panel_insert(grandparent, parent_prev, keep_child);
}
keep_child->pct_of_parent = pct_of_parent;
// rjf: reset focus, if needed
if(ws->focused_panel == discard_child)
{
ws->focused_panel = keep_child;
for(DF_Panel *grandchild = ws->focused_panel; !df_panel_is_nil(grandchild); grandchild = grandchild->first)
{
ws->focused_panel = grandchild;
}
}
// rjf: keep-child split-axis == grandparent split-axis? bubble keep-child up into grandparent's children
if(!df_panel_is_nil(grandparent) && grandparent->split_axis == keep_child->split_axis && !df_panel_is_nil(keep_child->first))
{
df_panel_remove(grandparent, keep_child);
DF_Panel *prev = parent_prev;
for(DF_Panel *child = keep_child->first, *next = 0; !df_panel_is_nil(child); child = next)
{
next = child->next;
df_panel_remove(keep_child, child);
df_panel_insert(grandparent, prev, child);
prev = child;
child->pct_of_parent *= keep_child->pct_of_parent;
}
df_panel_release(ws, keep_child);
}
}
// NOTE(rjf): Otherwise we can just remove this child.
else
{
DF_Panel *next = &df_nil_panel;
F32 removed_size_pct = panel->pct_of_parent;
if(df_panel_is_nil(next)) { next = panel->prev; }
if(df_panel_is_nil(next)) { next = panel->next; }
df_panel_remove(parent, panel);
df_panel_release(ws, panel);
if(ws->focused_panel == panel)
{
ws->focused_panel = next;
}
for(DF_Panel *child = parent->first; !df_panel_is_nil(child); child = child->next)
{
child->pct_of_parent /= 1.f-removed_size_pct;
}
}
}
}break;
//- rjf: panel rearranging
case DF_MsgKind_RotatePanelColumns:{}break;
case DF_MsgKind_RotatePanelColumns:
{
DF_Window *ws = df_window_from_handle(regs->window);
DF_Panel *panel = ws->focused_panel;
DF_Panel *parent = &df_nil_panel;
for(DF_Panel *p = panel->parent; !df_panel_is_nil(p); p = p->parent)
{
if(p->split_axis == Axis2_X)
{
parent = p;
break;
}
}
if(!df_panel_is_nil(parent) && parent->child_count > 1)
{
DF_Panel *old_first = parent->first;
DF_Panel *new_first = parent->first->next;
old_first->next = &df_nil_panel;
old_first->prev = parent->last;
parent->last->next = old_first;
new_first->prev = &df_nil_panel;
parent->first = new_first;
parent->last = old_first;
}
}break;
//- rjf: panel focusing
case DF_MsgKind_NextPanel:{}break;
case DF_MsgKind_PrevPanel:{}break;
case DF_MsgKind_FocusPanel:{}break;
case DF_MsgKind_FocusPanelRight:{}break;
case DF_MsgKind_FocusPanelLeft:{}break;
case DF_MsgKind_FocusPanelUp:{}break;
case DF_MsgKind_FocusPanelDown:{}break;
case DF_MsgKind_NextPanel: panel_sib_off = OffsetOf(DF_Panel, next); panel_child_off = OffsetOf(DF_Panel, first); goto panel_cycle;
case DF_MsgKind_PrevPanel: panel_sib_off = OffsetOf(DF_Panel, prev); panel_child_off = OffsetOf(DF_Panel, last); goto panel_cycle;
panel_cycle:;
{
DF_Window *ws = df_window_from_handle(regs->window);
for(DF_Panel *panel = ws->focused_panel; !df_panel_is_nil(panel);)
{
DF_PanelRec rec = df_panel_rec_df(panel, panel_sib_off, panel_child_off);
panel = rec.next;
if(df_panel_is_nil(panel))
{
panel = ws->root_panel;
}
if(df_panel_is_nil(panel->first))
{
df_msg(DF_MsgKind_FocusPanel, .panel = df_handle_from_panel(panel));
break;
}
}
}break;
case DF_MsgKind_FocusPanel:
{
DF_Window *ws = df_window_from_handle(regs->window);
DF_Panel *panel = df_panel_from_handle(regs->panel);
if(!df_panel_is_nil(panel))
{
ws->focused_panel = panel;
ws->menu_bar_focused = 0;
ws->query_view_selected = 0;
}
}break;
case DF_MsgKind_FocusPanelRight: panel_change_dir = v2s32(+1, +0); goto msg_focus_panel_dir;
case DF_MsgKind_FocusPanelLeft: panel_change_dir = v2s32(-1, +0); goto msg_focus_panel_dir;
case DF_MsgKind_FocusPanelUp: panel_change_dir = v2s32(+0, -1); goto msg_focus_panel_dir;
case DF_MsgKind_FocusPanelDown: panel_change_dir = v2s32(+0, +1); goto msg_focus_panel_dir;
msg_focus_panel_dir:;
{
DF_Window *ws = df_window_from_handle(regs->window);
DF_Panel *src_panel = ws->focused_panel;
Rng2F32 src_panel_rect = df_target_rect_from_panel(r2f32(v2f32(0, 0), v2f32(1000, 1000)), ws->root_panel, src_panel);
Vec2F32 src_panel_center = center_2f32(src_panel_rect);
Vec2F32 src_panel_half_dim = scale_2f32(dim_2f32(src_panel_rect), 0.5f);
Vec2F32 travel_dim = add_2f32(src_panel_half_dim, v2f32(10.f, 10.f));
Vec2F32 travel_dst = add_2f32(src_panel_center, mul_2f32(travel_dim, v2f32((F32)panel_change_dir.x, (F32)panel_change_dir.y)));
DF_Panel *dst_root = &df_nil_panel;
for(DF_Panel *p = ws->root_panel; !df_panel_is_nil(p); p = df_panel_rec_df_pre(p).next)
{
if(p == src_panel || !df_panel_is_nil(p->first))
{
continue;
}
Rng2F32 p_rect = df_target_rect_from_panel(r2f32(v2f32(0, 0), v2f32(1000, 1000)), ws->root_panel, p);
if(contains_2f32(p_rect, travel_dst))
{
dst_root = p;
break;
}
}
if(!df_panel_is_nil(dst_root))
{
DF_Panel *dst_panel = &df_nil_panel;
for(DF_Panel *p = dst_root; !df_panel_is_nil(p); p = df_panel_rec_df_pre(p).next)
{
if(df_panel_is_nil(p->first) && p != src_panel)
{
dst_panel = p;
break;
}
}
df_msg(DF_MsgKind_FocusPanel, .panel = df_handle_from_panel(dst_panel));
}
}break;
//- rjf: view history navigation
case DF_MsgKind_GoBack:{}break;
case DF_MsgKind_GoForward:{}break;
//- rjf: tab selection
case DF_MsgKind_NextTab:{}break;
case DF_MsgKind_PrevTab:{}break;
case DF_MsgKind_NextTab:
{
DF_Panel *panel = df_panel_from_handle(regs->panel);
DF_View *view = df_selected_tab_from_panel(panel);
DF_View *next_view = view;
for(DF_View *v = view;
!df_view_is_nil(v);
v = df_view_is_nil(v->order_next) ? panel->first_tab_view : v->order_next)
{
if(!df_view_is_project_filtered(v) && v != view)
{
next_view = v;
break;
}
}
view = next_view;
panel->selected_tab_view = df_handle_from_view(view);
}break;
case DF_MsgKind_PrevTab:
{
DF_Panel *panel = df_panel_from_handle(regs->panel);
DF_View *view = df_selected_tab_from_panel(panel);
DF_View *next_view = view;
for(DF_View *v = view;
!df_view_is_nil(v);
v = df_view_is_nil(v->order_prev) ? panel->last_tab_view : v->order_prev)
{
if(!df_view_is_project_filtered(v) && v != view)
{
next_view = v;
break;
}
}
view = next_view;
panel->selected_tab_view = df_handle_from_view(view);
}break;
//- rjf: tab rearranging
case DF_MsgKind_MoveTabRight:{}break;
case DF_MsgKind_MoveTabLeft:{}break;
case DF_MsgKind_MoveTab:{}break;
case DF_MsgKind_MoveTabRight:
case DF_MsgKind_MoveTabLeft:
{
DF_Window *ws = df_window_from_handle(regs->window);
DF_Panel *panel = ws->focused_panel;
DF_View *view = df_selected_tab_from_panel(panel);
DF_View *prev_view = (msg->kind == DF_MsgKind_MoveTabRight ? view->order_next : view->order_prev->order_prev);
if(!df_view_is_nil(prev_view) || msg->kind == DF_MsgKind_MoveTabLeft)
{
df_msg(DF_MsgKind_MoveTab,
.panel = df_handle_from_panel(panel),
.dst_panel = df_handle_from_panel(panel),
.view = df_handle_from_view(view),
.prev_view = df_handle_from_view(prev_view));
}
}break;
case DF_MsgKind_MoveTab:
{
DF_Window * ws = df_window_from_handle(regs->window);
DF_Panel * src_panel = df_panel_from_handle(regs->panel);
DF_View * view = df_view_from_handle(regs->view);
DF_Panel * dst_panel = df_panel_from_handle(regs->dst_panel);
DF_View *prev_view = df_view_from_handle(regs->prev_view);
if(!df_panel_is_nil(src_panel) &&
!df_panel_is_nil(dst_panel) &&
prev_view != view)
{
df_panel_remove_tab_view(src_panel, view);
df_panel_insert_tab_view(dst_panel, prev_view, view);
ws->focused_panel = dst_panel;
B32 src_panel_is_empty = 1;
for(DF_View *v = src_panel->first_tab_view; !df_view_is_nil(v); v = v->order_next)
{
if(!df_view_is_project_filtered(v))
{
src_panel_is_empty = 0;
break;
}
}
if(src_panel_is_empty && src_panel != ws->root_panel)
{
df_msg(DF_MsgKind_ClosePanel, .panel = df_handle_from_panel(src_panel));
}
}
}break;
//- rjf: tab creation/removal
case DF_MsgKind_OpenTab:{}break;
+1 -1
View File
@@ -960,7 +960,7 @@ internal void df_msg_(DF_MsgKind kind, D_Regs *regs);
#define df_msg(kind, ...) df_msg_((kind),\
&(D_Regs)\
{\
d_regs_lit_init_top\
d_regs_lit_init_top \
__VA_ARGS__\
})