Drop support for IID_ICorDebugProcess10 and fix thread suspend logic (#44549)
authorSteve MacLean <Steve.MacLean@microsoft.com>
Wed, 11 Nov 2020 23:24:33 +0000 (18:24 -0500)
committerGitHub <noreply@github.com>
Wed, 11 Nov 2020 23:24:33 +0000 (18:24 -0500)
* Stop providing IID_ICorDebugProcess10

Prevent older VS versions from setting managed data breakpoints.

* Simplify the thread collision logic to prevent deadlock

This is a simplification of https://github.com/dotnet/runtime/pull/44539
as proposed by @kouvel

src/coreclr/src/debug/di/process.cpp
src/coreclr/src/debug/di/rspriv.h
src/coreclr/src/vm/threadsuspend.cpp

index bb09213..badcd86 100644 (file)
@@ -2169,10 +2169,6 @@ HRESULT CordbProcess::QueryInterface(REFIID id, void **pInterface)
     {
         *pInterface = static_cast<ICorDebugProcess8*>(this);
     }
-    else if (id == IID_ICorDebugProcess10)
-    {
-        *pInterface = static_cast<ICorDebugProcess10*>(this);
-    }
     else if (id == IID_ICorDebugProcess11)
     {
         *pInterface = static_cast<ICorDebugProcess11*>(this);
index a42a37d..0874716 100644 (file)
@@ -2929,7 +2929,6 @@ class CordbProcess :
     public ICorDebugProcess5,
     public ICorDebugProcess7,
     public ICorDebugProcess8,
-    public ICorDebugProcess10,
     public ICorDebugProcess11,
     public IDacDbiInterface::IAllocator,
     public IDacDbiInterface::IMetaDataLookup,
@@ -3140,7 +3139,7 @@ public:
     COM_METHOD EnableExceptionCallbacksOutsideOfMyCode(BOOL enableExceptionsOutsideOfJMC);
 
     //-----------------------------------------------------------
-    // ICorDebugProcess10
+    // ICorDebugProcess10 (To be removed in .NET 6, in a separate cleanup PR)
     //-----------------------------------------------------------
     COM_METHOD EnableGCNotificationEvents(BOOL fEnable);
 
index 1b7ef67..89824f3 100644 (file)
@@ -5943,16 +5943,7 @@ retry_for_debugger:
             // that there is a thread which appears to be stopped at a gc
             // safe point, but which really is not. If that is the case,
             // back off and try again.
-            //
-            // When the debugger is synchronizing, trying to perform a GC could deadlock. The GC has the
-            // threadstore lock and synchronization cannot complete until the debugger can get the
-            // threadstore lock. However the GC can not complete until it sends the BeforeGarbageCollection
-            // event, and the event can not be sent until the debugger is synchronized. In order to break
-            // this deadlock cycle the GC must give up the threadstore lock, allow the debugger to synchronize,
-            // then try again.
-            // 
-            || (CORDebuggerAttached() &&
-                (g_pDebugInterface->ThreadsAtUnsafePlaces() || g_pDebugInterface->IsSynchronizing()))
+            || (CORDebuggerAttached() && g_pDebugInterface->ThreadsAtUnsafePlaces())
 #endif // DEBUGGING_SUPPORTED
             )
         {