[cDAC] Adding IsLeafFrame and GetContext DacDbi APIs#127195
Merged
rcj1 merged 9 commits intodotnet:mainfrom Apr 28, 2026
Merged
[cDAC] Adding IsLeafFrame and GetContext DacDbi APIs#127195rcj1 merged 9 commits intodotnet:mainfrom
rcj1 merged 9 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for new stack-walk related APIs across the cDAC contracts layer and the legacy DacDbi surface, focusing on retrieving thread contexts and determining leaf frames, and updates dump-based tests accordingly. It also removes the native DAC fallback behavior when the data target doesn’t implement GetThreadContext, aligning with the PR’s stated assumption.
Changes:
- Add
IThread.GetContext(...)andIStackWalk.AreContextsEqual(...)contract APIs and use them from stack walking and DacDbi implementations. - Implement
DacDbiImpl.GetContext/DacDbiImpl.IsLeafFramein managed cDAC and add dump tests for these APIs. - Update native DAC
GetContext/IsLeafFrameto always rely onGetThreadContext(noE_NOTIMPLfallback).
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/DumpTests/StackWalkDumpTests.cs | Adds dump tests for Thread.GetContext and StackWalk.AreContextsEqual. |
| src/native/managed/cdac/tests/DumpTests/DacDbi/DacDbiStackWalkDumpTests.cs | New dump tests validating DacDbiImpl GetContext and IsLeafFrame. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/IDacDbiInterface.cs | Updates interop signatures to use byte* context buffers. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Implements IsLeafFrame and GetContext via contracts (with DEBUG cross-validation). |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Thread_1.cs | Implements IThread.GetContext using filter contexts or TryGetThreadContext. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/StackWalk_1.cs | Adds AreContextsEqual and routes stackwalk thread-context acquisition through Thread.GetContext. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/*.cs | Splits context flags into FullContextFlags vs AllContextFlags across supported architectures. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/IPlatformContext.cs | Renames/expands context-flag properties to FullContextFlags and AllContextFlags. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/IPlatformAgnosticContext.cs | Same flag-property updates at platform-agnostic level. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/ContextHolder.cs | Plumbs new context-flag properties through the holder type. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IThread.cs | Adds ThreadContextSource and the GetContext contract API. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IStackWalk.cs | Adds AreContextsEqual to the StackWalk contract surface. |
| src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp | Updates native IsLeafFrame to always use GetThreadContext directly. |
| src/coreclr/debug/daccess/dacdbiimpl.cpp | Removes E_NOTIMPL fallback path from native GetContext. |
| docs/design/datacontracts/StackWalk.md | Documents new AreContextsEqual API behavior. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jkotas
reviewed
Apr 21, 2026
jkotas
reviewed
Apr 21, 2026
…er.Contracts/Contracts/StackWalk/StackWalk_1.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This was referenced Apr 22, 2026
Open
3 tasks
3 tasks
max-charlamb
approved these changes
Apr 28, 2026
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.
Assuming we don't care about datatargets that don't implement
GetThreadContext.