Adding GetThreadStaticBaseAddress cDAC API#118411
Merged
rcj1 merged 8 commits intodotnet:mainfrom Aug 12, 2025
Merged
Conversation
Contributor
|
Tagging subscribers to this area: @steveisok, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements the GetThreadStaticBaseAddress cDAC (Contract-based Data Access) API to enable access to thread-local static fields in the .NET runtime. The implementation provides a new diagnostic interface for retrieving base addresses of both GC and non-GC thread static variables.
Key changes:
- Implements GetThreadStaticBaseAddress method in SOSDacImpl to replace legacy fallback with full cDAC implementation
- Adds comprehensive thread-local storage (TLS) data structures and contracts for accessing thread static fields
- Integrates new TLS functionality into RuntimeTypeSystem contract for retrieving thread static base pointers
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| SOSDacImpl.cs | Replaces legacy implementation with full cDAC implementation of GetThreadStaticBaseAddress |
| ThreadStaticsInfo.cs | New data structure for thread static information containing GC and non-GC TLS indices |
| ThreadLocalData.cs | New data structure representing thread-local data with collectible/non-collectible arrays |
| Thread.cs | Adds ThreadLocalDataPtr field to Thread data structure |
| TLSIndex.cs | New data structure for TLS index with allocation status and type information |
| InflightTLSData.cs | New data structure for in-flight TLS data during class constructor execution |
| Thread_1.cs | Implements GetThreadLocalStaticBase method with TLS index type handling |
| RuntimeTypeSystem_1.cs | Adds methods to get GC/non-GC thread static base pointers |
| Constants.cs | Adds new global constants for TLS array operations |
| DataType.cs | Adds new data types for thread-local storage structures |
| IThread.cs | Adds GetThreadLocalStaticBase method to thread contract interface |
| IRuntimeTypeSystem.cs | Adds GC/non-GC thread static base pointer methods to contract |
| threadstatics.h | Moves InFlightTLSData structure definition to header for DAC access |
| threadstatics.cpp | Updates InFlightTLSData implementation to use header definition |
| threads.h | Adds ThreadLocalDataPtr to thread data structure for cDAC |
| datadescriptor.inc | Adds cDAC type descriptors for all new TLS-related structures |
| Thread.md | Documents new thread contract API and data structures |
| RuntimeTypeSystem.md | Documents new runtime type system methods for thread statics |
...ged/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
max-charlamb
reviewed
Aug 6, 2025
src/native/managed/cdac/mscordaccore_universal/Legacy/SOSDacImpl.cs
Outdated
Show resolved
Hide resolved
...ged/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs
Outdated
Show resolved
Hide resolved
...native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Thread_1.cs
Outdated
Show resolved
Hide resolved
max-charlamb
reviewed
Aug 8, 2025
max-charlamb
approved these changes
Aug 12, 2025
Member
max-charlamb
left a comment
There was a problem hiding this comment.
looks good except for a couple small comments
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Constants.cs
Outdated
Show resolved
Hide resolved
This was referenced Aug 12, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.