diff options
| author | Med Ismail Bennani <medismail.bennani@gmail.com> | 2021-12-01 18:56:29 -0800 |
|---|---|---|
| committer | Med Ismail Bennani <medismail.bennani@gmail.com> | 2021-12-06 16:11:59 -0800 |
| commit | caea440a11e47bf86b0e43feb28a9287e4fbe3f8 (patch) | |
| tree | b21ee6f95800aea549f5cd7029ffba3a999d5766 /lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py | |
| parent | 6fef466779cafea30b82780c481896de187596c6 (diff) | |
[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>
Diffstat (limited to 'lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py')
| -rw-r--r-- | lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py index 9df72cdda190..87ea860f436d 100644 --- a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py +++ b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py @@ -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 |
