diff options
| author | slipperysquid <coleseto123@gmail.com> | 2026-11-24 20:11:17 -0300 |
|---|---|---|
| committer | Diego Luiz Becker <diegoluizbecker@gmail.com> | 2026-11-29 09:55:11 -0300 |
| commit | 528e0862f2dc3411a66d30501b8f8670ddd0d88c (patch) | |
| tree | b2680ce8aff47c30568715f4526479731ec37a05 /runtime/src/main.cpp | |
| parent | 3535eb5c4b200acadddf9bf7318b921deecccc38 (diff) | |
runtime: LEONIDA_SKIP_ASSERTS steps over guest asserts without a trace (RT-526)
A diagnostic for the retail boot (RT-5 follow-ups), off the hot path and with no behaviour change unless asked
for: LEONIDA_SKIP_ASSERTS=N (src/assert_skip.h, installed by main.cpp before any image code runs under
--init/--run): a vectored handler, added last, steps over up to N int3 (0xCC) at addresses in no host module and
logs each one as module+RVA (and as an int3_skipped trace event when --trace is open). After N it says so once
and the next int3 ends the run as before. An int3 in a host module, a breakpoint with no 0xCC at its address, or
a RIP that is neither at nor one past the 0xCC is passed on. Needs no --trace and no debugger.
Tests (synthetic, no game files): assert_skip_test (int3 in a VirtualAlloc'd page, the limit, a host-module int3,
a two-byte int 3, value parsing) and run_tiny_game_skip_asserts (two int3 in the mapped stand-in game, stepped
over end to end).
Carried over from old upstream PR 9961 (#228) without its caller logging for forwarded device slots, which the
carry-over of old PR 9990 (#1390) brings instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/main.cpp')
| -rw-r--r-- | runtime/src/main.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp index f44eb2535..ad17dd3b0 100644 --- a/runtime/src/main.cpp +++ b/runtime/src/main.cpp | |||
| @@ -176,6 +176,7 @@ void start_title_peek(std::uint8_t* base) { | |||
| 176 | 176 | ||
| 177 | } // namespace | 177 | } // namespace |
| 178 | 178 | ||
| 179 | #include "assert_skip.h" | ||
| 179 | #include "avx2_emulation.h" | 180 | #include "avx2_emulation.h" |
| 180 | #include "base_reservation.h" | 181 | #include "base_reservation.h" |
| 181 | #include "compile_gate_policy.h" | 182 | #include "compile_gate_policy.h" |
| @@ -576,6 +577,17 @@ int wmain(int argc, wchar_t** argv) { | |||
| 576 | if (!rt::avx2_emulation::install()) | 577 | if (!rt::avx2_emulation::install()) |
| 577 | std::fprintf(stderr, "[rt] cpu: AddVectoredExceptionHandler (AVX2) failed (error %lu); instructions this CPU " | 578 | std::fprintf(stderr, "[rt] cpu: AddVectoredExceptionHandler (AVX2) failed (error %lu); instructions this CPU " |
| 578 | "lacks will stop the game\n", GetLastError()); | 579 | "lacks will stop the game\n", GetLastError()); |
| 580 | // LEONIDA_SKIP_ASSERTS=N (src/assert_skip.h): up to N int3 in guest code are logged and stepped over. Off unless | ||
| 581 | // set; installed before the first TLS callback, the first image code that runs. | ||
| 582 | if (init || run) | ||
| 583 | if (const unsigned skip_asserts = rt::assert_skip::limit_from_environment()) { | ||
| 584 | if (rt::assert_skip::install(skip_asserts)) | ||
| 585 | std::fprintf(stderr, "[rt] LEONIDA_SKIP_ASSERTS=%u: up to %u int3 in guest code are stepped over " | ||
| 586 | "(diagnostic)\n", skip_asserts, skip_asserts); | ||
| 587 | else | ||
| 588 | std::fprintf(stderr, "[rt] LEONIDA_SKIP_ASSERTS: AddVectoredExceptionHandler failed (error %lu); off\n", | ||
| 589 | GetLastError()); | ||
| 590 | } | ||
| 579 | 591 | ||
| 580 | try { | 592 | try { |
| 581 | rt::Loader loader(game_dir); | 593 | rt::Loader loader(game_dir); |