brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 835ddeb Raw
62 lines · python
1"""2Test the 'gui' shortcuts 's','n','f','u','d' (step in, step over, step out, up, down)3"""4 5import lldb6from lldbsuite.test.decorators import *7from lldbsuite.test.lldbtest import *8from lldbsuite.test.lldbpexpect import PExpectTest9 10 11class TestGuiBasicDebugCommandTest(PExpectTest):12    # PExpect uses many timeouts internally and doesn't play well13    # under ASAN on a loaded machine..14    @skipIfAsan15    @skipIf(bugnumber="llvm.org/pr51833")16    @skipIfCursesSupportMissing17    def test_gui(self):18        self.build()19 20        self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100, 500))21        self.expect(22            'br set -f main.c -p "// Break here"', substrs=["Breakpoint 1", "address ="]23        )24        self.expect("run", substrs=["stop reason ="])25 26        escape_key = chr(27).encode()27 28        # Start the GUI.29        self.child.sendline("gui")30 31        # Simulate a simple debugging session.32        self.child.send("s")  # step33        self.child.expect("return 1; // In function[^\r\n]+<<< Thread 1: step in")34        self.child.send("u")  # up35        self.child.expect_exact("func();    // Break here")36        self.child.send("d")  # down37        self.child.expect_exact("return 1; // In function")38        self.child.send("f")  # finish39        self.child.expect("<<< Thread 1: step out")40        self.child.send("s")  # move onto the second one41        self.child.expect("<<< Thread 1: step in")42        self.child.send("n")  # step over43        self.child.expect("// Dummy command 1[^\r\n]+<<< Thread 1: step over")44        self.child.send("n")45 46        # Test that 'up' + 'step out' steps out of the selected function.47        self.child.send("s")  # move into func_up()48        self.child.expect("// In func_up")49        self.child.send("s")  # move into func_down()50        self.child.expect("// In func_down")51        self.child.send("u")  # up52        self.child.expect("// In func_up")53        self.child.send("f")  # finish54        self.child.expect("// Dummy command 2[^\r\n]+<<< Thread 1: step out")55        self.child.send("n")56 57        # Press escape to quit the gui58        self.child.send(escape_key)59 60        self.expect_prompt()61        self.quit()62