-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[wasm][coreclr] Fix unhandled exceptions #121817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[wasm][coreclr] Fix unhandled exceptions #121817
Conversation
Developed with Jan Vorlicek Make sure the return address is set in transition block when going through `ExecuteInterpretedMethodWithArgs`, so that `SfiNextWorker` gets the address. Fill missing pieces around context. Fix few asserts and offsets. Co-authored-by: Jan Vorlicek <janvorli@microsoft.com>
|
Example output of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request fixes unhandled exception handling in the WebAssembly (WASM) implementation of CoreCLR. The primary goal is to ensure proper stack walking by setting return addresses in transition blocks and implementing missing context handling functionality for WASM.
Key changes:
- Added
callerIpparameter throughout the call chain to track return addresses for proper stack unwinding - Implemented
TransitionFrame::UpdateRegDisplay_Implto populate register display during stack walks - Fixed WASM context accessor functions to use interpreter fields instead of asserting/failing
- Corrected offset constants for WASM's CONTEXT structure fields
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/vm/wasm/helpers.cpp | Implemented TransitionFrame::UpdateRegDisplay_Impl to set InterpreterIP/SP and initialized CallDescrWorkerInternalReturnAddressOffset |
| src/coreclr/vm/wasm/callhelpers-reverse.cpp | Added callerIp parameter to ExecuteInterpretedMethodFromUnmanaged calls |
| src/coreclr/vm/wasm/calldescrworkerwasm.cpp | Added callerIp parameter to ExecuteInterpretedMethodWithArgs call |
| src/coreclr/vm/prestub.cpp | Updated function signatures and implementation to accept and use callerIp parameter |
| src/coreclr/vm/interpexec.h | Updated function declaration to include callerIp parameter |
| src/coreclr/vm/exceptionhandling.cpp | Added WASM-specific path to call PropagateExceptionThroughNativeFrames directly |
| src/coreclr/pal/src/include/pal/context.h | Implemented CONTEXTGetPC, CONTEXTSetPC, and CONTEXTGetFP for WASM using interpreter fields |
| src/coreclr/pal/src/exception/seh-unwind.cpp | Added conditional compilation to skip context capture for WASM |
| src/coreclr/pal/src/arch/wasm/stubs.cpp | Fixed assert syntax and changed RtlCaptureContext to zero memory instead of asserting |
| src/coreclr/System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs | Corrected offset values for InterpreterIP and InterpreterFP and added static assertions |
Developed with Jan Vorlicek
Make sure the return address is set in transition block when going through
ExecuteInterpretedMethodWithArgs, so thatSfiNextWorkergets the address.Fill missing pieces around context.
Fix few asserts and offsets.