Fix breakpoint removal
authorIgor Kulaychuk <i.kulaychuk@samsung.com>
Wed, 25 Apr 2018 21:28:39 +0000 (00:28 +0300)
committerIgor Kulaychuk <i.kulaychuk@samsung.com>
Thu, 26 Apr 2018 13:22:08 +0000 (16:22 +0300)
src/debug/netcoredbg/manageddebugger.cpp
src/debug/netcoredbg/miprotocol.cpp

index 2a844580f215feab7ea5a0cec955b98fb1e112ca..ad803a33bc04c6323a9915ec2a033bf09b8d7646 100644 (file)
@@ -922,8 +922,6 @@ HRESULT ManagedDebugger::Startup(IUnknown *punk, DWORD pid)
 {
     HRESULT Status;
 
-    Cleanup();
-
     ToRelease<ICorDebug> pCorDebug;
     IfFailRet(punk->QueryInterface(IID_ICorDebug, (void **)&pCorDebug));
 
index 9477fddd2a75cb1369b38d9e14706c5a4625decb..a7601aefb9e35d66bde5b1b178b2b4a39bc443bc 100644 (file)
@@ -399,10 +399,17 @@ HRESULT MIProtocol::SetBreakpoint(const std::string &filename, int linenum, Brea
     std::vector<Breakpoint> breakpoints;
     IfFailRet(m_debugger->SetBreakpoints(filename, lines, breakpoints));
 
-    breakpoint = breakpoints.back();
-    breakpointsInSource.insert(std::make_pair(breakpoint.id, linenum));
+    for (const Breakpoint& b : breakpoints)
+    {
+        if (b.line != linenum)
+            continue;
 
-    return S_OK;
+        breakpointsInSource.insert(std::make_pair(b.id, b.line));
+        breakpoint = b;
+        return S_OK;
+    }
+
+    return E_FAIL;
 }
 
 void MIProtocol::DeleteBreakpoints(const std::unordered_set<uint32_t> &ids)