Repository navigation
[cDAC][wasm] Keep caller SP for non-R2R callers and restore SoftwareExceptionFrame FP - #135494
Merged
lewing merged 7 commits intoOct 20, 2026
Merged
Conversation
Mirror native RtlVirtualUnwind and WasmUnwindStackFrameCore when unwinding a WASM ReadyToRun frame: - Always advance SP to the caller's stack pointer. When the caller is not R2R code, report a null IP and FP instead of nulling SP, so the walk continues through the Frame chain from the right stack position. - When the frame being unwound has a reverse P/Invoke frame in its GC info and is not a funclet, its caller is native code. Report no R2R caller rather than reading the native caller's stack bytes as an R2R frame record. Expose GCInfoHeader.HasReversePInvokeFrame from both the common decoder and the x86 decoder. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ntexts Mirror native SoftwareExceptionFrame::UpdateRegDisplay_Impl and InlinedCallFrame::UpdateRegDisplay_Impl on WASM: - WASM's callee-saved register set is InterpreterFP, so restore IP, SP, and FP from a SoftwareExceptionFrame's saved context. The CalleeSavedRegisters data descriptor is empty on WASM, so the base handler left FP from the previous frame. - Return before any update for an inactive InlinedCallFrame, including the interpreter-frame stash, as native does. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Follow the AMD64Context pattern: WasmContext.Unwind delegates to WasmUnwinder.Unwind(ref WasmContext). Remove the TryUnwindOneFrame overload without a control PC, which only tests used. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
…vel test Native RtlVirtualUnwind asserts that the control PC is an R2R virtual IP, so WasmUnwinder.TryUnwindOneFrame now throws when it is null instead of silently skipping the reverse P/Invoke check. Every production caller already unwinds a managed context. Tests pass a real control PC. Add a StackWalk test for an R2R method whose caller is not R2R code and whose active InlinedCallFrame lives in its own frame. Keeping the caller SP lets the walk pass the frame and report the method once; with the SP nulled, the walk reports the method repeatedly. Also reattach the StashesInterpreterFrame test comment that the previous commit separated from its test. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: cf17d923-d419-4c13-bcb4-094d592f8243
Main now identifies reverse P/Invoke roots from the tagged frame identity, so the GC-info based HasReversePInvokeFrame check is dropped. What remains: keep the caller SP when the caller is not R2R code, restore FP from a WASM SoftwareExceptionFrame, and skip an inactive InlinedCallFrame. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…andler Drop TryUnwindOneFrame_CallerWithoutVirtualIp_PreservesCallerStackPointer: the WasmContext_UnwindCallerWithoutVirtualIp test sets up the same frames and asserts the same SP and IP plus FP. State the invariant in one or two lines on the new StackWalk test and on HandleSoftwareExceptionFrame. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
lewing
added a commit
to lewing/runtime
that referenced
this pull request
Oct 20, 2026
Decode WASM register locations (localIndex + WASM_LOCAL_REGNUM_BASE) into DebugVarInfo.WasmLocal/WasmLocal2 and report them as the WasmLocal and WasmLocalPair kinds. Resolve VLT_STK / VLT_STK2 against the logical frame pointer in the stack-walk context. Engine-private locals report no native locations, and an unreadable or null WASM VLT_STK_BYREF indirection keeps its location but fails reads instead of reading linear address 0. Frame context, funclet frame pointers and function identity are provided by dotnet#135140 (merged), dotnet#135494 and dotnet#135495. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
max-charlamb
approved these changes
Oct 20, 2026
lewing
enabled auto-merge (squash)
October 20, 2026 16:12
Member
Author
|
/ba-g ba is stuck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Aligns the wasm cDAC R2R unwinder with native
WasmUnwindStackFrameCoreandUpdateRegDisplay_Impl:InlinedCallFramelives in its own frame is reported repeatedly, because the walker never gets past that frame.SoftwareExceptionFrame: restore FP along with IP and SP. FP (InterpreterFP) is wasm's only callee-saved register, but theCalleeSavedRegistersdescriptor is empty on wasm, so FP was left over from the previous frame.InlinedCallFrame: return before writing the interpreter-frame stash, as native does.StackWalk.mdis updated. The earlier reverse P/Invoke check was dropped after #135440 identified those roots from the tagged frame identity.Not included
IStackWalk.GetRuntimeFramePointeron wasm: nativeGetRegdisplayStackMarkhas noTARGET_WASMimplementation to mirror.Note
This PR description was generated with GitHub Copilot.