eliminate messages - too early for that change; eliminate many usage sites of d_ctrl_run; focus all ctrl thread driving code into one spot

This commit is contained in:
Ryan Fleury
2024-09-08 10:12:10 -07:00
parent 2cc81baffa
commit 6b172396f5
11 changed files with 103 additions and 3312 deletions
-121
View File
@@ -156,127 +156,6 @@ D_RegTable:
``;
}
////////////////////////////////
//~ rjf: Message Tables
@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 ""}
//- rjf: low level target operations
{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" 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" 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" 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
{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" 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" 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" 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" 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" toggle_watch_expression 0 0 Null Nil 0 0 0 0 0 0 Null ""}
//- rjf: at-cursor operations
{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" 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" 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:
{
@expand(D_MsgKindTable a) `$(a.name)`,
COUNT
}
@data(String8) d_msg_kind_name_lower_table:
{
@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
File diff suppressed because it is too large Load Diff
+18 -72
View File
@@ -7,36 +7,6 @@
////////////////////////////////
//~ rjf: Input State Types
typedef struct D_PathMap D_PathMap;
struct D_PathMap
{
String8 src;
String8 dst;
};
typedef struct D_PathMapArray D_PathMapArray;
struct D_PathMapArray
{
D_PathMap *v;
U64 count;
};
typedef struct D_Breakpoint D_Breakpoint;
struct D_Breakpoint
{
String8 file_path;
TxtPt pt;
U64 vaddr;
String8 condition;
};
typedef struct D_BreakpointArray D_BreakpointArray;
struct D_BreakpointArray
{
D_Breakpoint *v;
U64 count;
};
typedef struct D_Target D_Target;
struct D_Target
{
@@ -54,6 +24,23 @@ struct D_TargetArray
U64 count;
};
typedef struct D_Breakpoint D_Breakpoint;
struct D_Breakpoint
{
String8 file_path;
TxtPt pt;
String8 symbol_name;
U64 vaddr;
String8 condition;
};
typedef struct D_BreakpointArray D_BreakpointArray;
struct D_BreakpointArray
{
D_Breakpoint *v;
U64 count;
};
////////////////////////////////
//~ rjf: Handles
@@ -707,31 +694,6 @@ struct D_EvalVizWindowedRowList
U64 count_before_semantic;
};
////////////////////////////////
//~ rjf: Message Types
typedef struct D_Msg D_Msg;
struct D_Msg
{
D_MsgKind kind;
D_Regs *regs;
};
typedef struct D_MsgNode D_MsgNode;
struct D_MsgNode
{
D_MsgNode *next;
D_Msg v;
};
typedef struct D_MsgList D_MsgList;
struct D_MsgList
{
D_MsgNode *first;
D_MsgNode *last;
U64 count;
};
////////////////////////////////
//~ rjf: Command Specification Types
@@ -1032,10 +994,6 @@ struct D_State
D_RegsNode base_regs;
D_RegsNode *top_regs;
// rjf: messages
Arena *msgs_arena;
D_MsgList msgs;
// rjf: top-level command batch
Arena *root_cmd_arena;
D_CmdList root_cmds;
@@ -1608,23 +1566,11 @@ internal void d_errorf(char *fmt, ...);
__VA_ARGS__ \
})
////////////////////////////////
//~ rjf: Message Functions
internal D_MsgKind d_msg_kind_from_string(String8 string);
internal void d_msg_(D_MsgKind kind, D_Regs *regs);
#define d_msg(kind, ...) d_msg_((kind),\
&(D_Regs)\
{\
d_regs_lit_init_top \
__VA_ARGS__\
})
////////////////////////////////
//~ rjf: Main Layer Top-Level Calls
internal void d_init(CmdLine *cmdln, D_StateDeltaHistory *hist);
internal D_CmdList d_gather_root_cmds(Arena *arena);
internal void d_tick(Arena *arena, DI_Scope *di_scope, D_CmdList *cmds, F32 dt);
internal void d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, DI_Scope *di_scope, D_CmdList *cmds, F32 dt);
#endif // DBG_ENGINE_CORE_H
-150
View File
@@ -37,156 +37,6 @@ Rng1U64 d_reg_slot_range_table[29] =
{OffsetOf(D_Regs, params_tree), OffsetOf(D_Regs, params_tree) + sizeof(MD_Node *)},
};
String8 d_msg_kind_name_lower_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"),
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"),
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"),
};
Rng1U64 d_cmd_param_slot_range_table[24] =
{
{0},
@@ -40,82 +40,6 @@ D_RegSlot_ParamsTree,
D_RegSlot_COUNT,
} D_RegSlot;
typedef enum D_MsgKind
{
D_MsgKind_Null,
D_MsgKind_LaunchAndRun,
D_MsgKind_LaunchAndStepInto,
D_MsgKind_Kill,
D_MsgKind_KillAll,
D_MsgKind_Attach,
D_MsgKind_Detach,
D_MsgKind_Continue,
D_MsgKind_StepIntoInst,
D_MsgKind_StepOverInst,
D_MsgKind_StepIntoLine,
D_MsgKind_StepOverLine,
D_MsgKind_StepOut,
D_MsgKind_Halt,
D_MsgKind_SoftHaltRefresh,
D_MsgKind_SetThreadIP,
D_MsgKind_RunToLine,
D_MsgKind_RunToAddress,
D_MsgKind_Run,
D_MsgKind_Restart,
D_MsgKind_StepInto,
D_MsgKind_StepOver,
D_MsgKind_SelectThread,
D_MsgKind_SelectUnwind,
D_MsgKind_UpOneFrame,
D_MsgKind_DownOneFrame,
D_MsgKind_FreezeThread,
D_MsgKind_ThawThread,
D_MsgKind_FreezeProcess,
D_MsgKind_ThawProcess,
D_MsgKind_FreezeMachine,
D_MsgKind_ThawMachine,
D_MsgKind_FreezeLocalMachine,
D_MsgKind_ThawLocalMachine,
D_MsgKind_SetPathMapSrc,
D_MsgKind_SetPathMapDst,
D_MsgKind_SetFileReplacementPath,
D_MsgKind_SetAutoViewRuleType,
D_MsgKind_SetAutoViewRuleViewRule,
D_MsgKind_EnableEntity,
D_MsgKind_EnableBreakpoint,
D_MsgKind_EnableTarget,
D_MsgKind_DisableEntity,
D_MsgKind_DisableBreakpoint,
D_MsgKind_DisableTarget,
D_MsgKind_FreezeEntity,
D_MsgKind_ThawEntity,
D_MsgKind_RemoveEntity,
D_MsgKind_RemoveBreakpoint,
D_MsgKind_RemoveTarget,
D_MsgKind_NameEntity,
D_MsgKind_DuplicateEntity,
D_MsgKind_RelocateEntity,
D_MsgKind_AddBreakpoint,
D_MsgKind_ToggleBreakpoint,
D_MsgKind_AddAddressBreakpoint,
D_MsgKind_AddFunctionBreakpoint,
D_MsgKind_AddWatchPin,
D_MsgKind_ToggleWatchPin,
D_MsgKind_ToggleWatchExpression,
D_MsgKind_ToggleBreakpointAtCursor,
D_MsgKind_ToggleWatchPinAtCursor,
D_MsgKind_ToggleWatchExpressionAtCursor,
D_MsgKind_GoToNameAtCursor,
D_MsgKind_RunToCursor,
D_MsgKind_SetNextStatement,
D_MsgKind_AddTarget,
D_MsgKind_SelectTarget,
D_MsgKind_RetryEndedProcess,
D_MsgKind_RegisterAsJITDebugger,
D_MsgKind_LogMarker,
D_MsgKind_COUNT,
} D_MsgKind;
typedef enum D_CfgSrc
{
D_CfgSrc_User,
@@ -573,8 +497,6 @@ struct {B32 *value_ptr; String8 name;} DEV_toggle_table[] =
};
C_LINKAGE_BEGIN
extern Rng1U64 d_reg_slot_range_table[29];
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[24];
extern String8 d_entity_kind_display_string_table[31];
extern String8 d_entity_kind_name_lower_table[31];