Add cDac contract for ResolveFrameHelper#129261
Open
leculver wants to merge 5 commits into
Open
Conversation
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the cDAC stack-walking contracts to understand ResolveHelperFrame (a resumable TransitionFrame used by interface resolve helper dispatch), so stack walking can correctly step past it and derive a correct thread context (including argument registers) from its TransitionBlock.
Changes:
- Add a new cDAC data type/descriptor for
ResolveHelperFrame(native descriptor + managed data adapter) and wire it into stack-walk frame classification/resumable handling. - Update platform frame handlers to support updating context from a raw
TransitionBlockpointer and to update argument registers forResolveHelperFramewhere appropriate (AMD64/ARM64). - Extend unit test infrastructure and stack-walk tests to cover
ResolveHelperFrameframe enumeration and AMD64 context reconstruction from theTransitionBlock.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/UnitTests/StackWalkTests.cs | Adds mock target/runtime-info setup and new tests covering ResolveHelperFrame enumeration + context update. |
| src/native/managed/cdac/tests/UnitTests/MockDescriptors/MockDescriptors.Frame.cs | Adds mock layouts/builders for ResolveHelperFrame, TransitionBlock, and minimal register sets. |
| src/native/managed/cdac/tests/TestInfrastructure/TestPlaceholderTarget.cs | Makes TryGetThreadContext return false so stack-walk can use its fallback path in tests. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/DataType.cs | Introduces DataType.ResolveHelperFrame. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/Frames/ResolveHelperFrame.cs | Adds managed cDAC data adapter for ResolveHelperFrame.TransitionBlockPtr. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/StackWalk_1.cs | Treats ResolveHelperFrame as resumable (FRAME_ATTR_RESUMABLE) in stack-walk state tracking. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/FrameHandling/IPlatformFrameHandler.cs | Extends frame-handler interface with HandleTransitionBlock and HandleResolveHelperFrame. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/FrameHandling/FrameHelpers.cs | Adds ResolveHelperFrame handling for context updates and return-address retrieval. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/FrameHandling/BaseFrameHandler.cs | Factors common transition-block handling and adds helper for updating argument registers from the transition block. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/FrameHandling/ARMFrameHandler.cs | Routes transition handling via HandleTransitionBlock and keeps ARM argument-register updates. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/FrameHandling/ARM64FrameHandler.cs | Updates argument registers for ResolveHelperFrame after applying the transition block. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/FrameHandling/AMD64FrameHandler.cs | Updates argument registers for ResolveHelperFrame after applying the transition block. |
| src/coreclr/vm/frames.h | Exposes ResolveHelperFrame::m_pTransitionBlock offset via cdac_data<ResolveHelperFrame>. |
| src/coreclr/vm/datadescriptor/datadescriptor.inc | Emits the native cDAC type descriptor for ResolveHelperFrame under FEATURE_RESOLVE_HELPER_DISPATCH. |
Copilot's findings
- Files reviewed: 14/14 changed files
- Comments generated: 1
Comment on lines
157
to
170
| TransitionBlock, | ||
| DebuggerEval, | ||
| ArgumentRegisters, | ||
| CalleeSavedRegisters, | ||
| HijackArgs, | ||
|
|
||
| Frame, | ||
| InlinedCallFrame, | ||
| SoftwareExceptionFrame, | ||
| FramedMethodFrame, | ||
| ResolveHelperFrame, | ||
| FuncEvalFrame, | ||
| ResumableFrame, | ||
| FaultingExceptionFrame, |
This was referenced Jun 11, 2026
Open
Add ResolveHelperFrame to the cDAC descriptor and managed frame model so stack walking can classify it, recover return addresses, treat it as resumable, and restore transition-block context. Add unit coverage for classification and AMD64 context restoration, including argument registers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
adfd317 to
64b2076
Compare
Add the directly-read ResolveHelperFrame.TransitionBlockPtr field to the contract's descriptor table and describe its handling: it uses the TransitionFrame mechanism but additionally restores argument registers on all platforms, and is gated by FEATURE_RESOLVE_HELPER_DISPATCH. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ARM64FrameHandler.HandleResolveHelperFrame (restoring argument registers from the TransitionBlock) was untested. Convert the AMD64-only fact into a theory covering X64 and Arm64: thread an explicit RuntimeInfoArchitecture through CreateTarget to select the platform handler, and parameterize the mock TransitionBlock register names so the Arm64 case restores x0/x19. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
cDac does not support ResolveFrameHelper, leading to broken stacks/missed roots when it's on the callstack.