}
bool BreakpointLocation::IgnoreCountShouldStop() {
- if (m_options_up != nullptr) {
- uint32_t loc_ignore = m_options_up->GetIgnoreCount();
- if (loc_ignore != 0) {
- m_owner.DecrementIgnoreCount();
- DecrementIgnoreCount(); // Have to decrement our owners' ignore count,
- // since it won't get a
- // chance to.
- return false;
- }
+ uint32_t owner_ignore = GetBreakpoint().GetIgnoreCount();
+ uint32_t loc_ignore = 0;
+ if (m_options_up != nullptr)
+ loc_ignore = m_options_up->GetIgnoreCount();
+
+ if (loc_ignore != 0 || owner_ignore != 0) {
+ m_owner.DecrementIgnoreCount();
+ DecrementIgnoreCount(); // Have to decrement our owners' ignore count,
+ // since it won't get a chance to.
+ return false;
}
return true;
}
if (!IsEnabled())
return false;
- if (!IgnoreCountShouldStop())
- return false;
-
- if (!m_owner.IgnoreCountShouldStop())
- return false;
-
// We only run synchronous callbacks in ShouldStop:
context->is_synchronous = true;
should_stop = InvokeCallback(context);
self.build()
self.breakpoint_ignore_count_python()
+ @skipIfWindows # This test will hang on windows llvm.org/pr21753
+ def test_ignore_vrs_condition_bkpt(self):
+ self.build()
+ self.ignore_vrs_condition(False)
+
+ @skipIfWindows # This test will hang on windows llvm.org/pr21753
+ def test_ignore_vrs_condition_loc(self):
+ self.build()
+ self.ignore_vrs_condition(True)
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to of function 'c'.
+ self.stop_in_main = "Stop here at start of main"
self.line1 = line_number(
'main.c', '// Find the line number of function "c" here.')
self.line2 = line_number(
def breakpoint_ignore_count_python(self):
"""Use Python APIs to set breakpoint ignore count."""
- target = self.createTestTarget()
-
+ target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(self,
+ self.stop_in_main,
+ lldb.SBFileSpec("main.c"))
# Now create a breakpoint on main.c by name 'c'.
breakpoint = target.BreakpointCreateByName('c', 'a.out')
self.assertTrue(breakpoint and
self.assertEqual(location.GetIgnoreCount(), 2,
"SetIgnoreCount() works correctly")
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple(
- None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
+ # Now continue and hit our breakpoint on c:
+ process.Continue()
# Frame#0 should be on main.c:37, frame#1 should be on main.c:25, and
# frame#2 should be on main.c:48.
# The hit count for the breakpoint should be 3.
self.assertEqual(breakpoint.GetHitCount(), 3)
- process.Continue()
+ def ignore_vrs_condition(self, use_location):
+ main_spec = lldb.SBFileSpec("main.c")
+ target, process, _ , _ = lldbutil.run_to_source_breakpoint(self,
+ self.stop_in_main,
+ main_spec)
+
+ # Now make a breakpoint on the loop, and set a condition and ignore count.
+ # Make sure that the condition fails don't count against the ignore count.
+ bkpt = target.BreakpointCreateBySourceRegex("Set a breakpoint here, with i", main_spec)
+ self.assertEqual(bkpt.GetNumLocations(), 1, "Wrong number of locations")
+
+ if use_location:
+ loc = bkpt.location[0]
+ self.assertTrue(loc.IsValid(), "Got a valid location")
+ loc.SetIgnoreCount(2)
+ loc.SetCondition("i >= 3")
+ else:
+ bkpt.SetIgnoreCount(2)
+ bkpt.SetCondition("i >= 3")
+
+ threads = lldbutil.continue_to_breakpoint(process, bkpt)
+ self.assertEqual(len(threads), 1, "Hit the breakpoint")
+ var = threads[0].frame[0].FindVariable("i")
+ self.assertTrue(var.IsValid(), "Didn't find the i variable")
+ val = var.GetValueAsUnsigned(10000)
+ self.assertNotEqual(val, 10000, "Got the fail value for i")
+ self.assertEqual(val, 5, "We didn't stop the right number of times")
+ self.assertEqual(bkpt.GetHitCount(), 3, "Hit count is not right")