1"""
2Test setting a breakpoint by line and column.
3"""
4
5
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12
13class BreakpointByLineAndColumnTestCase(TestBase):
14
15    def testBreakpointSpecWithLine(self):
16        self.build()
17        target = self.createTestTarget()
18
19        # This one should work:
20        lldbutil.run_break_set_by_file_colon_line(self, "main.c:11", "main.c", 11, num_expected_locations = 1)
21        # Let's try an illegal specifier to make sure the command fails.  I'm not being exhaustive
22        # since the UnitTest has more bad patterns.  I'm just testing that if the SetFromString
23        # fails, we propagate the error.
24        self.expect("break set -y 'foo.c'", error=True)
25
26    ## Skip gcc version less 7.1 since it doesn't support -gcolumn-info
27    @skipIf(compiler="gcc", compiler_version=['<', '7.1'])
28    def testBreakpointByLine(self):
29        self.build()
30        target = self.createTestTarget()
31
32        main_c = lldb.SBFileSpec("main.c")
33        lldbutil.run_break_set_by_file_colon_line(self, "main.c:11:50", "main.c", 11, num_expected_locations = 1)
34
35