1""" 2Test 'breakpoint command list'. 3""" 4 5from lldbsuite.test.decorators import * 6from lldbsuite.test.lldbtest import * 7from lldbsuite.test import lldbutil 8 9class TestCase(TestBase): 10 11 @no_debug_info_test 12 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 YAML 20 target = self.dbg.CreateTarget(obj_path) 21 self.assertTrue(target, VALID_TARGET) 22 23 # Test without any breakpoints. 24 self.expect("breakpoint command list 1", error=True, substrs=["error: No breakpoints exist for which to list commands"]) 25 26 # Set a breakpoint 27 self.runCmd("b foo") 28 29 # Check list breakpoint commands for breakpoints that have no commands. 30 self.expect("breakpoint command list 1", startstr="Breakpoint 1 does not have an associated command.") 31 32 # Add a breakpoint command. 33 self.runCmd("breakpoint command add -o 'source list' 1") 34 35 # List breakpoint command that we just created. 36 self.expect("breakpoint command list 1", startstr="""Breakpoint 1: 37 Breakpoint commands: 38 source list 39""") 40 41 # List breakpoint command with invalid breakpoint ID. 42 self.expect("breakpoint command list 2", error=True, startstr="error: '2' is not a currently valid breakpoint ID.") 43