minidump format types; open crash dump command, stub out opening path in control thread; expand d_handles to support machine id, entity id, *and* 'controller kind', which can be either a dump file or a demon - this properly separates the true process control abstraction (demon) from opening a regular dump file on any machine, which will let us trivially support any kind of dump file on any platform; also fix bad cfg tree state leak

This commit is contained in:
Ryan Fleury
2026-05-16 18:26:23 -07:00
parent c90cbb80aa
commit fddf353ea0
19 changed files with 496 additions and 165 deletions
+3
View File
@@ -50,6 +50,9 @@ D_CmdTable: // | | | |
//- rjf: attaching
{Attach 1 1 0 0 "query:unattached_processes" PID null Nil Null 0 0 0 0 0 1 1 Null "attach" "Attach" "Attaches to a process that is already running on the local machine." "" "" }
//- rjf: crash dump opening
{OpenCrashDump 1 1 0 0 `folder:\\"$input\\"` FilePath null Nil Null 0 0 0 0 0 1 1 Null "open_crash_dump" "Open Crash Dump" "Opens a crash dump file and recreates debuggee state at the time of the crash." "" "" }
}
@enum D_CmdKind:
+24 -2
View File
@@ -8,7 +8,13 @@
//~ rjf: ID Types
typedef U64 D_MsgID;
typedef U64 D_MachineID;
typedef U32 D_MachineID;
typedef U32 D_ControllerKind;
enum
{
D_ControllerKind_Demon,
D_ControllerKind_Dump,
};
#define D_MachineID_Local (1)
@@ -19,7 +25,8 @@ typedef struct D_Handle D_Handle;
struct D_Handle
{
D_MachineID machine_id;
DMN_Handle dmn_handle;
D_ControllerKind controller_kind;
U64 entity_id;
};
typedef struct D_HandleNode D_HandleNode;
@@ -227,6 +234,21 @@ struct D_EntityCtxLookupAccel
U64 entity_kind_arrays_gens[D_EntityKind_COUNT];
};
////////////////////////////////
//~ rjf: Opened Dump Cache Types
typedef struct D_DumpNode D_DumpNode;
struct D_DumpNode
{
D_DumpNode *next;
D_DumpNode *prev;
D_Handle process;
File file;
FileProperties props;
FileMap map;
void *base;
};
////////////////////////////////
//~ rjf: Tick Input Types
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -362,13 +362,14 @@ internal D_BreakpointFlags d_breakpoint_flags_from_dmn_trap_flags(DMN_TrapFlags
//~ rjf: Handle Type Functions
internal D_Handle d_handle_zero(void);
internal D_Handle d_handle_make(D_MachineID machine_id, DMN_Handle dmn_handle);
internal B32 d_handle_match(D_Handle a, D_Handle b);
internal void d_handle_list_push(Arena *arena, D_HandleList *list, D_Handle *pair);
internal D_HandleList d_handle_list_copy(Arena *arena, D_HandleList *src);
internal D_HandleArray d_handle_array_from_list(Arena *arena, D_HandleList *src);
internal String8 d_string_from_handle(Arena *arena, D_Handle handle);
internal D_Handle d_handle_from_string(String8 string);
internal DMN_Handle d_dmn_from_handle(D_Handle handle);
internal D_Handle d_handle_from_dmn(D_MachineID machine_id, DMN_Handle handle);
////////////////////////////////
//~ rjf: Trap Type Functions
@@ -566,6 +567,7 @@ internal void d_ctrl_thread__end_and_flush_log(void);
//- rjf: msg kind implementations
internal void d_ctrl_thread__launch(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg);
internal void d_ctrl_thread__attach(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg);
internal void d_ctrl_thread__open_crash_dump(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg);
internal void d_ctrl_thread__kill(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg);
internal void d_ctrl_thread__kill_all(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg);
internal void d_ctrl_thread__detach(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg);
+12 -2
View File
@@ -2063,12 +2063,12 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
case D_CmdKind_FreezeLocalMachine:
{
D_MachineID machine_id = D_MachineID_Local;
d_cmd(D_CmdKind_FreezeMachine, .entity = d_handle_make(machine_id, dmn_handle_zero()));
d_cmd(D_CmdKind_FreezeMachine, .entity = d_handle_from_dmn(machine_id, dmn_handle_zero()));
}break;
case D_CmdKind_ThawLocalMachine:
{
D_MachineID machine_id = D_MachineID_Local;
d_cmd(D_CmdKind_ThawMachine, .entity = d_handle_make(machine_id, dmn_handle_zero()));
d_cmd(D_CmdKind_ThawMachine, .entity = d_handle_from_dmn(machine_id, dmn_handle_zero()));
}break;
case D_CmdKind_FreezeEntity:
case D_CmdKind_ThawEntity:
@@ -2119,6 +2119,16 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
MemoryCopyArray(msg->exception_code_filters, exception_code_filters);
}
}break;
//- rjf: opening crash dumps
case D_CmdKind_OpenCrashDump:
{
String8 file_path = params->file_path;
D_Msg *msg = d_msg_list_push(scratch.arena, &ctrl_msgs);
msg->kind = D_MsgKind_OpenCrashDump;
msg->path = str8_copy(scratch.arena, file_path);
MemoryCopyArray(msg->exception_code_filters, exception_code_filters);
}break;
}
// rjf: do run if needed
+1
View File
@@ -159,6 +159,7 @@ typedef enum D_MsgKind
D_MsgKind_Null,
D_MsgKind_Launch,
D_MsgKind_Attach,
D_MsgKind_OpenCrashDump,
D_MsgKind_Kill,
D_MsgKind_KillAll,
D_MsgKind_Detach,
@@ -41,6 +41,7 @@ D_CmdKind_ThawEntity,
D_CmdKind_SetEntityColor,
D_CmdKind_SetEntityName,
D_CmdKind_Attach,
D_CmdKind_OpenCrashDump,
D_CmdKind_COUNT,
} D_CmdKind;