Skip to content

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

Open
vrdaveb wants to merge 1 commit intoLunarG: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 intoLunarG:devfrom
vrdaveb:feature/capture-crash-command

Conversation

@vrdaveb
Copy link
Copy Markdown

@vrdaveb vrdaveb commented Mar 31, 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 #699

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
@vrdaveb vrdaveb requested a review from a team as a code owner March 31, 2026 05:16
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 31, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

output crashing function and parameters

2 participants