summaryrefslogtreecommitdiff
path: root/src/debug/di
diff options
context:
space:
mode:
authorTom McDonald <tommcdon@microsoft.com>2018-05-16 11:31:34 -0700
committerAndrew Au <cshung@gmail.com>2018-11-06 18:34:47 -0800
commit6fff658c9cd28e4c8c893596a34a1910099c4d70 (patch)
tree346c778b0876302975b0f7d9ee56dbff16f7ac4d /src/debug/di
parentc1d7954ec6098e6f0acfde474522483a6767d1d2 (diff)
downloadcoreclr-6fff658c9cd28e4c8c893596a34a1910099c4d70.tar.gz
coreclr-6fff658c9cd28e4c8c893596a34a1910099c4d70.tar.bz2
coreclr-6fff658c9cd28e4c8c893596a34a1910099c4d70.zip
Implement ICorDebugManagedCallback4::DataBreakpoint
Diffstat (limited to 'src/debug/di')
-rw-r--r--src/debug/di/divalue.cpp11
-rw-r--r--src/debug/di/process.cpp157
-rw-r--r--src/debug/di/rsmain.cpp11
-rw-r--r--src/debug/di/rspriv.h2
-rw-r--r--src/debug/di/shimcallback.cpp30
-rw-r--r--src/debug/di/shimpriv.h3
6 files changed, 48 insertions, 166 deletions
diff --git a/src/debug/di/divalue.cpp b/src/debug/di/divalue.cpp
index 0ecb30ce20..e8975ecadd 100644
--- a/src/debug/di/divalue.cpp
+++ b/src/debug/di/divalue.cpp
@@ -377,18 +377,9 @@ ULONG32 CordbValue::GetSizeForType(CordbType * pType, BoxedValue boxing)
HRESULT CordbValue::CreateBreakpoint(ICorDebugValueBreakpoint **ppBreakpoint)
{
- //PUBLIC_API_ENTRY(this);
- //FAIL_IF_NEUTERED(this);
- //ATT_REQUIRE_STOPPED_MAY_FAIL(GetProcess());
VALIDATE_POINTER_TO_OBJECT(ppBreakpoint, ICorDebugValueBreakpoint **);
- //ICorDebugHandleValue** ppHandleValue = nullptr;
- //if (SUCCEEDED(InternalCreateHandle((CorDebugHandleType)3, ppHandleValue)))
- //{
- return GetProcess()->CreateBreakpoint((CORDB_ADDRESS)this->m_id, ppBreakpoint);
- //}
-
- //return E_NOTIMPL;
+ return E_NOTIMPL;
} // CordbValue::CreateBreakpoint
// gets the exact type of a value
diff --git a/src/debug/di/process.cpp b/src/debug/di/process.cpp
index 46429376fd..3b5f5fb347 100644
--- a/src/debug/di/process.cpp
+++ b/src/debug/di/process.cpp
@@ -2559,143 +2559,6 @@ COM_METHOD CordbProcess::GetContainerObject(CORDB_ADDRESS interiorPointer, ICorD
return hr;
}
-COM_METHOD CordbProcess::CreateBreakpoint(CORDB_ADDRESS address, ICorDebugValueBreakpoint **ppBreakpoint)
-{
- HRESULT hr = S_OK;
- PUBLIC_API_ENTRY(this);
- FAIL_IF_NEUTERED(this);
- ATT_REQUIRE_STOPPED_MAY_FAIL(this);
-
- RSLockHolder lockHolder(GetProcessLock());
- HASHFIND hashFind;
- CordbThread * pThread;
-
- for (pThread = m_userThreads.FindFirst(&hashFind);
- pThread != NULL;
- pThread = m_userThreads.FindNext(&hashFind))
- {
- HRESULT hr = S_OK;
- HANDLE hTemp;
- EX_TRY
- {
- pThread->InternalGetHandle(&hTemp); // throws on error
- }
- EX_CATCH_HRESULT(hr);
-
- DWORD dwDesiredAccess = THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION | THREAD_SET_CONTEXT | THREAD_SET_INFORMATION | THREAD_SUSPEND_RESUME | THREAD_TERMINATE;
-
- HANDLE hThread;
- hr = ::DuplicateHandle(GetCurrentProcess(), hTemp, GetCurrentProcess(), &hThread, dwDesiredAccess, FALSE, 0);
-
- if (SUCCEEDED(hr))
- {
- DWORD dwSuspendCount = ::SuspendThread(hThread);
-
- CONTEXT context;
- context.ContextFlags = CONTEXT_CONTROL | CONTEXT_DEBUG_REGISTERS;
-
- BOOL result = ::GetThreadContext(hThread, &context);
-
- if (result == TRUE)
- {
-#ifdef DBG_TARGET_X86
- if (m_dataBreakpoints.GetCount() == 0)
- {
- context.Dr0 = (uint32_t)address;
- PDR7 pdr7 = (PDR7)&(context.Dr7);
- pdr7->Len0 = 2;
- pdr7->Rwe0 = 0x01;
- pdr7->L0 = 0x01;
- }
- else if (m_dataBreakpoints.GetCount() == 1)
- {
- context.Dr1 = (uint32_t)address;
- PDR7 pdr7 = (PDR7)&(context.Dr7);
- pdr7->Len1 = 2;
- pdr7->Rwe1 = 0x01;
- pdr7->L1 = 0x01;
- }
- else if (m_dataBreakpoints.GetCount() == 2)
- {
- context.Dr2 = (uint32_t)address;
- PDR7 pdr7 = (PDR7)&(context.Dr7);
- pdr7->Len2 = 2;
- pdr7->Rwe2 = 0x01;
- pdr7->L2 = 0x01;
- }
- else if (m_dataBreakpoints.GetCount() == 3)
- {
- context.Dr3 = (uint32_t)address;
- PDR7 pdr7 = (PDR7)&(context.Dr7);
- pdr7->Len3 = 2;
- pdr7->Rwe3 = 0x01;
- pdr7->L3 = 0x01;
- }
- else
- {
- return E_FAIL;
- }
-#endif
-#ifdef DBG_TARGET_AMD64
- if (m_dataBreakpoints.GetCount() == 0)
- {
- context.Dr0 = address;
- PDR7 pdr7 = (PDR7)&(context.Dr7);
- pdr7->Len0 = 2;
- pdr7->Rwe0 = 0x01;
- pdr7->L0 = 0x01;
- }
- else if (m_dataBreakpoints.GetCount() == 1)
- {
- context.Dr1 = address;
- PDR7 pdr7 = (PDR7)&(context.Dr7);
- pdr7->Len1 = 2;
- pdr7->Rwe1 = 0x01;
- pdr7->L1 = 0x01;
- }
- else if (m_dataBreakpoints.GetCount() == 2)
- {
- context.Dr2 = address;
- PDR7 pdr7 = (PDR7)&(context.Dr7);
- pdr7->Len2 = 2;
- pdr7->Rwe2 = 0x01;
- pdr7->L2 = 0x01;
- }
- else if (m_dataBreakpoints.GetCount() == 3)
- {
- context.Dr3 = address;
- PDR7 pdr7 = (PDR7)&(context.Dr7);
- pdr7->Len3 = 2;
- pdr7->Rwe3 = 0x01;
- pdr7->L3 = 0x01;
- }
- else
- {
- return E_FAIL;
- }
-#endif
- }
- result = ::SetThreadContext(hThread, &context);
- ::ResumeThread(hThread);
- }
- }
-
- EX_TRY
- {
- RSInitHolder<CordbValueBreakpoint> pValueBreakpoint(new CordbValueBreakpoint(m_dataBreakpoints.GetCount(), nullptr, this));
-
- if (pValueBreakpoint)
- {
- hr = pValueBreakpoint->QueryInterface(IID_ICorDebugValueBreakpoint, (void**)ppBreakpoint);
- }
-
- pValueBreakpoint.TransferOwnershipToHash(&m_dataBreakpoints);
- }
- EX_CATCH_HRESULT(hr);
-
- return hr;
-}
-
#ifdef FEATURE_LEGACYNETCF_DBG_HOST_CONTROL
COM_METHOD CordbProcess::InvokePauseCallback()
@@ -5067,23 +4930,9 @@ void CordbProcess::RawDispatchEvent(
case DB_IPCE_DATA_BREAKPOINT:
{
- _ASSERTE(pThread != NULL);
- _ASSERTE(pAppDomain != NULL);
-
- HASHFIND hashFind;
- CordbValueBreakpoint* pBreakpoint;
-
- for (pBreakpoint = m_dataBreakpoints.FindFirst(&hashFind);
- pBreakpoint != NULL;
- pBreakpoint = m_dataBreakpoints.FindNext(&hashFind))
- {
- if (pBreakpoint->GetIndex() == pEvent->DataBreakpointData.index)
- {
- PUBLIC_CALLBACK_IN_THIS_SCOPE2(this, pLockHolder, pEvent, "thread=0x%p, bp=0x%p", pThread, pBreakpoint);
- pCallback1->Breakpoint(pAppDomain, pThread, CordbBreakpointToInterface(pBreakpoint));
- break;
- }
- }
+ PUBLIC_CALLBACK_IN_THIS_SCOPE(this, pLockHolder, pEvent);
+ pCallback4->DataBreakpoint(static_cast<ICorDebugProcess*>(this));
+ break;
}
break;
case DB_IPCE_USER_BREAKPOINT:
diff --git a/src/debug/di/rsmain.cpp b/src/debug/di/rsmain.cpp
index 42cf8f8f9b..254a2b759e 100644
--- a/src/debug/di/rsmain.cpp
+++ b/src/debug/di/rsmain.cpp
@@ -870,6 +870,7 @@ namespace
virtual ULONG STDMETHODCALLTYPE Release();
COM_METHOD BeforeGarbageCollection(ICorDebugProcess* pProcess);
COM_METHOD AfterGarbageCollection(ICorDebugProcess* pProcess);
+ COM_METHOD DataBreakpoint(ICorDebugProcess* pProcess);
private:
// not implemented
DefaultManagedCallback4(const DefaultManagedCallback4&);
@@ -941,6 +942,16 @@ namespace
pProcess->Continue(false);
return S_OK;
}
+
+ HRESULT
+ DefaultManagedCallback4::DataBreakpoint(ICorDebugProcess* pProcess)
+ {
+ //
+ // Just ignore and continue the process.
+ //
+ pProcess->Continue(false);
+ return S_OK;
+ }
}
/* ------------------------------------------------------------------------- *
diff --git a/src/debug/di/rspriv.h b/src/debug/di/rspriv.h
index d5a8e606d9..1e01c5cde4 100644
--- a/src/debug/di/rspriv.h
+++ b/src/debug/di/rspriv.h
@@ -3167,8 +3167,6 @@ public:
//-----------------------------------------------------------
COM_METHOD GetContainerObject(CORDB_ADDRESS interiorPointer, ICorDebugObjectValue** ppContainerObject);
- COM_METHOD CreateBreakpoint(CORDB_ADDRESS address, ICorDebugValueBreakpoint **ppBreakpoint);
-
#ifdef FEATURE_LEGACYNETCF_DBG_HOST_CONTROL
// ---------------------------------------------------------------
// ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly
diff --git a/src/debug/di/shimcallback.cpp b/src/debug/di/shimcallback.cpp
index 05fea352e3..078643f26d 100644
--- a/src/debug/di/shimcallback.cpp
+++ b/src/debug/di/shimcallback.cpp
@@ -1379,6 +1379,36 @@ HRESULT ShimProxyCallback::AfterGarbageCollection(ICorDebugProcess* pProcess)
return S_OK;
}
+// Implementation of ICorDebugManagedCallback4::DataBreakpoint
+// Arguments:
+// input:
+// pProcess - process in which the notification occurred
+// Return value: S_OK
+HRESULT ShimProxyCallback::DataBreakpoint(ICorDebugProcess* pProcess)
+{
+ m_pShim->PreDispatchEvent();
+ class DataBreakpointEvent : public ManagedEvent
+ {
+ // callbacks parameters. These are strong references
+ RSExtSmartPtr<ICorDebugProcess > m_pProcess;
+
+ public:
+ // Ctor
+ DataBreakpointEvent(ICorDebugProcess* pProcess) :
+ ManagedEvent()
+ {
+ this->m_pProcess.Assign(pProcess);
+ }
+
+ HRESULT Dispatch(DispatchArgs args)
+ {
+ return args.GetCallback4()->DataBreakpoint(m_pProcess);
+ }
+ }; // end class AfterGarbageCollectionEvent
+
+ m_pShim->GetManagedEventQueue()->QueueEvent(new DataBreakpointEvent(pProcess));
+ return S_OK;
+}
diff --git a/src/debug/di/shimpriv.h b/src/debug/di/shimpriv.h
index c936b9890f..503ee3ef3d 100644
--- a/src/debug/di/shimpriv.h
+++ b/src/debug/di/shimpriv.h
@@ -220,6 +220,9 @@ public:
// Implementation of ICorDebugManagedCallback4::AfterGarbageCollection
COM_METHOD ShimProxyCallback::AfterGarbageCollection(ICorDebugProcess* pProcess);
+
+ // Implementation of ICorDebugManagedCallback4::DataBreakpoint
+ COM_METHOD ShimProxyCallback::DataBreakpoint(ICorDebugProcess* pProcess);
};