diff options
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py | 25 | ||||
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py index e1281e63761..c56807af11f 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py @@ -22,6 +22,31 @@ class BreakpointHitCountTestCase(TestBase): self.build() self.do_test_breakpoint_location_hit_count() + def test_breakpoint_one_shot(self): + """Check that one-shot breakpoints trigger only once.""" + self.build() + + exe = self.getBuildArtifact("a.out") + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + + self.runCmd("tb a") + process = target.LaunchSimple( + None, None, self.get_process_working_directory()) + self.assertTrue(process, PROCESS_IS_VALID) + + from lldbsuite.test.lldbutil import get_stopped_thread + thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertTrue( + thread.IsValid(), + "There should be a thread stopped due to breakpoint") + + frame0 = thread.GetFrameAtIndex(0) + self.assertEqual(frame0.GetFunctionName(), "a(int)"); + + process.Continue() + self.assertEqual(process.GetState(), lldb.eStateExited) + def setUp(self): # Call super's setUp(). TestBase.setUp(self) diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index bb8da85390f..cb31a4a33aa 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -543,7 +543,7 @@ void CommandInterpreter::LoadCommandDictionary() { // sure to increase the size of this buffer. char buffer[1024]; int num_printed = - snprintf(buffer, 1024, "%s %s", break_regexes[i][1], "-o"); + snprintf(buffer, 1024, "%s %s", break_regexes[i][1], "-o 1"); lldbassert(num_printed < 1024); UNUSED_IF_ASSERT_DISABLED(num_printed); success = |