gen crash dumps

This commit is contained in:
Nikita Smith
2026-06-02 12:09:54 -07:00
committed by Ryan Fleury
parent 3ec7ae6746
commit 5a3741a264
9 changed files with 46 additions and 16 deletions
+12 -1
View File
@@ -65,7 +65,18 @@ jobs:
for /f "tokens=3 delims=. " %%v in ('clang -v 2^>^&1 ^| findstr version') do set clang_version=%%v for /f "tokens=3 delims=. " %%v in ('clang -v 2^>^&1 ^| findstr version') do set clang_version=%%v
if "${{matrix.compiler}}" == "clang" set PATH=%clang_path%..\lib\clang\%clang_version%\lib\windows;%PATH% if "${{matrix.compiler}}" == "clang" set PATH=%clang_path%..\lib\clang\%clang_version%\lib\windows;%PATH%
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 || exit /b 1 torture --gen_crash_dump || exit /b 1
- name: upload torture crash dumps
if: failure()
uses: actions/upload-artifact@v7
with:
name: torture-crash-dumps-${{ matrix.compiler }}-${{ matrix.mode }}
path: |
build/*.dmp
build/*.exe
build/*.pdb
if-no-files-found: ignore
+12
View File
@@ -395,6 +395,18 @@ str8_match_wildcard(String8 string, String8 pattern, StringMatchFlags flags)
return matched; return matched;
} }
internal B32
str8_starts_with(String8 string, String8 expected_prefix)
{
return str8_match(str8_prefix(string, expected_prefix.size), expected_prefix, 0);
}
internal B32
str8_starts_withi(String8 string, String8 expected_prefix)
{
return str8_match(str8_prefix(string, expected_prefix.size), expected_prefix, StringMatchFlag_CaseInsensitive);
}
internal U64 internal U64
str8_find_needle(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags) str8_find_needle(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags)
{ {
+2
View File
@@ -202,6 +202,8 @@ internal String8 backslashed_from_str8(Arena *arena, String8 string);
internal B32 str8_match(String8 a, String8 b, StringMatchFlags flags); internal B32 str8_match(String8 a, String8 b, StringMatchFlags flags);
#define str8_matchi(a, b) str8_match(a, b, StringMatchFlag_CaseInsensitive) #define str8_matchi(a, b) str8_match(a, b, StringMatchFlag_CaseInsensitive)
internal B32 str8_match_wildcard(String8 string, String8 pattern, StringMatchFlags flags); internal B32 str8_match_wildcard(String8 string, String8 pattern, StringMatchFlags flags);
internal B32 str8_starts_with(String8 string, String8 expected_prefix);
internal B32 str8_starts_withi(String8 string, String8 expected_prefix);
internal U64 str8_find_needle(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags); internal U64 str8_find_needle(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags);
internal U64 str8_find_needle_reverse(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags); internal U64 str8_find_needle_reverse(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags);
internal B32 str8_is_before(String8 a, String8 b); internal B32 str8_is_before(String8 a, String8 b);
-6
View File
@@ -1,12 +1,6 @@
// Copyright (c) Epic Games Tools // Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/) // Licensed under the MIT license (https://opensource.org/license/mit/)
internal B32
str8_starts_with(String8 string, String8 expected_prefix)
{
return str8_match(str8_prefix(string, expected_prefix.size), expected_prefix, 0);
}
internal U64 internal U64
str8_array_bsearch(String8Array arr, String8 value) str8_array_bsearch(String8Array arr, String8 value)
{ {
-2
View File
@@ -3,6 +3,4 @@
#pragma once #pragma once
internal B32 str8_starts_with(String8 string, String8 expected_prefix);
internal U64 str8_array_bsearch(String8Array arr, String8 value); internal U64 str8_array_bsearch(String8Array arr, String8 value);
@@ -0,0 +1 @@
+6 -1
View File
@@ -860,7 +860,12 @@ entry_point(CmdLine *cmd_line)
"--quit_after_success (or -q)\n" "--quit_after_success (or -q)\n"
"This will close the debugger automatically after all processes exit, if they all exited successfully (with code 0), and ran with no interruptions.\n\n" "This will close the debugger automatically after all processes exit, if they all exited successfully (with code 0), and ran with no interruptions.\n\n"
"--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"
"Bypass crash prompt and write dump to --crash_dump_path.\n\n"
"--crash_dump_path:<path>\n"
"Sets crash dump file path.\n\n"
));
}break; }break;
} }
+5
View File
@@ -473,6 +473,10 @@ t_invoke_env(String8 exe_path, String8 cmdline, String8List env, U64 timeout_us)
wait_ms = now_us < endt_us ? ClampTop((endt_us - now_us + 999) / 1000, max_U32-1) : 0; wait_ms = now_us < endt_us ? ClampTop((endt_us - now_us + 999) / 1000, max_U32-1) : 0;
} }
if (wait_ms == 0) {
DebugBreakProcess((HANDLE)process_handle.u64[0]);
}
// wait on process and read pipes // wait on process and read pipes
DWORD wait_result = WaitForMultipleObjects(wait_handle_count, wait_handles, 0, wait_ms); DWORD wait_result = WaitForMultipleObjects(wait_handle_count, wait_handles, 0, wait_ms);
@@ -577,6 +581,7 @@ t_invoke_env(String8 exe_path, String8 cmdline, String8List env, U64 timeout_us)
exit:; exit:;
for EachElement(i, read_capture_handles) { file_close(read_capture_handles[i]); } for EachElement(i, read_capture_handles) { file_close(read_capture_handles[i]); }
for EachElement(i, write_capture_handles) { file_close(write_capture_handles[i]); } for EachElement(i, write_capture_handles) { file_close(write_capture_handles[i]); }
AssertAlways(is_ok);
scratch_end(scratch); scratch_end(scratch);
return is_ok; return is_ok;
} }
+7 -5
View File
@@ -23,7 +23,7 @@ t_dbg_send_cmd(String8 cmd, U64 timeout_us, Arena *reply_arena, RD_IpcReply *rep
#endif #endif
// send command // send command
String8 cmdline = str8f(scratch.arena, "--ipc --pid:%u %S", dbg_pid, cmd); String8 cmdline = str8f(scratch.arena, "--gen_crash_dump --ipc --pid:%u %S", dbg_pid, cmd);
if (t_invoke(t_raddbg_path(), cmdline, timeout_us) == 0) { goto exit; } if (t_invoke(t_raddbg_path(), cmdline, timeout_us) == 0) { goto exit; }
B32 has_reply = 1; B32 has_reply = 1;
@@ -242,6 +242,7 @@ t_dbg_send_cmd_and_wait_stop(String8 cmd, U64 timeout_us)
printf(" Column: %lld\n", loc.pt.column); printf(" Column: %lld\n", loc.pt.column);
printf(" Run Gen: %llu\n", status.run_gen); printf(" Run Gen: %llu\n", status.run_gen);
printf(" Stop Cause: \"%.*s\"\n", str8_varg(last_stop.stop_cause)); printf(" Stop Cause: \"%.*s\"\n", str8_varg(last_stop.stop_cause));
fflush(stdout);
} }
//-------------------------------- //--------------------------------
@@ -261,9 +262,10 @@ t_dbg_launch(String8 cmdline, U64 timeout_us)
Temp scratch = scratch_begin(0, 0); Temp scratch = scratch_begin(0, 0);
B32 dbg_ready = 0; B32 dbg_ready = 0;
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"));
cmdline = str8f(scratch.arena, "--user:\"%S\" --project:\"%S\" %S", user_path, project_path, cmdline); String8 crash_dump_path = t_make_file_path(scratch.arena, str8_lit("raddbg_crash_dump.dmp"));
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 = {
@@ -579,7 +581,7 @@ t_dbg_script_invoke(T_DbgScript *script, U64 timeout_us)
// 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);
T_DbgSourceLocation loc = {0}; T_DbgSourceLocation loc = {0};
AssertAlways(t_dbg_src_line(scratch.arena, ip, &loc, TIMEOUT_SEC(5))); AssertAlways(t_dbg_src_line(scratch.arena, ip, &loc, TIMEOUT_SEC(15)));
// 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;