2 Test that LLDB can launch a linux executable through the dynamic loader and still hit a breakpoint.
8 from lldbsuite
.test
.decorators
import *
9 from lldbsuite
.test
.lldbtest
import *
12 class TestLinux64LaunchingViaDynamicLoader(TestBase
):
13 @skipIf(oslist
=no_match(["linux"]))
15 @skipIf(oslist
=["linux"], archs
=["arm"])
19 # Extracts path of the interpreter.
20 spec
= lldb
.SBModuleSpec()
21 spec
.SetFileSpec(lldb
.SBFileSpec(self
.getBuildArtifact("a.out")))
22 interp_section
= lldb
.SBModule(spec
).FindSection(".interp")
23 if not interp_section
:
25 section_data
= interp_section
.GetSectionData()
26 error
= lldb
.SBError()
27 exe
= section_data
.GetString(error
, 0)
31 target
= self
.dbg
.CreateTarget(exe
)
32 self
.assertTrue(target
, VALID_TARGET
)
34 # Set breakpoints both on shared library function as well as on
35 # main. Both of them will be pending breakpoints.
36 breakpoint_main
= target
.BreakpointCreateBySourceRegex(
37 "// Break here", lldb
.SBFileSpec("main.cpp")
39 breakpoint_shared_library
= target
.BreakpointCreateBySourceRegex(
40 "get_signal_crash", lldb
.SBFileSpec("signal_file.cpp")
42 launch_info
= lldb
.SBLaunchInfo(
45 self
.get_process_working_directory(),
46 self
.getBuildArtifact("a.out"),
49 launch_info
.SetWorkingDirectory(self
.get_process_working_directory())
50 error
= lldb
.SBError()
51 process
= target
.Launch(launch_info
, error
)
52 self
.assertSuccess(error
)
54 # Stopped on main here.
55 self
.assertState(process
.GetState(), lldb
.eStateStopped
)
56 thread
= process
.GetSelectedThread()
57 self
.assertIn("main", thread
.GetFrameAtIndex(0).GetDisplayFunctionName())
60 # Stopped on get_signal_crash function here.
61 self
.assertState(process
.GetState(), lldb
.eStateStopped
)
63 "get_signal_crash", thread
.GetFrameAtIndex(0).GetDisplayFunctionName()
67 # Stopped because of generated signal.
68 self
.assertState(process
.GetState(), lldb
.eStateStopped
)
69 self
.assertIn("raise", lldbutil
.get_function_names(thread
))