[PR #2276] runtime: print the call chain of a fatal fault #2280

Open
opened 2026-11-26 21:20:40 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2276
Author: @OldSalty
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: fault-stacks


📝 Commits (1)

  • 4469914 runtime: print the call chain of a fatal fault

📊 Changes

4 files changed (+164 additions, -3 deletions)

View changed files

📝 runtime/src/main.cpp (+6 -2)
📝 runtime/src/thread_stacks.cpp (+50 -0)
📝 runtime/src/thread_stacks.h (+7 -0)
📝 runtime/test/thread_stacks_test.cpp (+101 -1)

📄 Description

A run that ends in an exception nothing handles saves the session pipeline cache but says nothing about where the fault was: the log has unhandled exception 0xc0000005 and no call chain, so a fault in the title or one of its DLLs stays a guess. This prints the fault and the threads' call chains before the caches are written.

Item: none listed yet -- claimed in #1608 (see the comment linked below).

  • Fault line: the access and the address for an access violation ([rt] fault fatal: read of 0xf at <module>+0x...), or the exception code otherwise, with the module named by the same shims::module_offset the other traces use.
  • The faulting thread: its chain walked straight from the exception context. The filter runs on the faulting thread and that stack is live under it, so this needs no copy, unlike a sampled thread.
  • The other threads: the LEONIDA_STACKS snapshot (snapshot_threads), so what the title's worker pool and the compile pool were doing at the fault lands in the same log.
  • Order: it runs first in the filter, while the stacks are live, then the compile stop and the cache write as before; the exception still goes on to the previous filter, so the exit code is unchanged. Nothing happens unless a run dies.
  • Tests: thread_stacks_test gains a guarded null read with stderr redirected to a temp file: the fault line names the access and the instruction, frame #0 is that same instruction, the chain unwinds out of the function the fault happened in to the function that called it, and the other threads are snapshotted. 19 checks, no game data.
  • Tested: on the retail package, where it named a faulting read and unwound six title frames out of the title's own job-worker pool -- a site two of three boots hit and no log had ever placed -- and thread_stacks_test on Windows (RelWithDebInfo).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2276 **Author:** [@OldSalty](https://github.com/OldSalty) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fault-stacks` --- ### 📝 Commits (1) - [`4469914`](https://github.com/ubiquitarianism/leonida/commit/4469914649a0c6c1f4ba0924eb6befade61fff22) runtime: print the call chain of a fatal fault ### 📊 Changes **4 files changed** (+164 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `runtime/src/main.cpp` (+6 -2) 📝 `runtime/src/thread_stacks.cpp` (+50 -0) 📝 `runtime/src/thread_stacks.h` (+7 -0) 📝 `runtime/test/thread_stacks_test.cpp` (+101 -1) </details> ### 📄 Description A run that ends in an exception nothing handles saves the session pipeline cache but says nothing about where the fault was: the log has `unhandled exception 0xc0000005` and no call chain, so a fault in the title or one of its DLLs stays a guess. This prints the fault and the threads' call chains before the caches are written. Item: none listed yet -- claimed in #1608 (see the comment linked below). - **Fault line:** the access and the address for an access violation (`[rt] fault fatal: read of 0xf at <module>+0x...`), or the exception code otherwise, with the module named by the same `shims::module_offset` the other traces use. - **The faulting thread:** its chain walked straight from the exception context. The filter runs on the faulting thread and that stack is live under it, so this needs no copy, unlike a sampled thread. - **The other threads:** the `LEONIDA_STACKS` snapshot (`snapshot_threads`), so what the title's worker pool and the compile pool were doing at the fault lands in the same log. - **Order:** it runs first in the filter, while the stacks are live, then the compile stop and the cache write as before; the exception still goes on to the previous filter, so the exit code is unchanged. Nothing happens unless a run dies. - **Tests:** `thread_stacks_test` gains a guarded null read with stderr redirected to a temp file: the fault line names the access and the instruction, frame #0 is that same instruction, the chain unwinds out of the function the fault happened in to the function that called it, and the other threads are snapshotted. 19 checks, no game data. - **Tested:** on the retail package, where it named a faulting read and unwound six title frames out of the title's own job-worker pool -- a site two of three boots hit and no log had ever placed -- and `thread_stacks_test` on Windows (RelWithDebInfo). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2280
No description provided.