98fe4335cc2ab415f74634c66437f60ef2f3c1c7
[openbsd] /
1 """
2 Test setting a breakpoint by line and column.
3 """
4
5
6
7 import lldb
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
11
12
13 class BreakpointByLineAndColumnTestCase(TestBase):
14
15     mydir = TestBase.compute_mydir(__file__)
16
17     ## Skip gcc version less 7.1 since it doesn't support -gcolumn-info
18     @skipIf(compiler="gcc", compiler_version=['<', '7.1'])
19     def testBreakpointByLineAndColumn(self):
20         self.build()
21         main_c = lldb.SBFileSpec("main.c")
22         _, _, _, breakpoint = lldbutil.run_to_line_breakpoint(self,
23                                                               main_c, 19, 50)
24         self.expect("fr v did_call", substrs='1')
25         in_then = False
26         for i in range(breakpoint.GetNumLocations()):
27             b_loc = breakpoint.GetLocationAtIndex(i).GetAddress().GetLineEntry()
28             self.assertEqual(b_loc.GetLine(), 19)
29             in_then |= b_loc.GetColumn() == 50
30         self.assertTrue(in_then)
31
32     ## Skip gcc version less 7.1 since it doesn't support -gcolumn-info
33     @skipIf(compiler="gcc", compiler_version=['<', '7.1'])
34     def testBreakpointByLine(self):
35         self.build()
36         main_c = lldb.SBFileSpec("main.c")
37         _, _, _, breakpoint = lldbutil.run_to_line_breakpoint(self, main_c, 19)
38         self.expect("fr v did_call", substrs='0')
39         in_condition = False
40         for i in range(breakpoint.GetNumLocations()):
41             b_loc = breakpoint.GetLocationAtIndex(i).GetAddress().GetLineEntry()
42             self.assertEqual(b_loc.GetLine(), 19)
43             in_condition |= b_loc.GetColumn() < 30
44         self.assertTrue(in_condition)