[lldb/plugins] Add arm64(e) support to ScriptedProcess
This patch adds support for arm64(e) targets to ScriptedProcess, by providing the `DynamicRegisterInfo` to the base `lldb.ScriptedThread` class. This allows create and debugging ScriptedProcess on Apple Silicon hardware as well as Apple mobile devices. It also replace the C++ asserts on `ScriptedThread::GetDynamicRegisterInfo` by some error logging, re-enables `TestScriptedProcess` for arm64 Darwin platforms and adds a new invalid Scripted Thread test. rdar://85892451 Differential Revision: https://reviews.llvm.org/D114923 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
@@ -41,6 +41,38 @@ class ScriptedProcesTestCase(TestBase):
|
||||
self.expect('script dir(ScriptedProcess)',
|
||||
substrs=["launch"])
|
||||
|
||||
def test_invalid_scripted_register_context(self):
|
||||
"""Test that we can launch an lldb scripted process with an invalid
|
||||
Scripted Thread, with invalid register context."""
|
||||
self.build()
|
||||
target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
|
||||
self.assertTrue(target, VALID_TARGET)
|
||||
|
||||
os.environ['SKIP_SCRIPTED_PROCESS_LAUNCH'] = '1'
|
||||
def cleanup():
|
||||
del os.environ["SKIP_SCRIPTED_PROCESS_LAUNCH"]
|
||||
self.addTearDownHook(cleanup)
|
||||
|
||||
scripted_process_example_relpath = 'invalid_scripted_process.py'
|
||||
self.runCmd("command script import " + os.path.join(self.getSourceDir(),
|
||||
scripted_process_example_relpath))
|
||||
|
||||
launch_info = lldb.SBLaunchInfo(None)
|
||||
launch_info.SetProcessPluginName("ScriptedProcess")
|
||||
launch_info.SetScriptedProcessClassName("invalid_scripted_process.InvalidScriptedProcess")
|
||||
error = lldb.SBError()
|
||||
with tempfile.NamedTemporaryFile() as log_file:
|
||||
self.runCmd("log enable lldb thread -f " + log_file.name)
|
||||
process = target.Launch(launch_info, error)
|
||||
|
||||
self.assertTrue(error.Success(), error.GetCString())
|
||||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
self.assertEqual(process.GetProcessID(), 666)
|
||||
self.assertEqual(process.GetNumThreads(), 0)
|
||||
|
||||
self.assertIn("Failed to get scripted thread registers data.".encode(),
|
||||
log_file.read())
|
||||
|
||||
@skipIf(archs=no_match(['x86_64']))
|
||||
def test_scripted_process_and_scripted_thread(self):
|
||||
"""Test that we can launch an lldb scripted process using the SBAPI,
|
||||
@@ -103,7 +135,6 @@ class ScriptedProcesTestCase(TestBase):
|
||||
|
||||
@skipUnlessDarwin
|
||||
@skipIfOutOfTreeDebugserver
|
||||
@skipIf(archs=no_match(['x86_64']))
|
||||
@skipIfAsan # rdar://85954489
|
||||
def test_launch_scripted_process_stack_frames(self):
|
||||
"""Test that we can launch an lldb scripted process from the command
|
||||
|
||||
Reference in New Issue
Block a user