OLD-7824: restore old upstream PR 7824 - startup_trace: LEONIDA_SKIP_INT3 works on title threads and with Wine's breakpoint address #638
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!638
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/638/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@aslan2142 on GitHub · 2026-11-24 10:41 UTC · original
aslan2142:skip-int3-wine→main· +283 −54 · 6 files · 4 commits · merged 2026-11-25 22:59 UTCClaimed in the coordination issue as: OLD-7824 #14
Restoration of my original pull request, old upstream PR 7824 in
ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at21625bca8; the code is unchanged, and the old#7599references in the comments and the commit message now read "old upstream 7599" (old numbers link nowhere here), with the three comments that got longer rewrapped to 120 columns.What and why
Spacecer2 measured under Wine 11.22 (old upstream 7599) that
LEONIDA_SKIP_INT3never took effect. The flag was a block-scope static first read on a title thread, and its MSVC thread-safe-static guard passed while the object was still zero. The handler's int3 set and the trace lock had the same shape. Two changes fix that:startup_trace's exception handler touches is no longer a block-scope static:startup_trace::open()readsLEONIDA_SKIP_INT3, on the thread that opens the trace, into a constant-initialized atomic.Rip(the Windows form) or atRip - 1(Spacecer2's Wine run). Either way,Ripends one byte past the0xCC.Also:
skip_int3returns false for a nullEXCEPTION_POINTERS, record or context.LEONIDA_LOG_GAME_EVENTSandLEONIDA_HDRare read on title threads, soxgameruntime_offline.cppnow caches them in namespace-scope atomics instead of block-scope statics.docs/boot.md,runtime/README.mdand theCMakeLists.txtcomment now say that the variable is read when the trace opens.int3_skip_testnow runs each case in a child process with its own environment. The cases are real int3s, the Windows and the Wine breakpoint forms, the null pointers, the flag read atopen(), and the flag off.Tested
These runs were on Linux, with the Windows tests built with clang 23 for
x86_64-w64-mingw32and run under Wine 11.22 (Staging). The MSVC/W4 /permissive-build is left to CI.int3_skip_testbefore, onmain: the new test does not compile there, because it readsdetail::skip_int3_on, whichmaindoes not have. With those two checks stubbed out:real,windowsandoffpass;winefails 4 checks;nullcrashes with an access violation;initfails 1 check.int3_skip_testafter, on this branch: all 6 cases pass, 30 checks and 0 failures.xgameruntime_offline_test: 58 checks and 0 failures both before and after, with and withoutLEONIDA_HDR=1.git diff --checkandpython -I scripts/check_no_game_data.pyon the changed files are both clean.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)AI-assisted (Claude Code, Claude Opus 5.5).
@PierreEbele on GitHub · 2026-11-25 01:47 UTC · original
Reviewed
60fce7a: read the rewrite and replayed its core logic (skip_int3/first_int3_at/int3_from, extracted verbatim from both main and this head) in a sandboxed Linux probe. The Wine form and both mixed breakpoint forms now skip (main returned 0). The three null cases return false (main segfaulted on the first one). The flag is latched inopen(): removing the variable afterwards still skips, where main stopped. Per-address dedupe matches a set until the 4096-slot table fills; after that a site logs again each time, as the header says. Docs tests,test_boot_trace.py, compileall and the portable runtime ctest pass on both trees.int3_skip_testis Windows-only; thewindowsCI job on this head passes. The failing Linux/macOS jobs ran on the old base (e.g.cs_imgload_d16_tfe, which passes on current main), and the branch merges cleanly into main.Non-blocking notes:
#include <set>instartup_trace.his now unused.int3_from: if Rip is one past the 0xCC whileExceptionAddressis on it (a mixed form), and the next byte is also 0xCC (a run of int3 padding), the byte at Rip is taken first and the address check rejects it, so that int3 is not skipped. Main did not skip it either, so this is no regression. Picking the candidate that agrees withExceptionAddresswould cover it.No findings. AI-assisted review.
Recommendation: Merge
@aslan2142 on GitHub · 2026-11-25 22:59 UTC · original
Merged:
startup_trace:LEONIDA_SKIP_INT3works on title threads and with Wine's breakpoint address.int3_fromnow takes the candidate (Rip, then Rip - 1) thatExceptionAddressagrees with. In the mixed form followed by int3 padding, the int3 is now skipped. A newpaddingcase inint3_skip_testcovers it.<set>include is gone.int3_skippedrow inruntime/README.mdnow says the dedupe holds until 4096 addresses (1d0bf24dc,2a79af5a8).main5fab93967with all nine of these runtime PRs merged together (#634, #643, #684, #657, #677, #638, #710, #688, #671), on llvmpipe and the gfx1036 iGPU (RADV): no test went from pass to fail.int3_skipandstartup_tracepass on both.main696d70da1+2a79af5a8: it merges cleanly; the semantic suite passes (493 files, 6,318 tests, 0 files failed); the 15 docs and writer tests pass;check_no_game_data.pyis clean on the 6 changed files.AI-assisted (Claude Code, Claude Opus 5.5).
latencyframes in flight while armed (mailbox replace) #671