f1a8656a73b55e3e8a030a1e3d03d2cf71a1743e
[openbsd] /
1 """
2 Test 'breakpoint command list'.
3 """
4
5 from lldbsuite.test.decorators import *
6 from lldbsuite.test.lldbtest import *
7 from lldbsuite.test import lldbutil
8
9 class TestCase(TestBase):
10
11     mydir = TestBase.compute_mydir(__file__)
12
13     @no_debug_info_test
14     def test_list_commands(self):
15         src_dir = self.getSourceDir()
16         yaml_path = os.path.join(src_dir, "a.yaml")
17         yaml_base, ext = os.path.splitext(yaml_path)
18         obj_path = self.getBuildArtifact("main.o")
19         self.yaml2obj(yaml_path, obj_path)
20
21         # Create a target with the object file we just created from YAML
22         target = self.dbg.CreateTarget(obj_path)
23         self.assertTrue(target, VALID_TARGET)
24
25         # Test without any breakpoints.
26         self.expect("breakpoint command list 1", error=True, substrs=["error: No breakpoints exist for which to list commands"])
27
28         # Set a breakpoint
29         self.runCmd("b foo")
30
31         # Check list breakpoint commands for breakpoints that have no commands.
32         self.expect("breakpoint command list 1", startstr="Breakpoint 1 does not have an associated command.")
33
34         # Add a breakpoint command.
35         self.runCmd("breakpoint command add -o 'source list' 1")
36
37         # List breakpoint command that we just created.
38         self.expect("breakpoint command list 1", startstr="""Breakpoint 1:
39     Breakpoint commands:
40       source list
41 """)
42
43         # List breakpoint command with invalid breakpoint ID.
44         self.expect("breakpoint command list 2", error=True, startstr="error: '2' is not a currently valid breakpoint ID.")