Skip to content
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

Implement unwrapping a ComWrappers CCW when dumping a stowed exception. #36360

Merged
merged 3 commits into from
May 14, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Change usage of CLRDATA_ADDRESS to TADDR.
  • Loading branch information
jkoritzinsky committed May 14, 2020
commit 14b34da0780c206bc151801599fc4eb437f5c2db
25 changes: 13 additions & 12 deletions src/coreclr/src/debug/daccess/request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4077,12 +4077,13 @@ HRESULT ClrDataAccess::DACTryGetComWrappersObjectFromCCW(CLRDATA_ADDRESS ccwPtr,

// Read CCWs QI address and compare it to the managed object wrapper's implementation.
ULONG32 bytesRead = 0;
CLRDATA_ADDRESS vTableAddress = NULL;
IfFailGo(m_pTarget->ReadVirtual(ccwPtr, (PBYTE)&vTableAddress, sizeof(CLRDATA_ADDRESS), &bytesRead));
if (bytesRead != sizeof(CLRDATA_ADDRESS)
TADDR ccw = CLRDATA_ADDRESS_TO_TADDR(ccwPtr);
TADDR vTableAddress = NULL;
IfFailGo(m_pTarget->ReadVirtual(ccw, (PBYTE)&vTableAddress, sizeof(TADDR), &bytesRead));
if (bytesRead != sizeof(TADDR)
|| vTableAddress == NULL)
{
hr = S_FALSE;
hr = E_FAIL;
goto ErrExit;
}

Expand All @@ -4091,7 +4092,7 @@ HRESULT ClrDataAccess::DACTryGetComWrappersObjectFromCCW(CLRDATA_ADDRESS ccwPtr,
if (bytesRead != sizeof(TADDR)
|| qiAddress == NULL)
{
hr = S_FALSE;
hr = E_FAIL;
goto ErrExit;
}

Expand All @@ -4103,27 +4104,27 @@ HRESULT ClrDataAccess::DACTryGetComWrappersObjectFromCCW(CLRDATA_ADDRESS ccwPtr,

if (qiAddress != GetEEFuncEntryPoint(ManagedObjectWrapper_QueryInterface))
AaronRobinsonMSFT marked this conversation as resolved.
Show resolved Hide resolved
{
hr = S_FALSE;
hr = E_FAIL;
goto ErrExit;
}

// Mask the "dispatch pointer" to get a double pointer to the ManagedObjectWrapper
CLRDATA_ADDRESS managedObjectWrapperPtrPtr = ccwPtr & InteropLib::ABI::DispatchThisPtrMask;
TADDR managedObjectWrapperPtrPtr = ccw & InteropLib::ABI::DispatchThisPtrMask;

// Return ManagedObjectWrapper as an OBJECTHANDLE. (The OBJECTHANDLE is guaranteed to live at offset 0).
CLRDATA_ADDRESS managedObjectWrapperPtr;
IfFailGo(m_pTarget->ReadVirtual(managedObjectWrapperPtrPtr, (PBYTE)&managedObjectWrapperPtr, sizeof(CLRDATA_ADDRESS), &bytesRead));
if (bytesRead != sizeof(CLRDATA_ADDRESS))
TADDR managedObjectWrapperPtr;
IfFailGo(m_pTarget->ReadVirtual(managedObjectWrapperPtrPtr, (PBYTE)&managedObjectWrapperPtr, sizeof(TADDR), &bytesRead));
if (bytesRead != sizeof(TADDR))
{
hr = S_FALSE;
hr = E_FAIL;
goto ErrExit;
}

OBJECTHANDLE handle;
IfFailGo(m_pTarget->ReadVirtual(managedObjectWrapperPtr, (PBYTE)&handle, sizeof(OBJECTHANDLE), &bytesRead));
if (bytesRead != sizeof(OBJECTHANDLE))
{
hr = S_FALSE;
hr = E_FAIL;
goto ErrExit;
}

Expand Down