Adding GetStaticBaseAddress cDAC API#118282
Merged
rcj1 merged 9 commits intodotnet:mainfrom Aug 13, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new cDAC API called GetStaticBaseAddress which provides access to static field base addresses for types. The implementation extracts GC and non-GC static base pointers from the DynamicStaticsInfo structure associated with method tables.
Key changes:
- Implements the
GetStaticBaseAddressmethod in the cDAC interface to replace the legacy implementation fallback - Adds new runtime type system methods for accessing GC and non-GC static base pointers
- Introduces DynamicStaticsInfo data structure and associated global constants for static field access
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| SOSDacImpl.cs | Implements GetStaticBaseAddress method with validation, contract calls, and debug verification |
| DynamicStaticsInfo.cs | New data structure for reading GC and non-GC static pointers with masking |
| RuntimeTypeSystem_1.cs | Adds GetGCStaticsBasePointer and GetNonGCStaticsBasePointer methods to access static fields |
| Constants.cs | Adds global constants for StaticsPointerMask and DynamicStaticsInfoSize |
| DataType.cs | Registers DynamicStaticsInfo as a new data type |
| IRuntimeTypeSystem.cs | Adds interface definitions for the new static base pointer methods |
| datadescriptor.inc | Defines CDAC type and global mappings for DynamicStaticsInfo |
| RuntimeTypeSystem.md | Documents the new API methods and data structures |
Comments suppressed due to low confidence (3)
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs:36
- The field name
DynamicStaticsInfoSizesuggests it contains a size value, but it's declared asTargetPointerwhich typically represents an address. Consider renaming to clarify its purpose or change the type tonuintif it represents a size.
internal TargetPointer DynamicStaticsInfoSize { get; }
docs/design/datacontracts/RuntimeTypeSystem.md:478
- The variable
targetis used but should be_targetto match the class field naming convention used elsewhere in the codebase.
nuint mask = target.ReadGlobal<nuint>(Constants.Globals.StaticsPointerMask);
docs/design/datacontracts/RuntimeTypeSystem.md:493
- The variable
targetis used but should be_targetto match the class field naming convention used elsewhere in the codebase.
nuint mask = target.ReadGlobal<nuint>(Constants.Globals.StaticsPointerMask);
Contributor
|
Tagging subscribers to this area: @steveisok, @dotnet/dotnet-diag |
max-charlamb
reviewed
Aug 1, 2025
...ged/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs
Outdated
Show resolved
Hide resolved
max-charlamb
reviewed
Aug 4, 2025
...ged/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs
Show resolved
Hide resolved
max-charlamb
reviewed
Aug 6, 2025
max-charlamb
approved these changes
Aug 13, 2025
This was referenced Aug 13, 2025
This was referenced Aug 13, 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.