diff options
author | Andrew Au <andrewau@microsoft.com> | 2018-08-06 15:04:37 -0700 |
---|---|---|
committer | Andrew Au <cshung@gmail.com> | 2018-11-06 18:34:47 -0800 |
commit | e467645dbefa58e144a42c3b742cee859b68d55d (patch) | |
tree | 444d191807b45be67e0bbf8a4f5dfce74b6f24b3 | |
parent | 44f9453071131406569ea6167baf494b2ab11926 (diff) | |
download | coreclr-e467645dbefa58e144a42c3b742cee859b68d55d.tar.gz coreclr-e467645dbefa58e144a42c3b742cee859b68d55d.tar.bz2 coreclr-e467645dbefa58e144a42c3b742cee859b68d55d.zip |
Fixing the deadlocks
-rw-r--r-- | src/debug/ee/debugger.cpp | 8 | ||||
-rw-r--r-- | src/debug/ee/debugger.h | 2 | ||||
-rw-r--r-- | src/vm/dbginterface.h | 1 | ||||
-rw-r--r-- | src/vm/threadsuspend.cpp | 2 |
4 files changed, 6 insertions, 7 deletions
diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp index b9decbc561..e8134a4882 100644 --- a/src/debug/ee/debugger.cpp +++ b/src/debug/ee/debugger.cpp @@ -6057,9 +6057,7 @@ void Debugger::AfterGarbageCollection() return; { - Debugger::DebuggerLockHolder dbgLockHolder(this); - - this->m_isBlockedOnGarbageCollectionEvent = true; + Debugger::DebuggerLockHolder dbgLockHolder(this); DebuggerIPCEvent* ipce1 = m_pRCThread->GetIPCEventSendBuffer(); InitIPCEvent(ipce1, @@ -6073,6 +6071,7 @@ void Debugger::AfterGarbageCollection() WaitForSingleObject(this->GetGarbageCollectionBlockerEvent(), INFINITE); ResetEvent(this->GetGarbageCollectionBlockerEvent()); + this->m_isBlockedOnGarbageCollectionEvent = false; } void Debugger::SendDataBreakpoint(Thread *thread, CONTEXT *context, @@ -10817,7 +10816,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) _ASSERTE(ThreadHoldsLock()); // Simply trap all Runtime threads if we're not already trying to. - if (!m_trappingRuntimeThreads) + if (!m_isBlockedOnGarbageCollectionEvent && !m_trappingRuntimeThreads) { // If the RS sent an Async-break, then that's an explicit request. m_RSRequestedSync = TRUE; @@ -10831,7 +10830,6 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) { if (this->m_isBlockedOnGarbageCollectionEvent) { - this->m_isBlockedOnGarbageCollectionEvent = false; this->m_stopped = false; SetEvent(this->GetGarbageCollectionBlockerEvent()); } diff --git a/src/debug/ee/debugger.h b/src/debug/ee/debugger.h index 7e0134dedc..a07531b9aa 100644 --- a/src/debug/ee/debugger.h +++ b/src/debug/ee/debugger.h @@ -2218,7 +2218,7 @@ public: unsigned int errorLine, bool exitThread); - BOOL IsSynchronizing(void) + virtual BOOL IsSynchronizing(void) { LIMITED_METHOD_CONTRACT; diff --git a/src/vm/dbginterface.h b/src/vm/dbginterface.h index a855a10357..d0be137153 100644 --- a/src/vm/dbginterface.h +++ b/src/vm/dbginterface.h @@ -412,6 +412,7 @@ public: virtual void BeforeGarbageCollection() = 0; virtual void AfterGarbageCollection() = 0; #endif + virtual BOOL IsSynchronizing() = 0; }; #ifndef DACCESS_COMPILE diff --git a/src/vm/threadsuspend.cpp b/src/vm/threadsuspend.cpp index 822c396455..1902d82ba6 100644 --- a/src/vm/threadsuspend.cpp +++ b/src/vm/threadsuspend.cpp @@ -7108,7 +7108,7 @@ retry_for_debugger: || Thread::ThreadsAtUnsafePlaces() #ifdef DEBUGGING_SUPPORTED // seriously? When would we want to disable debugging support? :) || (CORDebuggerAttached() && - g_pDebugInterface->ThreadsAtUnsafePlaces()) + (g_pDebugInterface->ThreadsAtUnsafePlaces() || g_pDebugInterface->IsSynchronizing())) #endif // DEBUGGING_SUPPORTED ) { |