From 04f246161b183e9699f9a61d9a3db0474948b35b Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Thu, 8 Nov 2018 21:12:57 -0800 Subject: [PATCH] Revert "Passing the CONTEXT in ICorDebugManagedCallback4::DataBreakpoint" This reverts commit dotnet/coreclr@9dd2a3688320fa197a3a2a412523416f10e7fa3b. Commit migrated from https://github.com/dotnet/coreclr/commit/592bc01e8da6bb4f692b3b090a3c82d415a3b7d7 --- src/coreclr/src/debug/di/process.cpp | 2 +- src/coreclr/src/debug/di/rsmain.cpp | 4 ++-- src/coreclr/src/debug/di/shimcallback.cpp | 12 ++++-------- src/coreclr/src/debug/di/shimpriv.h | 2 +- src/coreclr/src/debug/ee/controller.h | 18 +++++++++++++++++- src/coreclr/src/debug/ee/debugger.cpp | 1 - src/coreclr/src/debug/inc/dbgipcevents.h | 5 ----- src/coreclr/src/debug/shared/dbgtransportsession.cpp | 6 ++---- src/coreclr/src/inc/cordebug.idl | 8 +++----- src/coreclr/src/pal/prebuilt/inc/cordebug.h | 12 ++++-------- 10 files changed, 34 insertions(+), 36 deletions(-) diff --git a/src/coreclr/src/debug/di/process.cpp b/src/coreclr/src/debug/di/process.cpp index cad2c9b..a5116f7 100644 --- a/src/coreclr/src/debug/di/process.cpp +++ b/src/coreclr/src/debug/di/process.cpp @@ -4922,7 +4922,7 @@ void CordbProcess::RawDispatchEvent( { PUBLIC_CALLBACK_IN_THIS_SCOPE(this, pLockHolder, pEvent); - pCallback4->DataBreakpoint(static_cast(this), pThread, reinterpret_cast(&(pEvent->DataBreakpointData.context)), sizeof(CONTEXT)); + pCallback4->DataBreakpoint(static_cast(this), pThread); } break; } diff --git a/src/coreclr/src/debug/di/rsmain.cpp b/src/coreclr/src/debug/di/rsmain.cpp index 750cb1d..8f26de0 100644 --- a/src/coreclr/src/debug/di/rsmain.cpp +++ b/src/coreclr/src/debug/di/rsmain.cpp @@ -870,7 +870,7 @@ namespace virtual ULONG STDMETHODCALLTYPE Release(); COM_METHOD BeforeGarbageCollection(ICorDebugProcess* pProcess); COM_METHOD AfterGarbageCollection(ICorDebugProcess* pProcess); - COM_METHOD DataBreakpoint(ICorDebugProcess* pProcess, ICorDebugThread* pThread, BYTE* pContext, ULONG32 contextSize); + COM_METHOD DataBreakpoint(ICorDebugProcess* pProcess, ICorDebugThread* pThread); private: // not implemented DefaultManagedCallback4(const DefaultManagedCallback4&); @@ -944,7 +944,7 @@ namespace } HRESULT - DefaultManagedCallback4::DataBreakpoint(ICorDebugProcess* pProcess, ICorDebugThread* pThread, BYTE* pContext, ULONG32 contextSize) + DefaultManagedCallback4::DataBreakpoint(ICorDebugProcess* pProcess, ICorDebugThread* pThread) { // // Just ignore and continue the process. diff --git a/src/coreclr/src/debug/di/shimcallback.cpp b/src/coreclr/src/debug/di/shimcallback.cpp index 84ee345..1af6e04 100644 --- a/src/coreclr/src/debug/di/shimcallback.cpp +++ b/src/coreclr/src/debug/di/shimcallback.cpp @@ -1384,7 +1384,7 @@ HRESULT ShimProxyCallback::AfterGarbageCollection(ICorDebugProcess* pProcess) // input: // pProcess - process in which the notification occurred // Return value: S_OK -HRESULT ShimProxyCallback::DataBreakpoint(ICorDebugProcess* pProcess, ICorDebugThread* pThread, BYTE* pContext, ULONG32 contextSize) +HRESULT ShimProxyCallback::DataBreakpoint(ICorDebugProcess* pProcess, ICorDebugThread* pThread) { m_pShim->PreDispatchEvent(); class DataBreakpointEvent : public ManagedEvent @@ -1392,27 +1392,23 @@ HRESULT ShimProxyCallback::DataBreakpoint(ICorDebugProcess* pProcess, ICorDebugT // callbacks parameters. These are strong references RSExtSmartPtr m_pProcess; RSExtSmartPtr m_pThread; - BYTE* m_pContext; - ULONG32 m_contextSize; public: // Ctor - DataBreakpointEvent(ICorDebugProcess* pProcess, ICorDebugThread* pThread, BYTE* pContext, ULONG32 contextSize) : + DataBreakpointEvent(ICorDebugProcess* pProcess, ICorDebugThread* pThread) : ManagedEvent() { this->m_pProcess.Assign(pProcess); this->m_pThread.Assign(pThread); - this->m_pContext = pContext; - this->m_contextSize = contextSize; } HRESULT Dispatch(DispatchArgs args) { - return args.GetCallback4()->DataBreakpoint(m_pProcess, m_pThread, m_pContext, m_contextSize); + return args.GetCallback4()->DataBreakpoint(m_pProcess, m_pThread); } }; // end class AfterGarbageCollectionEvent - m_pShim->GetManagedEventQueue()->QueueEvent(new DataBreakpointEvent(pProcess, pThread, pContext, contextSize)); + m_pShim->GetManagedEventQueue()->QueueEvent(new DataBreakpointEvent(pProcess, pThread)); return S_OK; } diff --git a/src/coreclr/src/debug/di/shimpriv.h b/src/coreclr/src/debug/di/shimpriv.h index 4c9eb7a..97cbeb7 100644 --- a/src/coreclr/src/debug/di/shimpriv.h +++ b/src/coreclr/src/debug/di/shimpriv.h @@ -222,7 +222,7 @@ public: COM_METHOD ShimProxyCallback::AfterGarbageCollection(ICorDebugProcess* pProcess); // Implementation of ICorDebugManagedCallback4::DataBreakpoint - COM_METHOD ShimProxyCallback::DataBreakpoint(ICorDebugProcess* pProcess, ICorDebugThread* pThread, BYTE* pContext, ULONG32 contextSize); + COM_METHOD ShimProxyCallback::DataBreakpoint(ICorDebugProcess* pProcess, ICorDebugThread* pThread); }; diff --git a/src/coreclr/src/debug/ee/controller.h b/src/coreclr/src/debug/ee/controller.h index 7643b36..1e002bc 100644 --- a/src/coreclr/src/debug/ee/controller.h +++ b/src/coreclr/src/debug/ee/controller.h @@ -1793,6 +1793,20 @@ public: Thread *thread, TRIGGER_WHY tyWhy) { +#ifdef FEATURE_PAL + #error Not supported +#endif // FEATURE_PAL +#if defined(_TARGET_X86_) || defined(_TARGET_AMD64_) + CONTEXT *context = g_pEEInterface->GetThreadFilterContext(thread); + context->Dr0 = this->m_context.Dr0; + context->Dr1 = this->m_context.Dr1; + context->Dr2 = this->m_context.Dr2; + context->Dr3 = this->m_context.Dr3; + context->Dr6 = this->m_context.Dr6; + context->Dr7 = this->m_context.Dr7; +#else // defined(_TARGET_X86_) || defined(_TARGET_AMD64_) + #error Not supported +#endif // defined(_TARGET_X86_) || defined(_TARGET_AMD64_) return TPR_TRIGGER; } @@ -1808,7 +1822,9 @@ public: LOG((LF_CORDB, LL_INFO10000, "DDBP::SE: in DebuggerDataBreakpoint's SendEvent\n")); - g_pDebugger->SendDataBreakpoint(thread, &m_context, this); + CONTEXT *context = g_pEEInterface->GetThreadFilterContext(thread); + + g_pDebugger->SendDataBreakpoint(thread, context, this); Delete(); diff --git a/src/coreclr/src/debug/ee/debugger.cpp b/src/coreclr/src/debug/ee/debugger.cpp index c6fb419..8f8b664 100644 --- a/src/coreclr/src/debug/ee/debugger.cpp +++ b/src/coreclr/src/debug/ee/debugger.cpp @@ -6112,7 +6112,6 @@ void Debugger::SendDataBreakpoint(Thread *thread, CONTEXT *context, // Send a breakpoint event to the Right Side DebuggerIPCEvent* ipce = m_pRCThread->GetIPCEventSendBuffer(); - memcpy(&(ipce->DataBreakpointData.context), context, sizeof(CONTEXT)); InitIPCEvent(ipce, DB_IPCE_DATA_BREAKPOINT, thread, diff --git a/src/coreclr/src/debug/inc/dbgipcevents.h b/src/coreclr/src/debug/inc/dbgipcevents.h index e9669f0..279cd8f 100644 --- a/src/coreclr/src/debug/inc/dbgipcevents.h +++ b/src/coreclr/src/debug/inc/dbgipcevents.h @@ -2012,11 +2012,6 @@ struct MSLAYOUT DebuggerIPCEvent struct MSLAYOUT { - CONTEXT context; - } DataBreakpointData; - - struct MSLAYOUT - { LSPTR_STEPPER stepperToken; VMPTR_Thread vmThreadToken; FramePointer frameToken; diff --git a/src/coreclr/src/debug/shared/dbgtransportsession.cpp b/src/coreclr/src/debug/shared/dbgtransportsession.cpp index f526f91..e9d77cb 100644 --- a/src/coreclr/src/debug/shared/dbgtransportsession.cpp +++ b/src/coreclr/src/debug/shared/dbgtransportsession.cpp @@ -2201,11 +2201,9 @@ DWORD DbgTransportSession::GetEventSize(DebuggerIPCEvent *pEvent) case DB_IPCE_ATTACHING: case DB_IPCE_GET_NGEN_COMPILER_FLAGS: case DB_IPCE_DETACH_FROM_PROCESS: - case DB_IPCE_CONTROL_C_EVENT_RESULT: - cbAdditionalSize = 0; - break; + case DB_IPCE_CONTROL_C_EVENT_RESULT: case DB_IPCE_DATA_BREAKPOINT: - cbAdditionalSize = sizeof(pEvent->DataBreakpointData); + cbAdditionalSize = 0; break; case DB_IPCE_BREAKPOINT: diff --git a/src/coreclr/src/inc/cordebug.idl b/src/coreclr/src/inc/cordebug.idl index ce1bf4a..254a7db 100644 --- a/src/coreclr/src/inc/cordebug.idl +++ b/src/coreclr/src/inc/cordebug.idl @@ -1385,15 +1385,13 @@ interface ICorDebugManagedCallback4 : IUnknown // Callback indicating a data breakpoint is hit // // Parameters - // pProcess - the process that hits the data breakpoint - // pThread - the thread that hits the data breakpoint - // pContext - a pointer to the CONTEXT structure - // contextSize - the size of the CONTEXT structure + // pProcess - the process that hits the data breakpoint + // pThread - the thread that hits the data breakpoint // // Returns // S_OK - on success // - HRESULT DataBreakpoint([in] ICorDebugProcess* pProcess, [in] ICorDebugThread* pThread, [in] BYTE* pContext, [in] ULONG32 contextSize); + HRESULT DataBreakpoint([in] ICorDebugProcess* pProcess, [in] ICorDebugThread* pThread); } #pragma warning(disable:28718) /* disable warning 28718 for interface ICorDebugManagedCallback2 */ diff --git a/src/coreclr/src/pal/prebuilt/inc/cordebug.h b/src/coreclr/src/pal/prebuilt/inc/cordebug.h index a974257..1b53577 100644 --- a/src/coreclr/src/pal/prebuilt/inc/cordebug.h +++ b/src/coreclr/src/pal/prebuilt/inc/cordebug.h @@ -3788,9 +3788,7 @@ EXTERN_C const IID IID_ICorDebugManagedCallback4; virtual HRESULT STDMETHODCALLTYPE DataBreakpoint( /* [in] */ ICorDebugProcess *pProcess, - /* [in] */ ICorDebugThread *pThread, - /* [in] */ BYTE *pContext, - /* [in] */ ULONG32 contextSize) = 0; + /* [in] */ ICorDebugThread *pThread) = 0; }; @@ -3824,9 +3822,7 @@ EXTERN_C const IID IID_ICorDebugManagedCallback4; HRESULT ( STDMETHODCALLTYPE *DataBreakpoint )( ICorDebugManagedCallback4 * This, /* [in] */ ICorDebugProcess *pProcess, - /* [in] */ ICorDebugThread *pThread, - /* [in] */ BYTE *pContext, - /* [in] */ ULONG32 contextSize); + /* [in] */ ICorDebugThread *pThread); END_INTERFACE } ICorDebugManagedCallback4Vtbl; @@ -3857,8 +3853,8 @@ EXTERN_C const IID IID_ICorDebugManagedCallback4; #define ICorDebugManagedCallback4_AfterGarbageCollection(This,pProcess) \ ( (This)->lpVtbl -> AfterGarbageCollection(This,pProcess) ) -#define ICorDebugManagedCallback4_DataBreakpoint(This,pProcess,pThread,pContext,contextSize) \ - ( (This)->lpVtbl -> DataBreakpoint(This,pProcess,pThread,pContext,contextSize) ) +#define ICorDebugManagedCallback4_DataBreakpoint(This,pProcess,pThread) \ + ( (This)->lpVtbl -> DataBreakpoint(This,pProcess,pThread) ) #endif /* COBJMACROS */ -- 2.7.4