clean up stepping test, and remove switch for overriding crash dump path

This commit is contained in:
Nikita Smith
2026-06-02 12:09:59 -07:00
committed by Ryan Fleury
parent fbdfeea8e6
commit d7161ea6e6
6 changed files with 29 additions and 18 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ jobs:
call build meta raddbg_non_graphical || exit /b 1 call build meta raddbg_non_graphical || exit /b 1
call build asan meta torture radlink radbin mule_main mule_module "${{matrix.mode}}" "${{matrix.compiler}}" || exit /b 1 call build asan meta torture radlink radbin mule_main mule_module "${{matrix.mode}}" "${{matrix.compiler}}" || exit /b 1
cd build cd build
torture --gen_crash_dump || exit /b 1 torture --gen_crash_dump -s:Dbg::* || exit /b 1
- name: upload torture crash dumps - name: upload torture crash dumps
if: failure() if: failure()
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v7
+1
View File
@@ -10437,6 +10437,7 @@ rd_ipc_make_reply_status(Arena *arena)
rd_ipc_reply_push_b32 (arena, &s, "ok", 1); rd_ipc_reply_push_b32 (arena, &s, "ok", 1);
rd_ipc_reply_push_b32 (arena, &s, "running", d_ctrl_targets_running()); rd_ipc_reply_push_b32 (arena, &s, "running", d_ctrl_targets_running());
rd_ipc_reply_push_u64 (arena, &s, "run_gen", d_run_gen()); rd_ipc_reply_push_u64 (arena, &s, "run_gen", d_run_gen());
rd_ipc_reply_push_u64 (arena, &s, "ip", d_ctrl_last_stop_event().rip_vaddr);
rd_ipc_reply_block_end(arena, &s); rd_ipc_reply_block_end(arena, &s);
scratch_end(scratch); scratch_end(scratch);
return str8_list_join(arena, &s, 0); return str8_list_join(arena, &s, 0);
+1 -3
View File
@@ -862,9 +862,7 @@ entry_point(CmdLine *cmd_line)
"--ipc <command>\n" "--ipc <command>\n"
"This will launch the debugger in the non-graphical IPC mode, which is used to communicate with another running instance of the debugger. The debugger instance will launch, send the specified command, then immediately terminate. This may be used by editors or other programs to control the debugger.\n\n" "This will launch the debugger in the non-graphical IPC mode, which is used to communicate with another running instance of the debugger. The debugger instance will launch, send the specified command, then immediately terminate. This may be used by editors or other programs to control the debugger.\n\n"
"--gen_crash_dump\n" "--gen_crash_dump\n"
"Bypass crash prompt and write dump to --crash_dump_path.\n\n" "Generate mini dump on crash.\n\n"
"--crash_dump_path:<path>\n"
"Sets crash dump file path.\n\n"
)); ));
}break; }break;
} }
+9
View File
@@ -929,6 +929,15 @@ t_entry_point(CmdLine *cmdline)
if (!cmd_line_has_flag(cmdline, str8_lit("print_stdout")) && IsDebuggerPresent()) { if (!cmd_line_has_flag(cmdline, str8_lit("print_stdout")) && IsDebuggerPresent()) {
g_redirect_stdout = 0; g_redirect_stdout = 0;
} }
// automatically close child processes on exit
{
HANDLE job_handle = CreateJobObjectA(0, 0);
AssertAlways(job_handle != 0);
JOBOBJECT_EXTENDED_LIMIT_INFORMATION job_info = { .BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE };
AssertAlways(SetInformationJobObject(job_handle, JobObjectExtendedLimitInformation, &job_info, sizeof(job_info)));
AssertAlways(AssignProcessToJobObject(job_handle, GetCurrentProcess()));
}
#endif #endif
// Handle -out // Handle -out
+16 -14
View File
@@ -40,6 +40,7 @@ t_dbg_send_cmd(String8 cmd, U64 timeout_us, Arena *reply_arena, RD_IpcReply *rep
// parse reply // parse reply
Arena *a = reply_arena ? reply_arena : scratch.arena; Arena *a = reply_arena ? reply_arena : scratch.arena;
String8 reply_text = str8_copy(a, g_output); String8 reply_text = str8_copy(a, g_output);
//fprintf(stderr, "Reply: %.*s\n", str8_varg(reply_text));
RD_IpcReply reply = rd_ipc_mdesk_reply_from_string(a, reply_text); RD_IpcReply reply = rd_ipc_mdesk_reply_from_string(a, reply_text);
if (rd_ipc_reply_is_ok(&reply) == 0) { goto exit; } if (rd_ipc_reply_is_ok(&reply) == 0) { goto exit; }
if (md_node_is_nil(reply.msg)) { goto exit; } if (md_node_is_nil(reply.msg)) { goto exit; }
@@ -80,6 +81,7 @@ t_dbg_status(T_DbgStatus *status_out, U64 timeout_us)
if ( ! rd_ipc_parse_b32(reply.msg, str8_lit("ok"), &is_ok)) { AssertAlways(0); goto exit; } if ( ! rd_ipc_parse_b32(reply.msg, str8_lit("ok"), &is_ok)) { AssertAlways(0); goto exit; }
if ( ! rd_ipc_parse_b32(reply.msg, str8_lit("running"), &status.running)) { AssertAlways(0); goto exit; } if ( ! rd_ipc_parse_b32(reply.msg, str8_lit("running"), &status.running)) { AssertAlways(0); goto exit; }
if ( ! rd_ipc_parse_int(reply.msg, str8_lit("run_gen"), &status.run_gen)) { AssertAlways(0); goto exit; } if ( ! rd_ipc_parse_int(reply.msg, str8_lit("run_gen"), &status.run_gen)) { AssertAlways(0); goto exit; }
if ( ! rd_ipc_parse_int(reply.msg, str8_lit("ip"), &status.ip)) { AssertAlways(0); goto exit; }
if (status_out != 0) { *status_out = status; } if (status_out != 0) { *status_out = status; }
exit:; exit:;
@@ -254,8 +256,7 @@ t_dbg_launch(String8 cmdline, U64 timeout_us)
String8 user_path = t_make_file_path(scratch.arena, str8_lit("test.raddbg_user")); String8 user_path = t_make_file_path(scratch.arena, str8_lit("test.raddbg_user"));
String8 project_path = t_make_file_path(scratch.arena, str8_lit("test.raddbg_project")); String8 project_path = t_make_file_path(scratch.arena, str8_lit("test.raddbg_project"));
String8 crash_dump_path = t_make_file_path(scratch.arena, str8_lit("raddbg_crash_dump.dmp")); cmdline = str8f(scratch.arena, "--gen_crash_dump --user:\"%S\" --project:\"%S\" %S", user_path, project_path, cmdline);
cmdline = str8f(scratch.arena, "--gen_crash_dump --crash_dump_path:\"%S\" --user:\"%S\" --project:\"%S\" %S", crash_dump_path, user_path, project_path, cmdline);
// launch debugger // launch debugger
OS_ProcessLaunchParams launch_opts = { OS_ProcessLaunchParams launch_opts = {
@@ -268,15 +269,6 @@ t_dbg_launch(String8 cmdline, U64 timeout_us)
if (os_handle_match(dbg_handle, os_handle_zero())) { AssertAlways(0 && "failed to launch debugger"); goto exit; } if (os_handle_match(dbg_handle, os_handle_zero())) { AssertAlways(0 && "failed to launch debugger"); goto exit; }
#if OS_WINDOWS #if OS_WINDOWS
// automatically close child processes on exit
{
HANDLE job_handle = CreateJobObjectA(0, 0);
AssertAlways(job_handle != 0);
JOBOBJECT_EXTENDED_LIMIT_INFORMATION job_info = { .BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE };
AssertAlways(SetInformationJobObject(job_handle, JobObjectExtendedLimitInformation, &job_info, sizeof(job_info)));
AssertAlways(AssignProcessToJobObject(job_handle, GetCurrentProcess()));
}
// cache debugger PID // cache debugger PID
g_dbg_pid = GetProcessId((HANDLE)dbg_handle.u64[0]); g_dbg_pid = GetProcessId((HANDLE)dbg_handle.u64[0]);
#elif OS_LINUX #elif OS_LINUX
@@ -583,9 +575,16 @@ t_dbg_script_invoke(T_DbgScript *script, U64 timeout_us)
case T_DbgScriptCmdKind_Run: t_dbg_send_cmd(str8_lit("run"), timeout_us, 0, 0); break; case T_DbgScriptCmdKind_Run: t_dbg_send_cmd(str8_lit("run"), timeout_us, 0, 0); break;
case T_DbgScriptCmdKind_At: { case T_DbgScriptCmdKind_At: {
// map IP -> source location // map IP -> source location
U64 ip = u64_from_str8(t_dbg_value_from_exprf(scratch.arena, "reg:rip"), 10); U64 ip = u64_from_str8(t_dbg_value_from_exprf(scratch.arena, "reg:rip"), 10);
if (ip == 0) {
fprintf(stderr, "ERROR: invalid IP address: 0x%llx\n", (unsigned long long)ip);
goto exit;
}
T_DbgSourceLocation loc = {0}; T_DbgSourceLocation loc = {0};
AssertAlways(t_dbg_src_line(scratch.arena, ip, &loc, T_Dbg_DefaultTimeout)); if (t_dbg_src_line(scratch.arena, ip, &loc, T_Dbg_DefaultTimeout) == 0) {
fprintf(stderr, "ERROR: failed to map IP (0x%llx) to source location\n", (unsigned long long)ip);
goto exit;
}
// compute line where debugger must be // compute line where debugger must be
S64 at_line_s64 = (S64)(program->line - program->file->line) + cmd->at.delta; S64 at_line_s64 = (S64)(program->line - program->file->line) + cmd->at.delta;
@@ -666,7 +665,10 @@ T_RunSig(dbg_script_runner)
} }
// debugger is ready -- now invoke script // debugger is ready -- now invoke script
t_dbg_script_invoke(&script, T_Dbg_DefaultTimeout); if (t_dbg_script_invoke(&script, T_Dbg_DefaultTimeout) == 0) {
fprintf(stderr, "ERROR: %.*s: failed to run to completion\n", str8_varg(user_data));
T_Ok(0);
}
// clean up // clean up
#if OS_WINDOWS #if OS_WINDOWS
+1
View File
@@ -111,6 +111,7 @@ typedef struct
{ {
B32 running; B32 running;
U64 run_gen; U64 run_gen;
U64 ip;
} T_DbgStatus; } T_DbgStatus;
typedef struct typedef struct