summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike McLaughlin <mikem@microsoft.com>2015-12-03 16:24:46 -0800
committerMike McLaughlin <mikem@microsoft.com>2015-12-07 14:38:29 -0800
commit25369d2f68b7cd0c10b518350edfdf3251be8d68 (patch)
treeef04481d7408a73c54373b2ef700d2b2f605fe6e
parent9803ebe310d251a22499897a71fcda4407a2e468 (diff)
downloadcoreclr-25369d2f68b7cd0c10b518350edfdf3251be8d68.tar.gz
coreclr-25369d2f68b7cd0c10b518350edfdf3251be8d68.tar.bz2
coreclr-25369d2f68b7cd0c10b518350edfdf3251be8d68.zip
Add new IPC message for out of context unwinding used for HelperMethodFrames.
-rw-r--r--src/debug/di/shimdatatarget.cpp15
-rw-r--r--src/debug/di/shimdatatarget.h3
-rw-r--r--src/debug/di/shimlocaldatatarget.cpp20
-rw-r--r--src/debug/di/shimremotedatatarget.cpp16
-rw-r--r--src/debug/inc/dbgtransportsession.h4
-rw-r--r--src/debug/shared/dbgtransportsession.cpp54
6 files changed, 95 insertions, 17 deletions
diff --git a/src/debug/di/shimdatatarget.cpp b/src/debug/di/shimdatatarget.cpp
index 8221a0582a..22eed159dd 100644
--- a/src/debug/di/shimdatatarget.cpp
+++ b/src/debug/di/shimdatatarget.cpp
@@ -80,21 +80,6 @@ DWORD ShimDataTarget::GetPid()
}
//---------------------------------------------------------------------------------------
-//
-// Unwind the stack to the next frame.
-//
-// Return Value:
-// context and contextPointers filled in with the next frame
-//
-HRESULT STDMETHODCALLTYPE ShimDataTarget::VirtualUnwind(DWORD threadId, ULONG32 contextSize, PBYTE context)
-{
-#ifndef FEATURE_PAL
- _ASSERTE(!"ShimDataTarget::VirtualUnwind NOT IMPLEMENTED");
-#endif
- return E_NOTIMPL;
-}
-
-//---------------------------------------------------------------------------------------
// Hook a custom function to handle ICorDebugMutableDataTarget::ContinueStatusChanged
//
// Arguments:
diff --git a/src/debug/di/shimdatatarget.h b/src/debug/di/shimdatatarget.h
index 145b30cde1..64da7e9ef5 100644
--- a/src/debug/di/shimdatatarget.h
+++ b/src/debug/di/shimdatatarget.h
@@ -90,7 +90,8 @@ public:
//
// Unwind to the next stack frame
- virtual HRESULT STDMETHODCALLTYPE VirtualUnwind(DWORD threadId, ULONG32 contextSize, PBYTE context);
+ virtual HRESULT STDMETHODCALLTYPE VirtualUnwind(
+ DWORD threadId, ULONG32 contextSize, PBYTE context) = 0;
protected:
// Pid of the target process.
diff --git a/src/debug/di/shimlocaldatatarget.cpp b/src/debug/di/shimlocaldatatarget.cpp
index 9f3ba2ec1d..2a8c3aaa6d 100644
--- a/src/debug/di/shimlocaldatatarget.cpp
+++ b/src/debug/di/shimlocaldatatarget.cpp
@@ -67,6 +67,9 @@ public:
DWORD dwThreadId,
CORDB_CONTINUE_STATUS dwContinueStatus);
+ virtual HRESULT STDMETHODCALLTYPE VirtualUnwind(
+ DWORD threadId, ULONG32 contextSize, PBYTE context);
+
private:
// Handle to the process. We own this.
HANDLE m_hProcess;
@@ -450,3 +453,20 @@ ShimLocalDataTarget::ContinueStatusChanged(
}
return E_NOTIMPL;
}
+
+//---------------------------------------------------------------------------------------
+//
+// Unwind the stack to the next frame.
+//
+// Return Value:
+// context filled in with the next frame
+//
+HRESULT STDMETHODCALLTYPE
+ShimLocalDataTarget::VirtualUnwind(DWORD threadId, ULONG32 contextSize, PBYTE context)
+{
+#ifndef FEATURE_PAL
+ _ASSERTE(!"ShimLocalDataTarget::VirtualUnwind NOT IMPLEMENTED");
+#endif
+ return E_NOTIMPL;
+}
+
diff --git a/src/debug/di/shimremotedatatarget.cpp b/src/debug/di/shimremotedatatarget.cpp
index fd34d3317d..08874c5b41 100644
--- a/src/debug/di/shimremotedatatarget.cpp
+++ b/src/debug/di/shimremotedatatarget.cpp
@@ -64,6 +64,9 @@ public:
DWORD dwThreadId,
CORDB_CONTINUE_STATUS dwContinueStatus);
+ virtual HRESULT STDMETHODCALLTYPE VirtualUnwind(
+ DWORD threadId, ULONG32 contextSize, PBYTE context);
+
private:
DbgTransportTarget * m_pProxy;
DbgTransportSession * m_pTransport;
@@ -332,3 +335,16 @@ ShimRemoteDataTarget::ContinueStatusChanged(
}
return E_NOTIMPL;
}
+
+//---------------------------------------------------------------------------------------
+//
+// Unwind the stack to the next frame.
+//
+// Return Value:
+// context filled in with the next frame
+//
+HRESULT STDMETHODCALLTYPE
+ShimRemoteDataTarget::VirtualUnwind(DWORD threadId, ULONG32 contextSize, PBYTE context)
+{
+ return m_pTransport->VirtualUnwind(threadId, contextSize, context);
+} \ No newline at end of file
diff --git a/src/debug/inc/dbgtransportsession.h b/src/debug/inc/dbgtransportsession.h
index 6464646f1f..3b38b87bb7 100644
--- a/src/debug/inc/dbgtransportsession.h
+++ b/src/debug/inc/dbgtransportsession.h
@@ -371,6 +371,7 @@ public:
// Read and write memory on the LS from the RS.
HRESULT ReadMemory(PBYTE pbRemoteAddress, PBYTE pbBuffer, SIZE_T cbBuffer);
HRESULT WriteMemory(PBYTE pbRemoteAddress, PBYTE pbBuffer, SIZE_T cbBuffer);
+ HRESULT VirtualUnwind(DWORD threadId, ULONG32 contextSize, PBYTE context);
// Read and write the debugger control block on the LS from the RS.
HRESULT GetDCB(DebuggerIPCControlBlock *pDCB);
@@ -417,6 +418,7 @@ private:
// Misc management operations.
MT_ReadMemory, // RS <-> LS : RS wants to read LS memory block (or LS is replying to such a request)
MT_WriteMemory, // RS <-> LS : RS wants to write LS memory block (or LS is replying to such a request)
+ MT_VirtualUnwind, // RS <-> LS : RS wants to LS unwind a stack frame (or LS is replying to such a request)
MT_GetDCB, // RS <-> LS : RS wants to read LS DCB (or LS is replying to such a request)
MT_SetDCB, // RS <-> LS : RS wants to write LS DCB (or LS is replying to such a request)
MT_GetAppDomainCB, // RS <-> LS : RS wants to read LS AppDomainCB (or LS is replying to such a request)
@@ -557,6 +559,7 @@ private:
LONG m_cSentEvent;
LONG m_cSentReadMemory;
LONG m_cSentWriteMemory;
+ LONG m_cSentVirtualUnwind;
LONG m_cSentGetDCB;
LONG m_cSentSetDCB;
LONG m_cSentGetAppDomainCB;
@@ -571,6 +574,7 @@ private:
LONG m_cReceivedEvent;
LONG m_cReceivedReadMemory;
LONG m_cReceivedWriteMemory;
+ LONG m_cReceivedVirtualUnwind;
LONG m_cReceivedGetDCB;
LONG m_cReceivedSetDCB;
LONG m_cReceivedGetAppDomainCB;
diff --git a/src/debug/shared/dbgtransportsession.cpp b/src/debug/shared/dbgtransportsession.cpp
index 83335d1860..ad9931fd57 100644
--- a/src/debug/shared/dbgtransportsession.cpp
+++ b/src/debug/shared/dbgtransportsession.cpp
@@ -459,7 +459,6 @@ void MarshalDCBToDCBTransport(DebuggerIPCControlBlock* pIn, DebuggerIPCControlBl
pOut->m_specialThreadListDirty = pIn->m_specialThreadListDirty;
pOut->m_rightSideShouldCreateHelperThread = pIn->m_rightSideShouldCreateHelperThread;
-
}
@@ -504,6 +503,16 @@ HRESULT DbgTransportSession::WriteMemory(PBYTE pbRemoteAddress, PBYTE pbBuffer,
return sMessage.m_sHeader.TypeSpecificData.MemoryAccess.m_hrResult;
}
+HRESULT DbgTransportSession::VirtualUnwind(DWORD threadId, ULONG32 contextSize, PBYTE context)
+{
+ DbgTransportLog(LC_Requests, "Sending 'VirtualUnwind'");
+ DBG_TRANSPORT_INC_STAT(SentVirtualUnwind);
+
+ Message sMessage;
+ sMessage.Init(MT_VirtualUnwind, context, contextSize, context, contextSize);
+ return SendRequestMessageAndWait(&sMessage);
+}
+
// Read and write the debugger control block on the LS from the RS.
HRESULT DbgTransportSession::GetDCB(DebuggerIPCControlBlock *pDCB)
{
@@ -923,6 +932,7 @@ void DbgTransportSession::FlushSendQueue(DWORD dwLastProcessedId)
MessageType eType = pMsg->m_sHeader.m_eType;
if (eType != MT_ReadMemory &&
eType != MT_WriteMemory &&
+ eType != MT_VirtualUnwind &&
eType != MT_GetDCB &&
eType != MT_SetDCB &&
eType != MT_GetAppDomainCB)
@@ -1618,6 +1628,9 @@ void DbgTransportSession::TransportWorker()
// temporary data block used in DCB messages
DebuggerIPCControlBlockTransport dcbt;
+ // temporary virtual stack unwind context buffer
+ CONTEXT frameContext;
+
// Read a message header block.
if (!ReceiveBlock((PBYTE)&sReceiveHeader, sizeof(MessageHeader)))
HANDLE_TRANSIENT_ERROR();
@@ -1908,6 +1921,33 @@ void DbgTransportSession::TransportWorker()
#endif // RIGHT_SIDE_COMPILE
break;
+ case MT_VirtualUnwind:
+#ifdef RIGHT_SIDE_COMPILE
+ if (!ProcessReply(&sReceiveHeader))
+ HANDLE_TRANSIENT_ERROR();
+#else // RIGHT_SIDE_COMPILE
+ if (sReceiveHeader.m_cbDataBlock != (DWORD)sizeof(frameContext))
+ {
+ _ASSERTE(!"Inconsistent VirtualUnwind request");
+ HANDLE_CRITICAL_ERROR();
+ }
+
+ if (!ReceiveBlock((PBYTE)&frameContext, sizeof(frameContext)))
+ {
+ HANDLE_TRANSIENT_ERROR();
+ }
+
+ if (!PAL_VirtualUnwind(&frameContext, NULL))
+ {
+ HANDLE_TRANSIENT_ERROR();
+ }
+
+ fReplyRequired = true;
+ pbOptReplyData = (PBYTE)&frameContext;
+ cbOptReplyData = sizeof(frameContext);
+#endif // RIGHT_SIDE_COMPILE
+ break;
+
case MT_GetDCB:
#ifdef RIGHT_SIDE_COMPILE
if (!ProcessReply(&sReceiveHeader))
@@ -2053,6 +2093,7 @@ void DbgTransportSession::TransportWorker()
#ifdef RIGHT_SIDE_COMPILE
case MT_ReadMemory:
case MT_WriteMemory:
+ case MT_VirtualUnwind:
case MT_GetDCB:
case MT_SetDCB:
case MT_GetAppDomainCB:
@@ -2062,6 +2103,7 @@ void DbgTransportSession::TransportWorker()
#else // RIGHT_SIDE_COMPILE
case MT_ReadMemory:
case MT_WriteMemory:
+ case MT_VirtualUnwind:
case MT_GetDCB:
case MT_SetDCB:
case MT_GetAppDomainCB:
@@ -2441,6 +2483,8 @@ const char *DbgTransportSession::MessageName(MessageType eType)
return "ReadMemory";
case MT_WriteMemory:
return "WriteMemory";
+ case MT_VirtualUnwind:
+ return "VirtualUnwind";
case MT_GetDCB:
return "GetDCB";
case MT_SetDCB:
@@ -2497,6 +2541,10 @@ void DbgTransportSession::DbgTransportLogMessageReceived(MessageHeader *pHeader)
(DWORD)pHeader->TypeSpecificData.MemoryAccess.m_cbLeftSideBuffer);
DBG_TRANSPORT_INC_STAT(ReceivedWriteMemory);
return;
+ case MT_VirtualUnwind:
+ DbgTransportLog(LC_Requests, "Received 'VirtualUnwind' reply");
+ DBG_TRANSPORT_INC_STAT(ReceivedVirtualUnwind);
+ return;
case MT_GetDCB:
DbgTransportLog(LC_Requests, "Received 'GetDCB' reply");
DBG_TRANSPORT_INC_STAT(ReceivedGetDCB);
@@ -2522,6 +2570,10 @@ void DbgTransportSession::DbgTransportLogMessageReceived(MessageHeader *pHeader)
(DWORD)pHeader->TypeSpecificData.MemoryAccess.m_cbLeftSideBuffer);
DBG_TRANSPORT_INC_STAT(ReceivedWriteMemory);
return;
+ case MT_VirtualUnwind:
+ DbgTransportLog(LC_Requests, "Received 'VirtualUnwind'");
+ DBG_TRANSPORT_INC_STAT(ReceivedVirtualUnwind);
+ return;
case MT_GetDCB:
DbgTransportLog(LC_Requests, "Received 'GetDCB'");
DBG_TRANSPORT_INC_STAT(ReceivedGetDCB);