-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Adding GetStaticBaseAddress cDAC API #118282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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);
|
Tagging subscribers to this area: @steveisok, @dotnet/dotnet-diag |
No description provided.