Commit ff9d4db
Route bx asserts and SEH crashes to stderr (#1741)
## What
bx''s `installExceptionHandler()` and `BX_ASSERT` both dispatch through
bx''s assert handler. The built-in default writes the failure banner and
native callstack **only** to `bx::getDebugOut()` (`OutputDebugString` on
Windows) and then tears the process down via `TerminateProcess(1)`. In a
non-headless console / CI run that means:
- the native callstack never reaches the log,
- the finish line never prints (atexit is skipped),
- and the only signal is a bare exit code `1` — indistinguishable from
an uncaught JS error.
This is exactly what happened in a recent CI Validation Tests failure:
the process died mid-render with exit code 1 and **no** `--- BN: ...
---` banner.
## Change
Install a Playground assert handler (`bx::setAssertHandler`) right after
`bx::installExceptionHandler()` that routes **both** paths through
`Diagnostics::DumpFailure` — which writes to **stderr** (captured by CI)
as well as `OutputDebugString` — then exits deterministically with code
`3`, matching the other hard-failure handlers in this file.
- Exception-filter invocations (`location.line == UINT32_MAX`) are
labeled `CRASH`.
- Real `BX_ASSERT` sites keep their file/line and are labeled `ASSERT`.
- Re-entrancy guarded; breaks into the debugger when one is attached.
Single file, +48 lines (`Apps/Playground/Shared/Diagnostics.cpp`).
## Validation
Forced an access violation (the same mid-render SEH path) via a
temporary env-gated injection (reverted before commit) and confirmed
stderr now shows:
```
--- BN: CRASH ---
Access violation. Exception Code c0000005
Callstack (8):
1: .../Apps/Playground/Win32/App.cpp 166 wWinMain
...
Build info: MSVC 17.0, ... C++20 ...
--- END ---
```
Exit code `3`, finish line printed.
## Notes
- This is debuggability infrastructure, independent of the JSI
mid-render crash itself (a separate pre-existing/flaky issue) — this
change simply makes such crashes **visible** in CI logs instead of
swallowing them.
- Trade-off: the self-terminate path does not produce a WER `.dmp`
(today''s default path produces none either). Preserving `.dmp` on real
crashes can be a follow-up.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 34186fe commit ff9d4db
1 file changed
Lines changed: 56 additions & 0 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
113 | 165 | | |
114 | 166 | | |
115 | 167 | | |
| |||
124 | 176 | | |
125 | 177 | | |
126 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
127 | 183 | | |
128 | 184 | | |
129 | 185 | | |
| |||
0 commit comments