diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 3f26623a..5fa02873 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -65,7 +65,18 @@ jobs: 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% + 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 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 diff --git a/src/base/base_strings.c b/src/base/base_strings.c index 89e87012..32e668cb 100644 --- a/src/base/base_strings.c +++ b/src/base/base_strings.c @@ -395,6 +395,18 @@ str8_match_wildcard(String8 string, String8 pattern, StringMatchFlags flags) 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 str8_find_needle(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags) { diff --git a/src/base/base_strings.h b/src/base/base_strings.h index 9eb9b4ea..b7b67787 100644 --- a/src/base/base_strings.h +++ b/src/base/base_strings.h @@ -202,6 +202,8 @@ internal String8 backslashed_from_str8(Arena *arena, String8 string); internal B32 str8_match(String8 a, String8 b, StringMatchFlags flags); #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_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_reverse(String8 string, U64 start_pos, String8 needle, StringMatchFlags flags); internal B32 str8_is_before(String8 a, String8 b); diff --git a/src/linker/base_ext/base_strings.c b/src/linker/base_ext/base_strings.c index 7d9510c1..b0952373 100644 --- a/src/linker/base_ext/base_strings.c +++ b/src/linker/base_ext/base_strings.c @@ -1,12 +1,6 @@ // Copyright (c) Epic Games Tools // 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 str8_array_bsearch(String8Array arr, String8 value) { diff --git a/src/linker/base_ext/base_strings.h b/src/linker/base_ext/base_strings.h index dc61d504..ae9e5eb5 100644 --- a/src/linker/base_ext/base_strings.h +++ b/src/linker/base_ext/base_strings.h @@ -3,6 +3,4 @@ #pragma once -internal B32 str8_starts_with(String8 string, String8 expected_prefix); - internal U64 str8_array_bsearch(String8Array arr, String8 value); diff --git a/src/metagen/metagen_os/core/win32/metagen_os_core_win32.c b/src/metagen/metagen_os/core/win32/metagen_os_core_win32.c new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/src/metagen/metagen_os/core/win32/metagen_os_core_win32.c @@ -0,0 +1 @@ + diff --git a/src/raddbg/raddbg_main.c b/src/raddbg/raddbg_main.c index 53331eb0..33d5e65f 100644 --- a/src/raddbg/raddbg_main.c +++ b/src/raddbg/raddbg_main.c @@ -499,7 +499,7 @@ internal void entry_point(CmdLine *cmd_line) { Temp scratch = scratch_begin(0, 0); - + //- rjf: unpack command line arguments ExecMode exec_mode = ExecMode_Normal; B32 auto_run = 0; @@ -860,7 +860,12 @@ entry_point(CmdLine *cmd_line) "--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" "--ipc \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:\n" + "Sets crash dump file path.\n\n" + )); }break; } diff --git a/src/torture/torture.c b/src/torture/torture.c index b54496ef..5b2b1aa3 100644 --- a/src/torture/torture.c +++ b/src/torture/torture.c @@ -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; } + if (wait_ms == 0) { + DebugBreakProcess((HANDLE)process_handle.u64[0]); + } + // wait on process and read pipes 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:; for EachElement(i, read_capture_handles) { file_close(read_capture_handles[i]); } for EachElement(i, write_capture_handles) { file_close(write_capture_handles[i]); } + AssertAlways(is_ok); scratch_end(scratch); return is_ok; } diff --git a/src/torture/torture_dbg.c b/src/torture/torture_dbg.c index 07298994..32121526 100644 --- a/src/torture/torture_dbg.c +++ b/src/torture/torture_dbg.c @@ -23,7 +23,7 @@ t_dbg_send_cmd(String8 cmd, U64 timeout_us, Arena *reply_arena, RD_IpcReply *rep #endif // 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; } 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(" Run Gen: %llu\n", status.run_gen); 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); B32 dbg_ready = 0; - 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")); - cmdline = str8f(scratch.arena, "--user:\"%S\" --project:\"%S\" %S", user_path, project_path, cmdline); + 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 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 OS_ProcessLaunchParams launch_opts = { @@ -579,7 +581,7 @@ t_dbg_script_invoke(T_DbgScript *script, U64 timeout_us) // map IP -> source location U64 ip = u64_from_str8(t_dbg_value_from_exprf(scratch.arena, "reg:rip"), 10); 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 S64 at_line_s64 = (S64)(program->line - program->file->line) + cmd->at.delta;