[TableGen] Fix validateOperandClass for non Phyical Reg (#118146)
[llvm-project.git] / lldb / test / API / functionalities / dyld-launch-linux / TestDyldLaunchLinux.py
blobc4eba023ea72287c9aad8066a6d97184a6421323
1 """
2 Test that LLDB can launch a linux executable through the dynamic loader and still hit a breakpoint.
3 """
5 import lldb
6 import os
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class TestLinux64LaunchingViaDynamicLoader(TestBase):
14 @skipIf(oslist=no_match(["linux"]))
15 @no_debug_info_test
16 @skipIf(oslist=["linux"], archs=["arm"])
17 def test(self):
18 self.build()
20 # Extracts path of the interpreter.
21 spec = lldb.SBModuleSpec()
22 spec.SetFileSpec(lldb.SBFileSpec(self.getBuildArtifact("a.out")))
23 interp_section = lldb.SBModule(spec).FindSection(".interp")
24 if not interp_section:
25 return
26 section_data = interp_section.GetSectionData()
27 error = lldb.SBError()
28 exe = section_data.GetString(error, 0)
29 if error.Fail():
30 return
32 target = self.dbg.CreateTarget(exe)
33 self.assertTrue(target, VALID_TARGET)
35 # Set breakpoints both on shared library function as well as on
36 # main. Both of them will be pending breakpoints.
37 breakpoint_main = target.BreakpointCreateBySourceRegex(
38 "// Break here", lldb.SBFileSpec("main.cpp")
40 breakpoint_shared_library = target.BreakpointCreateBySourceRegex(
41 "get_signal_crash", lldb.SBFileSpec("signal_file.cpp")
43 inferior_exe_path = lldbutil.install_to_target(
44 self, self.getBuildArtifact("a.out")
46 lldbutil.install_to_target(self, self.getBuildArtifact("libsignal_file.so"))
48 launch_info = lldb.SBLaunchInfo(
50 "--library-path",
51 self.get_process_working_directory(),
52 inferior_exe_path,
55 launch_info.SetWorkingDirectory(self.get_process_working_directory())
56 error = lldb.SBError()
57 process = target.Launch(launch_info, error)
58 self.assertSuccess(error)
60 # Stopped on main here.
61 self.assertState(process.GetState(), lldb.eStateStopped)
62 thread = process.GetSelectedThread()
63 self.assertIn("main", thread.GetFrameAtIndex(0).GetDisplayFunctionName())
64 process.Continue()
66 # Stopped on get_signal_crash function here.
67 self.assertState(process.GetState(), lldb.eStateStopped)
68 self.assertIn(
69 "get_signal_crash", thread.GetFrameAtIndex(0).GetDisplayFunctionName()
71 process.Continue()
73 # Stopped because of generated signal.
74 self.assertState(process.GetState(), lldb.eStateStopped)
75 self.assertIn("raise", lldbutil.get_function_names(thread))