
The architectures provided to skipIf / expectedFail are regular expressions (v. _match_decorator_property() in decorators.py so on Darwin systems "arm64" would match the skips for "arm" (32-bit Linux). Update these to "arm$" to prevent this, and also update three tests (TestBuiltinFormats.py, TestCrossDSOTailCalls.py, TestCrossObjectTailCalls.py) that were skipped for arm64 via this behavior, and need to be skipped or they will fail. This was moviated by the new TestDynamicValue.py test which has an expected-fail for arm, but the test was passing on arm64 Darwin resulting in failure for the CIs.
76 lines
2.6 KiB
Python
76 lines
2.6 KiB
Python
"""
|
|
Test that LLDB can launch a linux executable through the dynamic loader and still hit a breakpoint.
|
|
"""
|
|
|
|
import lldb
|
|
import os
|
|
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
from lldbsuite.test import lldbutil
|
|
|
|
|
|
class TestLinux64LaunchingViaDynamicLoader(TestBase):
|
|
@skipIf(oslist=no_match(["linux"]))
|
|
@no_debug_info_test
|
|
@skipIf(oslist=["linux"], archs=["arm$"])
|
|
def test(self):
|
|
self.build()
|
|
|
|
# Extracts path of the interpreter.
|
|
spec = lldb.SBModuleSpec()
|
|
spec.SetFileSpec(lldb.SBFileSpec(self.getBuildArtifact("a.out")))
|
|
interp_section = lldb.SBModule(spec).FindSection(".interp")
|
|
if not interp_section:
|
|
return
|
|
section_data = interp_section.GetSectionData()
|
|
error = lldb.SBError()
|
|
exe = section_data.GetString(error, 0)
|
|
if error.Fail():
|
|
return
|
|
|
|
target = self.dbg.CreateTarget(exe)
|
|
self.assertTrue(target, VALID_TARGET)
|
|
|
|
# Set breakpoints both on shared library function as well as on
|
|
# main. Both of them will be pending breakpoints.
|
|
breakpoint_main = target.BreakpointCreateBySourceRegex(
|
|
"// Break here", lldb.SBFileSpec("main.cpp")
|
|
)
|
|
breakpoint_shared_library = target.BreakpointCreateBySourceRegex(
|
|
"get_signal_crash", lldb.SBFileSpec("signal_file.cpp")
|
|
)
|
|
inferior_exe_path = lldbutil.install_to_target(
|
|
self, self.getBuildArtifact("a.out")
|
|
)
|
|
lldbutil.install_to_target(self, self.getBuildArtifact("libsignal_file.so"))
|
|
|
|
launch_info = lldb.SBLaunchInfo(
|
|
[
|
|
"--library-path",
|
|
self.get_process_working_directory(),
|
|
inferior_exe_path,
|
|
]
|
|
)
|
|
launch_info.SetWorkingDirectory(self.get_process_working_directory())
|
|
error = lldb.SBError()
|
|
process = target.Launch(launch_info, error)
|
|
self.assertSuccess(error)
|
|
|
|
# Stopped on main here.
|
|
self.assertState(process.GetState(), lldb.eStateStopped)
|
|
thread = process.GetSelectedThread()
|
|
self.assertIn("main", thread.GetFrameAtIndex(0).GetDisplayFunctionName())
|
|
process.Continue()
|
|
|
|
# Stopped on get_signal_crash function here.
|
|
self.assertState(process.GetState(), lldb.eStateStopped)
|
|
self.assertIn(
|
|
"get_signal_crash", thread.GetFrameAtIndex(0).GetDisplayFunctionName()
|
|
)
|
|
process.Continue()
|
|
|
|
# Stopped because of generated signal.
|
|
self.assertState(process.GetState(), lldb.eStateStopped)
|
|
self.assertIn("raise", lldbutil.get_function_names(thread))
|