Fix GDB/MI "exec-interrupt" command behavior.
authorMikhail Kurinnoi <m.kurinnoi@samsung.com>
Mon, 15 Apr 2019 14:48:03 +0000 (17:48 +0300)
committerMikhail Kurinnoi <m.kurinnoi@samsung.com>
Tue, 16 Apr 2019 07:31:10 +0000 (10:31 +0300)
src/debug/netcoredbg/manageddebugger.cpp

index 8b9fd85c0efd6576b0c926b56e2fce6bd4d5cfb1..1136301b8f864503b564735cd44474d678c0e67d 100644 (file)
@@ -1006,7 +1006,18 @@ HRESULT ManagedDebugger::Pause()
 
     if (!m_pProcess)
         return E_FAIL;
-    HRESULT Status = m_pProcess->Stop(0);
+
+    // The debugger maintains a stop counter. When the counter goes to zero, the controller is resumed.
+    // Each call to Stop or each dispatched callback increments the counter.
+    // Each call to ICorDebugController::Continue decrements the counter.
+    BOOL running = FALSE;
+    HRESULT Status = m_pProcess->IsRunning(&running);
+    if (Status != S_OK)
+        return Status;
+    if (!running)
+        return S_OK;
+    
+    Status = m_pProcess->Stop(0);
     if (Status != S_OK)
         return Status;