summaryrefslogtreecommitdiff
path: root/src/debug/di
diff options
context:
space:
mode:
authorAndrew Au <andrewau@microsoft.com>2018-06-27 11:15:04 -0700
committerAndrew Au <cshung@gmail.com>2018-11-06 18:34:47 -0800
commit59acd546c2d326e8a4ec11f078a1f0edde4dabaa (patch)
tree90183ad8d5bcd951b827e7d87bd163d80fa73e88 /src/debug/di
parentf72bba95b01c790f92641b9d7d96bf23a014dd3e (diff)
downloadcoreclr-59acd546c2d326e8a4ec11f078a1f0edde4dabaa.tar.gz
coreclr-59acd546c2d326e8a4ec11f078a1f0edde4dabaa.tar.bz2
coreclr-59acd546c2d326e8a4ec11f078a1f0edde4dabaa.zip
Get/Set the ThreadContext natively if the debuggee is block on garbage collection events
Diffstat (limited to 'src/debug/di')
-rw-r--r--src/debug/di/process.cpp29
-rw-r--r--src/debug/di/rspriv.h4
2 files changed, 27 insertions, 6 deletions
diff --git a/src/debug/di/process.cpp b/src/debug/di/process.cpp
index 64446cdf9b..718fff25e9 100644
--- a/src/debug/di/process.cpp
+++ b/src/debug/di/process.cpp
@@ -984,7 +984,8 @@ CordbProcess::CordbProcess(ULONG64 clrInstanceId,
m_pEventChannel(NULL),
m_fAssertOnTargetInconsistency(false),
m_runtimeOffsetsInitialized(false),
- m_writableMetadataUpdateMode(LegacyCompatPolicy)
+ m_writableMetadataUpdateMode(LegacyCompatPolicy),
+ m_isBlockedOnGarbageCollectionEvent(false)
{
_ASSERTE((m_id == 0) == (pShim == NULL));
@@ -3644,6 +3645,8 @@ HRESULT CordbProcess::Continue(BOOL fIsOutOfBand)
{
PUBLIC_API_ENTRY(this);
+ this->m_isBlockedOnGarbageCollectionEvent = false;
+
if (m_pShim == NULL) // This API is moved off to the shim
{
// bias towards failing with CORDBG_E_NUETERED.
@@ -4911,6 +4914,7 @@ void CordbProcess::RawDispatchEvent(
case DB_IPCE_BEFORE_GARBAGE_COLLECTION:
{
{
+ this->m_isBlockedOnGarbageCollectionEvent = true;
PUBLIC_CALLBACK_IN_THIS_SCOPE(this, pLockHolder, pEvent);
pCallback4->BeforeGarbageCollection(static_cast<ICorDebugProcess*>(this));
}
@@ -4920,6 +4924,7 @@ void CordbProcess::RawDispatchEvent(
case DB_IPCE_AFTER_GARBAGE_COLLECTION:
{
{
+ this->m_isBlockedOnGarbageCollectionEvent = true;
PUBLIC_CALLBACK_IN_THIS_SCOPE(this, pLockHolder, pEvent);
pCallback4->AfterGarbageCollection(static_cast<ICorDebugProcess*>(this));
}
@@ -6501,9 +6506,16 @@ HRESULT CordbProcess::GetThreadContext(DWORD threadID, ULONG32 contextSize, BYTE
}
else
{
- DT_CONTEXT* managedContext;
- hr = thread->GetManagedContext(&managedContext);
- *pContext = *managedContext;
+ if (this->m_isBlockedOnGarbageCollectionEvent)
+ {
+ hr = this->GetDataTarget()->GetThreadContext(threadID, CONTEXT_FULL, contextSize, context);
+ }
+ else
+ {
+ DT_CONTEXT* managedContext;
+ hr = thread->GetManagedContext(&managedContext);
+ *pContext = *managedContext;
+ }
}
}
EX_CATCH
@@ -6591,7 +6603,14 @@ HRESULT CordbProcess::SetThreadContext(DWORD threadID, ULONG32 contextSize, BYTE
hr = E_INVALIDARG;
}
- hr = thread->SetManagedContext(pContext);
+ if (this->m_isBlockedOnGarbageCollectionEvent)
+ {
+ hr = this->m_pMutableDataTarget->SetThreadContext(threadID, contextSize, context);
+ }
+ else
+ {
+ hr = thread->SetManagedContext(pContext);
+ }
}
EX_CATCH
{
diff --git a/src/debug/di/rspriv.h b/src/debug/di/rspriv.h
index a9f5893363..d3de6650fb 100644
--- a/src/debug/di/rspriv.h
+++ b/src/debug/di/rspriv.h
@@ -3749,7 +3749,6 @@ public:
// This is also used in fake-native debugging scenarios.
bool m_loaderBPReceived;
-
private:
// MetaData dispenser.
@@ -4114,6 +4113,9 @@ private:
// controls how metadata updated in the target is handled
WriteableMetadataUpdateMode m_writableMetadataUpdateMode;
+
+ // TODO: Comments
+ bool m_isBlockedOnGarbageCollectionEvent;
};
// Some IMDArocess APIs are supported as interop-only.