1"""
2Test setting a breakpoint by line and column.
3"""
4
5
6import lldb
7from lldbsuite.test.decorators import *
8from lldbsuite.test.lldbtest import *
9from lldbsuite.test import lldbutil
10
11
12class BreakpointByLineAndColumnTestCase(TestBase):
13    def testBreakpointSpecWithLine(self):
14        self.build()
15        target = self.createTestTarget()
16
17        # This one should work:
18        lldbutil.run_break_set_by_file_colon_line(
19            self, "main.c:11", "main.c", 11, num_expected_locations=1
20        )
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(
34            self, "main.c:11:50", "main.c", 11, num_expected_locations=1
35        )
36