Skip to content

Add context argument to crash dump functions to preserve register state - #121773

Merged
jkotas merged 5 commits into
mainfrom
copilot/add-context-argument-crash-dump
Nov 19, 2025
Merged

jkotas merged 5 commits into
mainfrom
copilot/add-context-argument-crash-dump

Conversation

Copilot AI commented Nov 19, 2025 •

Copy link
Copy Markdown
Contributor

Add context argument to PalCreateCrashDumpIfEnabled and PROCCreateCrashDumpIfEnabled methods

This PR addresses the issue where the context pointer is missing in crash dumps, making diagnosis difficult.

Contributes to #119761

@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Nov 19, 2025
Copilot AI changed the title [WIP] Add context argument to crash dump methods Add context argument to crash dump functions to preserve register state Nov 19, 2025
Copilot AI requested a review from jkotas November 19, 2025 04:19
Comment thread src/coreclr/pal/src/thread/process.cpp Resolved
Instead of using a volatile variable, create a helper function marked with
noinline and no-optimization attributes that accepts the address of the
context pointer. This ensures the context is properly preserved in crash
dumps and not optimized away by the compiler.

Co-authored-by: jkotas <[email protected]>
Updated PROCAbort to accept a context parameter and modified all call sites
in signal handlers to pass the context pointer where it is available. This
ensures context information is preserved in crash dumps when aborting.

Co-authored-by: jkotas <[email protected]>
Renamed the helper function to DoNotOptimize with a const void* parameter
to make it more general-purpose and not specific to context pointers.

Co-authored-by: jkotas <[email protected]>
Copilot AI requested a review from jkotas November 19, 2025 07:44
@jkotas jkotas added area-PAL-coreclr only for closed issues and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Nov 19, 2025
@jkotas
jkotas marked this pull request as ready for review November 19, 2025 08:32
@jkotas
jkotas requested review from Copilot and removed request for MichalStrehovsky and Copilot November 19, 2025 08:32
@jkotas
jkotas merged commit f62405c into main Nov 19, 2025
@akoeplinger
akoeplinger deleted the copilot/add-context-argument-crash-dump branch November 21, 2025 12:07
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-PAL-coreclr only for closed issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants