From ee1c882a270e080b7afbf663d463743fe9aa0248 Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Thu, 26 Apr 2018 00:28:39 +0300 Subject: [PATCH] Fix breakpoint removal --- src/debug/netcoredbg/manageddebugger.cpp | 2 -- src/debug/netcoredbg/miprotocol.cpp | 13 ++++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/debug/netcoredbg/manageddebugger.cpp b/src/debug/netcoredbg/manageddebugger.cpp index 2a84458..ad803a3 100644 --- a/src/debug/netcoredbg/manageddebugger.cpp +++ b/src/debug/netcoredbg/manageddebugger.cpp @@ -922,8 +922,6 @@ HRESULT ManagedDebugger::Startup(IUnknown *punk, DWORD pid) { HRESULT Status; - Cleanup(); - ToRelease pCorDebug; IfFailRet(punk->QueryInterface(IID_ICorDebug, (void **)&pCorDebug)); diff --git a/src/debug/netcoredbg/miprotocol.cpp b/src/debug/netcoredbg/miprotocol.cpp index 9477fdd..a7601ae 100644 --- a/src/debug/netcoredbg/miprotocol.cpp +++ b/src/debug/netcoredbg/miprotocol.cpp @@ -399,10 +399,17 @@ HRESULT MIProtocol::SetBreakpoint(const std::string &filename, int linenum, Brea std::vector 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 &ids) -- 2.34.1