1""" 2Test lldb breakpoint ids. 3""" 4 5 6 7import lldb 8from lldbsuite.test.lldbtest import * 9import lldbsuite.test.lldbutil as lldbutil 10 11 12class BreakpointIDTestCase(TestBase): 13 14 mydir = TestBase.compute_mydir(__file__) 15 16 def test(self): 17 self.build() 18 19 exe = self.getBuildArtifact("a.out") 20 self.expect("file " + exe, 21 patterns=["Current executable set to .*a.out"]) 22 23 bpno = lldbutil.run_break_set_by_symbol( 24 self, 'product', num_expected_locations=-1, sym_exact=False) 25 self.assertEquals(bpno, 1, "First breakpoint number is 1.") 26 27 bpno = lldbutil.run_break_set_by_symbol( 28 self, 'sum', num_expected_locations=-1, sym_exact=False) 29 self.assertEquals(bpno, 2, "Second breakpoint number is 2.") 30 31 bpno = lldbutil.run_break_set_by_symbol( 32 self, 'junk', num_expected_locations=0, sym_exact=False) 33 self.assertEquals(bpno, 3, "Third breakpoint number is 3.") 34 35 self.expect( 36 "breakpoint disable 1.1 - 2.2 ", 37 COMMAND_FAILED_AS_EXPECTED, 38 error=True, 39 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.") 40 41 self.expect( 42 "breakpoint disable 2 - 2.2", 43 COMMAND_FAILED_AS_EXPECTED, 44 error=True, 45 startstr="error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.") 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 self.expect("breakpoint disable 2.1 - 2.2", 54 startstr="2 breakpoints disabled.") 55 56 self.expect("breakpoint enable 2.*", 57 patterns=[".* breakpoints enabled."]) 58