[cDAC] : Implement DacDBI GetThreadHandle and GetThreadAllocInfo#128388
Merged
Conversation
Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
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 Thread contract and the legacy DacDbi implementation to surface an OS thread handle and to implement IDacDbiInterface::GetThreadHandle / GetThreadAllocInfo using cDAC-backed data.
Changes:
- Add
ThreadHandleto the Thread data descriptor pipeline (CoreCLRcdac_data<Thread>+datadescriptor.inc, managed data reader, contract DTO, and docs). - Implement
DacDbiImpl.GetThreadHandleandDacDbiImpl.GetThreadAllocInfousing theIThreadcontract instead of returningE_NOTIMPL. - Add/adjust tests and mock descriptors to carry the new
ThreadHandlefield.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/ThreadTests.cs | Adds a contract-level test validating ThreadData.ThreadHandle. |
| src/native/managed/cdac/tests/MockDescriptors/MockDescriptors.Thread.cs | Extends the mock Thread layout/view to include a ThreadHandle pointer field. |
| src/native/managed/cdac/tests/ClrDataExceptionStateTests.cs | Updates ThreadData construction sites to include the new ThreadHandle field. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/IDacDbiInterface.cs | Refines COM signature for GetThreadHandle to an output pointer-to-handle shape. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Dbi/DacDbiImpl.cs | Implements GetThreadHandle and GetThreadAllocInfo using cDAC contracts (with DEBUG parity checks). |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/Thread.cs | Reads the new ThreadHandle field from the Thread type descriptor into the managed data model. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Thread_1.cs | Plumbs ThreadHandle into the ThreadData returned by IThread.GetThreadData. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IThread.cs | Extends the public ThreadData record struct with a new positional ThreadHandle field. |
| src/coreclr/vm/threads.h | Exposes Thread::m_ThreadHandle offset via cdac_data<Thread>. |
| src/coreclr/vm/datadescriptor/datadescriptor.inc | Adds ThreadHandle to the Thread data descriptor field list. |
| docs/design/datacontracts/Thread.md | Documents the new ThreadHandle field and descriptor dependency. |
Copilot's findings
- Files reviewed: 11/11 changed files
- Comments generated: 6
jkotas
reviewed
May 20, 2026
Member
|
Should the native Dbi GetThreadHandle be updated for this new behavior (returning 0 on non-windows platforms)? |
max-charlamb
approved these changes
May 22, 2026
Member
max-charlamb
left a comment
There was a problem hiding this comment.
looks reasonable. small nit regarding documenting that this API is not x-bitness safe
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
|
/ba-g tests already ran, nit comment change |
Contributor
|
/ba-g nit comment change, tests already ran |
Contributor
|
/ba-g nit comment, already ran tests |
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.
Implement DacDBI GetThreadHandle and GetThreadAllocInfo. No new contracts.