From: Mikhail Kurinnoi Date: Wed, 10 Apr 2019 15:00:34 +0000 (+0300) Subject: Fix delete function breakpoints issue. X-Git-Tag: submit/tizen/20190813.035844~10^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e558826cea05db249619bbd2fe1c7b6b9d3928e4;p=sdk%2Ftools%2Fnetcoredbg.git Fix delete function breakpoints issue. --- diff --git a/src/debug/netcoredbg/breakpoints.cpp b/src/debug/netcoredbg/breakpoints.cpp index e49dd93..b329498 100644 --- a/src/debug/netcoredbg/breakpoints.cpp +++ b/src/debug/netcoredbg/breakpoints.cpp @@ -516,21 +516,18 @@ HRESULT Breakpoints::SetBreakpoints( auto &breakpointsInSource = m_breakpoints[filename]; // Remove old breakpoints - std::unordered_set unchangedLines; + std::unordered_set funcBreakpointLines; for (const auto &sb : srcBreakpoints) { - int line = sb.line; - if (breakpointsInSource.find(line) != breakpointsInSource.end()) - unchangedLines.insert(line); + funcBreakpointLines.insert(sb.line); + } + for (auto it = breakpointsInSource.begin(); it != breakpointsInSource.end();) + { + if (funcBreakpointLines.find(it->first) == funcBreakpointLines.end()) + it = breakpointsInSource.erase(it); + else + ++it; } - - std::unordered_set removedLines; - for (auto &b : breakpointsInSource) - if (unchangedLines.find(b.first) == unchangedLines.end()) - removedLines.insert(b.first); - - for (int line : removedLines) - breakpointsInSource.erase(line); // Export breakpoints @@ -643,11 +640,24 @@ HRESULT Breakpoints::SetFunctionBreakpoints( { std::lock_guard lock(m_breakpointsMutex); - // Clean all previous function breakpoints - for (auto &fb : funcBreakpoints) + // Remove old breakpoints + std::unordered_set funcBreakpointFuncs; + for (const auto &fb : funcBreakpoints) { - if (m_funcBreakpoints.find(fb.func) == m_funcBreakpoints.end()) - m_funcBreakpoints.erase(fb.func); + std::string fullFuncName(""); + if (fb.module != "") + { + fullFuncName = fb.module + "!"; + } + fullFuncName += fb.func + fb.params; + funcBreakpointFuncs.insert(fullFuncName); + } + for (auto it = m_funcBreakpoints.begin(); it != m_funcBreakpoints.end();) + { + if (funcBreakpointFuncs.find(it->first) == funcBreakpointFuncs.end()) + it = m_funcBreakpoints.erase(it); + else + ++it; } if (funcBreakpoints.empty())