xref: /llvm-project/lldb/test/API/commands/breakpoint/set/func-regex/TestBreakpointRegexError.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6
7class TestCase(TestBase):
8    @no_debug_info_test
9    def test_error(self):
10        self.expect(
11            "breakpoint set --func-regex (",
12            error=True,
13            substrs=[
14                "error: Function name regular expression could "
15                + "not be compiled: parentheses not balanced"
16            ],
17        )
18
19        # Point out if looks like the user provided a globbing expression.
20        self.expect(
21            "breakpoint set --func-regex *a",
22            error=True,
23            substrs=[
24                "error: Function name regular expression could "
25                + "not be compiled: repetition-operator operand invalid",
26                "warning: Function name regex does not accept glob patterns.",
27            ],
28        )
29        self.expect(
30            "breakpoint set --func-regex ?a",
31            error=True,
32            substrs=[
33                "error: Function name regular expression could "
34                + "not be compiled: repetition-operator operand invalid",
35                "warning: Function name regex does not accept glob patterns.",
36            ],
37        )
38        # Make sure that warning is only shown for invalid regular expressions
39        # that look like a globbing expression (i.e., they have a leading * or ?).
40        self.expect(
41            "breakpoint set --func-regex a*+",
42            error=True,
43            matching=False,
44            substrs=["warning: Function name regex does not accept glob patterns."],
45        )
46        self.expect(
47            "breakpoint set --func-regex a?+",
48            error=True,
49            matching=False,
50            substrs=["warning: Function name regex does not accept glob patterns."],
51        )
52