33 lines · python
1"""2Test setting a breakpoint by file and line when many instances of the3same file name exist in the CU list.4"""5 6 7import lldb8from lldbsuite.test.decorators import *9from lldbsuite.test.lldbtest import *10from lldbsuite.test import lldbutil11 12 13class TestBreakpointSameCU(TestBase):14 def test_breakpoint_same_cu(self):15 self.build()16 target = self.createTestTarget()17 18 # Break both on the line before the code:19 comment_line = line_number("common.cpp", "// A comment here")20 self.assertNotEqual(comment_line, 0, "line_number worked")21 bkpt = target.BreakpointCreateByLocation("common.cpp", comment_line)22 self.assertEqual(23 bkpt.GetNumLocations(), 4, "Got the right number of breakpoints"24 )25 26 # And break on the code, both should work:27 code_line = line_number("common.cpp", "// The line with code")28 self.assertNotEqual(comment_line, 0, "line_number worked again")29 bkpt = target.BreakpointCreateByLocation("common.cpp", code_line)30 self.assertEqual(31 bkpt.GetNumLocations(), 4, "Got the right number of breakpoints"32 )33