Skip to content

Commit

Permalink
Add dac apis for comwrappers style ccws/rcws (dotnet#42942)
Browse files Browse the repository at this point in the history
  • Loading branch information
davmason authored Oct 6, 2020
1 parent 214458e commit 1beb1c6
Show file tree
Hide file tree
Showing 11 changed files with 1,350 additions and 853 deletions.
4 changes: 4 additions & 0 deletions src/coreclr/src/debug/daccess/daccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3297,6 +3297,10 @@ ClrDataAccess::QueryInterface(THIS_
{
ifaceRet = static_cast<ISOSDacInterface9*>(this);
}
else if (IsEqualIID(interfaceId, __uuidof(ISOSDacInterface10)))
{
ifaceRet = static_cast<ISOSDacInterface10*>(this);
}
else
{
*iface = NULL;
Expand Down
11 changes: 10 additions & 1 deletion src/coreclr/src/debug/daccess/dacimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,8 @@ class ClrDataAccess
public ISOSDacInterface6,
public ISOSDacInterface7,
public ISOSDacInterface8,
public ISOSDacInterface9
public ISOSDacInterface9,
public ISOSDacInterface10
{
public:
ClrDataAccess(ICorDebugDataTarget * pTarget, ICLRDataTarget * pLegacyTarget=0);
Expand Down Expand Up @@ -1209,6 +1210,12 @@ class ClrDataAccess
// ISOSDacInterface9
virtual HRESULT STDMETHODCALLTYPE GetBreakingChangeVersion(int* pVersion);

// ISOSDacInterface10
virtual HRESULT STDMETHODCALLTYPE GetObjectComWrappersData(CLRDATA_ADDRESS objAddr, CLRDATA_ADDRESS *rcw, unsigned int count, CLRDATA_ADDRESS *mowList, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE IsComWrappersCCW(CLRDATA_ADDRESS ccw, BOOL *isComWrappersCCW);
virtual HRESULT STDMETHODCALLTYPE GetComWrappersCCWData(CLRDATA_ADDRESS ccw, CLRDATA_ADDRESS *managedObject, int *refCount);
virtual HRESULT STDMETHODCALLTYPE IsComWrappersRCW(CLRDATA_ADDRESS rcw, BOOL *isComWrappersRCW);
virtual HRESULT STDMETHODCALLTYPE GetComWrappersRCWData(CLRDATA_ADDRESS rcw, CLRDATA_ADDRESS *identity);
//
// ClrDataAccess.
//
Expand Down Expand Up @@ -1475,6 +1482,8 @@ class ClrDataAccess
#endif

#ifdef FEATURE_COMWRAPPERS
BOOL DACIsComWrappersCCW(CLRDATA_ADDRESS ccwPtr);
TADDR DACGetManagedObjectWrapperFromCCW(CLRDATA_ADDRESS ccwPtr);
HRESULT DACTryGetComWrappersObjectFromCCW(CLRDATA_ADDRESS ccwPtr, OBJECTREF* objRef);
#endif

Expand Down
24 changes: 12 additions & 12 deletions src/coreclr/src/debug/daccess/enummem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1424,21 +1424,21 @@ HRESULT ClrDataAccess::DumpStowedExceptionObject(CLRDataEnumMemoryFlags flags, C

OBJECTREF managedExceptionObject = NULL;

#ifdef FEATURE_COMINTEROP
// dump the managed exception object wrapped in CCW
// memory of the CCW object itself is dumped later by DacInstanceManager::DumpAllInstances
DacpCCWData ccwData;
GetCCWData(ccwPtr, &ccwData); // this call collects some memory implicitly
managedExceptionObject = OBJECTREF(CLRDATA_ADDRESS_TO_TADDR(ccwData.managedObject));
#endif
#ifdef FEATURE_COMWRAPPERS
OBJECTREF wrappedObjAddress;
if (DACTryGetComWrappersObjectFromCCW(ccwPtr, &wrappedObjAddress) == S_OK)
{
managedExceptionObject = wrappedObjAddress;
}
#endif
#ifdef FEATURE_COMINTEROP
if (managedExceptionObject == NULL)
{
OBJECTREF wrappedObjAddress;
if (DACTryGetComWrappersObjectFromCCW(ccwPtr, &wrappedObjAddress) == S_OK)
{
managedExceptionObject = wrappedObjAddress;
}
// dump the managed exception object wrapped in CCW
// memory of the CCW object itself is dumped later by DacInstanceManager::DumpAllInstances
DacpCCWData ccwData;
GetCCWData(ccwPtr, &ccwData); // this call collects some memory implicitly
managedExceptionObject = OBJECTREF(CLRDATA_ADDRESS_TO_TADDR(ccwData.managedObject));
}
#endif
DumpManagedExcepObject(flags, managedExceptionObject);
Expand Down
Loading

0 comments on commit 1beb1c6

Please sign in to comment.