2 Test the use of setjmp/longjmp for non-local goto operations in a single-threaded inferior.
7 from lldbsuite
.test
.decorators
import *
8 from lldbsuite
.test
.lldbtest
import *
9 from lldbsuite
.test
import lldbutil
12 class LongjmpTestCase(TestBase
):
13 @skipIfDarwin # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp
14 @expectedFailureAll(oslist
=["freebsd", "linux"], bugnumber
="llvm.org/pr20231")
15 @expectedFailureAll(oslist
=["windows"], bugnumber
="llvm.org/pr24778")
17 def test_step_out(self
):
18 """Test stepping when the inferior calls setjmp/longjmp, in particular, thread step-out."""
22 @skipIfDarwin # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp
23 @expectedFailureAll(oslist
=["freebsd", "linux"], bugnumber
="llvm.org/pr20231")
24 @expectedFailureAll(oslist
=["windows"], bugnumber
="llvm.org/pr24778")
26 def test_step_over(self
):
27 """Test stepping when the inferior calls setjmp/longjmp, in particular, thread step-over a longjmp."""
31 @skipIfDarwin # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp
32 @expectedFailureAll(oslist
=["freebsd", "linux"], bugnumber
="llvm.org/pr20231")
33 @expectedFailureAll(oslist
=["windows"], bugnumber
="llvm.org/pr24778")
35 def test_step_back_out(self
):
36 """Test stepping when the inferior calls setjmp/longjmp, in particular, thread step-out after thread step-in."""
40 def start_test(self
, symbol
):
41 exe
= self
.getBuildArtifact("a.out")
43 self
.runCmd("file " + exe
, CURRENT_EXECUTABLE_SET
)
46 lldbutil
.run_break_set_by_symbol(self
, symbol
, num_expected_locations
=-1)
48 self
.runCmd("run", RUN_SUCCEEDED
)
50 # The stop reason of the thread should be breakpoint.
53 STOPPED_DUE_TO_BREAKPOINT
,
54 substrs
=["stopped", "stop reason = breakpoint"],
57 def check_status(self
):
58 # Note: Depending on the generated mapping of DWARF to assembly,
59 # the process may have stopped or exited.
63 patterns
=["Process .* exited with status = 0"],
67 self
.start_test("do_jump")
68 self
.runCmd("thread step-out", RUN_SUCCEEDED
)
72 self
.start_test("do_jump")
73 self
.runCmd("thread step-over", RUN_SUCCEEDED
)
74 self
.runCmd("thread step-over", RUN_SUCCEEDED
)
77 def step_back_out(self
):
78 self
.start_test("main")
80 self
.runCmd("thread step-over", RUN_SUCCEEDED
)
81 self
.runCmd("thread step-in", RUN_SUCCEEDED
)
82 self
.runCmd("thread step-out", RUN_SUCCEEDED
)