1""" 2Test lldb breakpoint ids. 3""" 4 5 6import lldb 7from lldbsuite.test.lldbtest import * 8import lldbsuite.test.lldbutil as lldbutil 9 10 11class BreakpointIDTestCase(TestBase): 12 def test(self): 13 self.build() 14 15 exe = self.getBuildArtifact("a.out") 16 self.expect("file " + exe, patterns=["Current executable set to .*a.out"]) 17 18 bpno = lldbutil.run_break_set_by_symbol( 19 self, "product", num_expected_locations=-1, sym_exact=False 20 ) 21 self.assertEqual(bpno, 1, "First breakpoint number is 1.") 22 23 bpno = lldbutil.run_break_set_by_symbol( 24 self, "sum", num_expected_locations=-1, sym_exact=False 25 ) 26 self.assertEqual(bpno, 2, "Second breakpoint number is 2.") 27 28 bpno = lldbutil.run_break_set_by_symbol( 29 self, "junk", num_expected_locations=0, sym_exact=False 30 ) 31 self.assertEqual(bpno, 3, "Third breakpoint number is 3.") 32 33 self.expect( 34 "breakpoint disable 1.1 - 2.2 ", 35 COMMAND_FAILED_AS_EXPECTED, 36 error=True, 37 startstr="error: Invalid range: Ranges that specify particular breakpoint locations must be within the same major breakpoint; you specified two different major breakpoints, 1 and 2.", 38 ) 39 40 self.expect( 41 "breakpoint disable 2 - 2.2", 42 COMMAND_FAILED_AS_EXPECTED, 43 error=True, 44 startstr="error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.", 45 ) 46 47 self.expect( 48 "breakpoint disable 2.1 - 2", 49 COMMAND_FAILED_AS_EXPECTED, 50 error=True, 51 startstr="error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.", 52 ) 53 54 self.expect("breakpoint disable 2.1 - 2.2", startstr="2 breakpoints disabled.") 55 56 self.expect("breakpoint enable 2.*", patterns=[".* breakpoints enabled."]) 57