Author: eugene Date: Mon Apr 16 15:26:21 2018 New Revision: 330163 URL: http://llvm.org/viewvc/llvm-project?rev=330163&view=rev Log: Make sure deleting all breakpoints clears their sites first
Bug: https://bugs.llvm.org/show_bug.cgi?id=36430 Differential Revision: https://reviews.llvm.org/D45554 Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c lldb/trunk/source/Breakpoint/BreakpointList.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py?rev=330163&r1=330162&r2=330163&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py Mon Apr 16 15:26:21 2018 @@ -45,6 +45,25 @@ class BreakpointCommandTestCase(TestBase self.addTearDownHook( lambda: self.runCmd("settings clear auto-confirm")) + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528") + def test_delete_all_breakpoints(self): + """Test that deleting all breakpoints works.""" + self.build() + exe = self.getBuildArtifact("a.out") + self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + + lldbutil.run_break_set_by_symbol(self, "main") + lldbutil.run_break_set_by_file_and_line( + self, "main.c", self.line, num_expected_locations=1, loc_exact=True) + + self.runCmd("run", RUN_SUCCEEDED) + + self.runCmd("breakpoint delete") + self.runCmd("process continue") + self.expect("process status", PROCESS_STOPPED, + patterns=['Process .* exited with status = 0']) + + def breakpoint_command_sequence(self): """Test a sequence of breakpoint command add, list, and delete.""" exe = self.getBuildArtifact("a.out") Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c?rev=330163&r1=330162&r2=330163&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c Mon Apr 16 15:26:21 2018 @@ -9,5 +9,9 @@ int main (int argc, char const *argv[]) { + // Add a body to the function, so we can set more than one + // breakpoint in it. + static volatile int var = 0; + var++; return 0; // Set break point at this line. } Modified: lldb/trunk/source/Breakpoint/BreakpointList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointList.cpp?rev=330163&r1=330162&r2=330163&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointList.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointList.cpp Mon Apr 16 15:26:21 2018 @@ -99,7 +99,7 @@ void BreakpointList::RemoveAll(bool noti void BreakpointList::RemoveAllowed(bool notify) { std::lock_guard<std::recursive_mutex> guard(m_mutex); - + bp_collection::iterator pos, end = m_breakpoints.end(); if (notify) { for (pos = m_breakpoints.begin(); pos != end; ++pos) { @@ -116,10 +116,12 @@ void BreakpointList::RemoveAllowed(bool } pos = m_breakpoints.begin(); while ( pos != end) { - if((*pos)->AllowDelete()) - pos = m_breakpoints.erase(pos); - else - pos++; + auto bp = *pos; + if (bp->AllowDelete()) { + bp->ClearAllBreakpointSites(); + pos = m_breakpoints.erase(pos); + } else + pos++; } } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits