Implement ISOSDacInterface::GetThreadAllocData in cDAC SOSDacImpl#124817
Merged
max-charlamb merged 10 commits intomainfrom Feb 26, 2026
Merged
Implement ISOSDacInterface::GetThreadAllocData in cDAC SOSDacImpl#124817max-charlamb merged 10 commits intomainfrom
max-charlamb merged 10 commits intomainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @agocke, @VSadov |
- Add AllocBytes and AllocBytesLoh fields to GCAllocContext data descriptor - Add ThreadAllocData record struct and GetThreadAllocData to IThread contract - Implement GetThreadAllocData in Thread_1.cs contract - Define DacpAllocData managed struct in ISOSDacInterface.cs - Implement GetThreadAllocData in SOSDacImpl.cs with DEBUG comparison - Add unit tests for GetThreadAllocData with non-zero and zero values - Add dump test for GetThreadAllocData - Update Thread.md and GC.md documentation Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement GetThreadAllocData in SOSDacImpl
Implement ISOSDacInterface::GetThreadAllocData in cDAC SOSDacImpl
Feb 24, 2026
Member
max-charlamb
left a comment
There was a problem hiding this comment.
@copilot , address feedback
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs
Outdated
Show resolved
Hide resolved
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs
Show resolved
Hide resolved
...tive/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IThread.cs
Outdated
Show resolved
Hide resolved
…eption for E_POINTER, rename to GetThreadAllocContext Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Contributor
Author
Member
max-charlamb
left a comment
There was a problem hiding this comment.
@copilot , address feedback
...native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Thread_1.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Implements ISOSDacInterface::GetThreadAllocData in the cDAC-based SOSDacImpl by exposing per-thread GC allocation byte counters from gc_alloc_context through the managed contracts and data descriptors.
Changes:
- Added
AllocBytes/AllocBytesLohfields to theGCAllocContextdata descriptor and managed data model. - Extended the
IThreadcontract withGetThreadAllocContextreturning a newThreadAllocDatarecord, and wired it intoSOSDacImpl.GetThreadAllocData. - Added unit + dump tests and updated mock descriptors and design docs to cover/describe the new fields.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/ThreadTests.cs | Adds unit tests for GetThreadAllocContext. |
| src/native/managed/cdac/tests/MockDescriptors/MockDescriptors.Thread.cs | Extends mock type layouts and thread creation to include alloc-context hierarchy and alloc byte values. |
| src/native/managed/cdac/tests/DumpTests/ThreadDumpTests.cs | Adds dump test to validate alloc context can be read across all threads. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs | Implements GetThreadAllocData using the IThread contract and follows existing try/catch + DEBUG-compare patterns. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ISOSDacInterface.cs | Introduces DacpAllocData and updates the interface signature to use it. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/GCAllocContext.cs | Reads new alloc-byte fields from the target in managed data representation. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Thread_1.cs | Implements IThread.GetThreadAllocContext. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IThread.cs | Adds ThreadAllocData record and the new contract method. |
| src/coreclr/vm/datadescriptor/datadescriptor.inc | Adds GCAllocContext field descriptors for alloc byte counts. |
| docs/design/datacontracts/Thread.md | Documents new GCAllocContext field dependencies for the Thread contract. |
| docs/design/datacontracts/GC.md | Documents new GCAllocContext field descriptors used by GC-related contracts. |
...ative/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/GCAllocContext.cs
Show resolved
Hide resolved
Member
|
@copilot, please fix build break |
…dAllocContext test and fix trailing whitespace Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Contributor
Author
rcj1
reviewed
Feb 24, 2026
...tive/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IThread.cs
Outdated
Show resolved
Hide resolved
…ontext Co-authored-by: rcj1 <77995559+rcj1@users.noreply.github.com>
This was referenced Feb 25, 2026
Open
Member
max-charlamb
left a comment
There was a problem hiding this comment.
@copilot , address feedback
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Contributor
Author
3 tasks
rcj1
approved these changes
Feb 26, 2026
noahfalk
approved these changes
Feb 26, 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.
AllocBytesandAllocBytesLohfields toGCAllocContextindatadescriptor.incGCAllocContextdata class with correspondinglongpropertiesGetThreadAllocContextwithoutparameters toIThreadcontract; implement inThread_1DacpAllocDatastruct and implementGetThreadAllocDatainSOSDacImplThread.md,GC.md)ThreadAllocDatastruct withoutparameters onGetThreadAllocContext💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.