2 Test 'breakpoint command list'.
5 from lldbsuite.test.decorators import *
6 from lldbsuite.test.lldbtest import *
7 from lldbsuite.test import lldbutil
9 class TestCase(TestBase):
11 mydir = TestBase.compute_mydir(__file__)
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)
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)
25 # Test without any breakpoints.
26 self.expect("breakpoint command list 1", error=True, substrs=["error: No breakpoints exist for which to list commands"])
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.")
34 # Add a breakpoint command.
35 self.runCmd("breakpoint command add -o 'source list' 1")
37 # List breakpoint command that we just created.
38 self.expect("breakpoint command list 1", startstr="""Breakpoint 1:
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.")