Skip to content

Add crash command capture to preserve crashing API call in trace#2834

Open
vrdaveb wants to merge 1 commit into
LunarG:devfrom
vrdaveb:feature/capture-crash-command
Open

Add crash command capture to preserve crashing API call in trace#2834
vrdaveb wants to merge 1 commit into
LunarG:devfrom
vrdaveb:feature/capture-crash-command

Conversation

@vrdaveb

@vrdaveb vrdaveb commented Mar 31, 2026

Copy link
Copy Markdown

When a Vulkan driver crashes during an API call, the capture layer currently loses the offending command because parameter encoding happens post-call. This adds a new opt-in capture mode that records which API call is in-flight at the time of a crash.

When enabled via GFXRECON_CAPTURE_CRASH_COMMAND=true:

  • Before each driver dispatch, a pre-encoded function call block (containing the call ID and thread ID) is saved in thread-local storage
  • Crash signal handlers (SIGSEGV/SIGABRT/SIGBUS/SIGFPE/SIGILL on POSIX, SEH on Windows) write any in-flight call blocks to the capture file and flush
  • Force-flush is activated so all completed calls are on disk
  • After the driver call returns, the in-flight marker is cleared

The crashing function appears as the last block in the capture file, identifiable by tools like gfxrecon-convert. All preceding calls are preserved with full parameters.

Performance impact when disabled: zero (early return on bool check). When enabled: one atomic store + small memcpy per API call, plus force-flush overhead.

Fixes #699

@vrdaveb
vrdaveb requested a review from a team as a code owner March 31, 2026 05:16
@CLAassistant

CLAassistant commented Mar 31, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@bradgrantham-lunarg bradgrantham-lunarg added the approved-to-run-ci Can run CI check on internal LunarG machines label Apr 8, 2026
When a Vulkan driver crashes during an API call, the capture layer
currently loses the offending command because parameter encoding
happens post-call. This adds a new opt-in capture mode that records
which API call is in-flight at the time of a crash.

When enabled via GFXRECON_CAPTURE_CRASH_COMMAND=true:
- Before each driver dispatch, a pre-encoded function call block
  (containing the call ID and thread ID) is saved in thread-local
  storage
- Crash signal handlers (SIGSEGV/SIGABRT/SIGBUS/SIGFPE/SIGILL on
  POSIX, SEH on Windows) write any in-flight call blocks to the
  capture file and flush
- Force-flush is activated so all completed calls are on disk
- After the driver call returns, the in-flight marker is cleared

The crashing function appears as the last block in the capture file,
identifiable by tools like gfxrecon-convert. All preceding calls are
preserved with full parameters.

Performance impact when disabled: zero (early return on bool check).
When enabled: one atomic store + small memcpy per API call, plus
force-flush overhead.

Fixes LunarG#699
@bradgrantham-lunarg
bradgrantham-lunarg force-pushed the feature/capture-crash-command branch from 8ea0e8c to d4efaeb Compare April 8, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved-to-run-ci Can run CI check on internal LunarG machines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

output crashing function and parameters

3 participants