brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 9e21495 Raw
106 lines · python
1"""2Test 'frame select' command.3"""4 5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7from lldbsuite.test import lldbutil8 9 10class TestFrameSelect(TestBase):11    @no_debug_info_test12    @skipIfWindows13    def test_relative(self):14        self.build()15 16        lldbutil.run_to_source_breakpoint(17            self, "// Set break point at this line.", lldb.SBFileSpec("main.cpp")18        )19 20        self.expect("frame select -r 1", substrs=["nested2() at"])21        self.expect("frame select -r -1", substrs=["nested3() at"])22 23        self.expect(24            "frame select -r -1",25            error=True,26            substrs=["already at the bottom of the stack"],27        )28        self.expect(29            "frame select -r -2147483647",30            error=True,31            substrs=["already at the bottom of the stack"],32        )33        self.expect(34            "frame select -r -2147483648",35            error=True,36            substrs=["error: invalid frame offset argument '-2147483648'"],37        )38        self.expect(39            "frame select -r -2147483649",40            error=True,41            substrs=["error: invalid frame offset argument '-2147483649'"],42        )43 44        self.expect("frame select -r 1", substrs=["nested2() at"])45        self.expect("frame select -r -2", substrs=["nested3() at"])46        self.expect("frame select -r 1", substrs=["nested2() at"])47        self.expect("frame select -r -2147483647", substrs=["nested3() at"])48        self.expect("frame select -r 1", substrs=["nested2() at"])49        self.expect(50            "frame select -r -2147483648",51            error=True,52            substrs=["error: invalid frame offset argument '-2147483648'"],53        )54        self.expect(55            "frame select -r -2147483649",56            error=True,57            substrs=["error: invalid frame offset argument '-2147483649'"],58        )59 60        self.expect("frame select -r 100")61        self.expect(62            "frame select -r 1",63            error=True,64            substrs=["already at the top of the stack"],65        )66 67    @no_debug_info_test68    @skipIfWindows69    def test_mixing_relative_and_abs(self):70        self.build()71 72        lldbutil.run_to_source_breakpoint(73            self, "// Set break point at this line.", lldb.SBFileSpec("main.cpp")74        )75 76        # The function associated with each frame index can change depending77        # on the function calling main (e.g. `start`), so this only tests that78        # the frame index number is correct. We test the actual functions79        # in the relative test.80 81        # Jump to the top of the stack.82        self.expect("frame select 0", substrs=["frame #0"])83 84        # Run some relative commands.85        self.expect("up", substrs=["frame #1"])86        self.expect("frame select -r 1", substrs=["frame #2"])87        self.expect("frame select -r -1", substrs=["frame #1"])88 89        # Test that absolute indices still work.90        self.expect("frame select 2", substrs=["frame #2"])91        self.expect("frame select 1", substrs=["frame #1"])92        self.expect("frame select 3", substrs=["frame #3"])93        self.expect("frame select 0", substrs=["frame #0"])94        self.expect("frame select 1", substrs=["frame #1"])95 96        # Run some other relative frame select commands.97        self.expect("down", substrs=["frame #0"])98        self.expect("frame select -r 1", substrs=["frame #1"])99        self.expect("frame select -r -1", substrs=["frame #0"])100 101        # Test that absolute indices still work.102        self.expect("frame select 2", substrs=["frame #2"])103        self.expect("frame select 1", substrs=["frame #1"])104        self.expect("frame select 3", substrs=["frame #3"])105        self.expect("frame select 0", substrs=["frame #0"])106