diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2018-09-06 10:15:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-06 10:15:21 +0200 |
commit | 2a236b31a65614f5318cad794a5f38f4e566674e (patch) | |
tree | 255aa82fc7e3dd8275f93cd845684607bd42d3a1 /src/inc | |
parent | 045915424f7c4a3e6647cf35d6fca8a7fe48ea16 (diff) | |
download | coreclr-2a236b31a65614f5318cad794a5f38f4e566674e.tar.gz coreclr-2a236b31a65614f5318cad794a5f38f4e566674e.tar.bz2 coreclr-2a236b31a65614f5318cad794a5f38f4e566674e.zip |
Add support for collectible types to SOS (#19842)
* Add support for collectible types to SOS
Collectible types indirectly reference managed LoaderAllocator via
pointer to native AssemblyLoaderAllocator stored in their MethodTable.
GC uses this relation when scanning object graph to determine which
objects are rooted and which ones are not.
The gcroot command in SOS doesn't understand this relation and so it
is unable to find all roots for LoaderAllocator.
This change fixes it.
* PR feedback
Make the failure to get the collectible info non-fatal to make it
compatible with older runtimes.
Diffstat (limited to 'src/inc')
-rw-r--r-- | src/inc/dacprivate.h | 20 | ||||
-rw-r--r-- | src/inc/sospriv.idl | 10 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/inc/dacprivate.h b/src/inc/dacprivate.h index 2f7482680d..47e79a131f 100644 --- a/src/inc/dacprivate.h +++ b/src/inc/dacprivate.h @@ -177,6 +177,25 @@ struct MSLAYOUT DacpMethodTableFieldData : ZeroInit<DacpMethodTableFieldData> } }; +struct MSLAYOUT DacpMethodTableCollectibleData : ZeroInit<DacpMethodTableCollectibleData> +{ + CLRDATA_ADDRESS LoaderAllocatorObjectHandle; + BOOL bCollectible; + + HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr) + { + HRESULT hr; + ISOSDacInterface6 *pSOS6 = NULL; + if (SUCCEEDED(hr = sos->QueryInterface(__uuidof(ISOSDacInterface6), (void**)&pSOS6))) + { + hr = pSOS6->GetMethodTableCollectibleData(addr, this); + pSOS6->Release(); + } + + return hr; + } +}; + struct MSLAYOUT DacpMethodTableTransparencyData : ZeroInit<DacpMethodTableTransparencyData> { BOOL bHasCriticalTransparentInfo; @@ -1043,5 +1062,6 @@ static_assert(sizeof(DacpGetModuleAddress) == 0x8, "Dacp structs cannot be modif static_assert(sizeof(DacpFrameData) == 0x8, "Dacp structs cannot be modified due to backwards compatibility."); static_assert(sizeof(DacpJitCodeHeapInfo) == 0x18, "Dacp structs cannot be modified due to backwards compatibility."); static_assert(sizeof(DacpExceptionObjectData) == 0x38, "Dacp structs cannot be modified due to backwards compatibility."); +static_assert(sizeof(DacpMethodTableCollectibleData) == 0x10, "Dacp structs cannot be modified due to backwards compatibility."); #endif // _DACPRIVATE_H_ diff --git a/src/inc/sospriv.idl b/src/inc/sospriv.idl index 5b718210d7..589642675f 100644 --- a/src/inc/sospriv.idl +++ b/src/inc/sospriv.idl @@ -367,3 +367,13 @@ interface ISOSDacInterface5 : IUnknown { HRESULT GetTieredVersions(CLRDATA_ADDRESS methodDesc, int rejitId, struct DacpTieredVersionData *nativeCodeAddrs, int cNativeCodeAddrs, int *pcNativeCodeAddrs); }; + +[ + object, + local, + uuid(11206399-4B66-4EDB-98EA-85654E59AD45) +] +interface ISOSDacInterface6 : IUnknown +{ + HRESULT GetMethodTableFieldData(CLRDATA_ADDRESS mt, struct DacpMethodTableFieldData *data); +}; |