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