Uh oh!
There was an error while loading. Please reload this page.
[cDAC] Implement IXCLRDataProcess.EnumMethodInstancesByAddress - #115131
Conversation
Tagging subscribers to this area: @tommcdon |
a2601ce to
fc70764CompareUh oh!
There was an error while loading. Please reload this page.
fc70764 to
ff70d24Compare6a947f1 to
533ac30Compare04ea4de to
dc87671CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull Request Overview
This PR implements IXCLRDataProcess.EnumMethodInstancesByAddress and related APIs to support enumerating method instances for debugging scenarios. The implementation introduces new data contracts for reading instantiated methods and type parameters from modules, along with the necessary COM wrappers.
- Implements the core enumeration APIs for method instances by address
- Adds IXCLRDataMethodInstance COM interface with token/scope and entry address methods
- Extends contracts to support reading hash tables for instantiated methods and available type parameters
Reviewed Changes
Copilot reviewed 27 out of 29 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/MockDescriptors/MockDescriptors.cs | Adds new Module fields for AvailableTypeParams and InstMethodHashTable |
| src/native/managed/cdac/tests/MockDescriptors/MockDescriptors.MethodDescriptors.cs | Adds dummy MethodDescSizeTable global for tests |
| src/native/managed/cdac/mscordaccore_universal/Legacy/SOSDacImpl.IXCLRDataProcess.cs | Implements core enumeration logic and EnumMethodInstances helper class |
| src/native/managed/cdac/mscordaccore_universal/Legacy/IXCLRData.cs | Defines IXCLRDataMethodInstance interface and updates method signatures |
| src/native/managed/cdac/mscordaccore_universal/Legacy/ClrDataModule.cs | Updates signature for EnumMethodInstanceByName |
| src/native/managed/cdac/mscordaccore_universal/Legacy/ClrDataMethodInstance.cs | Implements IXCLRDataMethodInstance COM wrapper |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader/CachingContractRegistry.cs | Minor formatting fix |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/RuntimeTypeSystemHelpers/MethodDescFlags_1.cs | Adds HasAsyncMethodData flag |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/Module.cs | Adds AvailableTypeParams and InstMethodHashTable fields |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/MethodDescChunk.cs | Adds FirstMethodDesc calculated field |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/InstMethodHashTable.cs | New data type for reading instantiated method hash tables |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/EETypeHashTable.cs | New data type for reading available type parameter hash tables |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/EEClass.cs | Adds MethodDescChunk field |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/DacEnumerableHash.cs | Base implementation for reading DAC enumerable hash tables |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/RuntimeTypeSystem_1.cs | Implements GetMethodDescForSlot and GetIntroducedMethods |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/Loader_1.cs | Implements GetAvailableTypeParams and GetInstantiatedMethods |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Constants.cs | Adds MethodDescSizeTable global |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/DataType.cs | Adds new data types EETypeHashTable and InstMethodHashTable |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IRuntimeTypeSystem.cs | Adds GetMethodDescForSlot method |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/ILoader.cs | Adds GetAvailableTypeParams and GetInstantiatedMethods methods |
| src/coreclr/vm/typehash.h | Adds cdac_data template specialization for EETypeHashTable |
| src/coreclr/vm/instmethhash.h | Adds cdac_data template specialization for InstMethodHashTable |
| src/coreclr/vm/dacenumerablehash.h | Fixes typo and adds friend declaration for cdac_data |
| src/coreclr/vm/class.h | Adds MethodDescChunk field to cdac_data template |
| src/coreclr/debug/runtimeinfo/datadescriptor.inc | Adds data descriptors for new types and fields |
| docs/design/datacontracts/RuntimeTypeSystem.md | Documents new APIs and data structures |
| docs/design/datacontracts/Loader.md | Documents new hash table reading functionality |
Comments suppressed due to low confidence (1)
src/native/managed/cdac/mscordaccore_universal/Legacy/SOSDacImpl.IXCLRDataProcess.cs:143
- The field _appDomain should not be readonly since it's assigned in the constructor but accessed publicly. Either make it a property or remove readonly.
public readonly TargetPointer _appDomain;
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Contributes to #114336
Implements:
IXCLRDataProcess.StartEnumMethodInstancesByAddressIXCLRDataProcess.EnumMethodInstancesByAddressIXCLRDataProcess.EndEnumMethodInstancesByAddressIXCLRDataMethodInstance.GetTokenAndScopeIXCLRDataMethodInstance.GetRepresentativeEntryAddressThese final two APIs allow me to test that enumerating the method instances return the correct COM object/data.
In order to implement these APIs, the following contracts were updated:
IEnumerable<TargetPointer> GetAvailableTypeParams(ModuleHandle handle)IEnumerable<TargetPointer> GetInstantiatedMethods(ModuleHandle handle)TargetPointer GetMethodDescForSlot(TypeHandle methodTable, ushort slot)and the following data types were added:
EETypeHashTableto read available type parameters on a moduleInstMethodHashTableto read instantiated methods in a moduleFixed small bug in DAC where status wasn't properly returned in
ClrDataAccess::StartEnumMethodInstancesByAddressQuestions
Where should I addMethodDesc::s_ClassificationSizeTableto the DAC Enum memory regions so it is present in all mini dumps?Should the RuntimeTypeSystem contract be updated here, or in another PR regarding the async changes? Do we need to do a contract bump?