diff options
| author | Med Ismail Bennani <medismail.bennani@gmail.com> | 2023-02-03 12:28:47 -0800 |
|---|---|---|
| committer | Med Ismail Bennani <medismail.bennani@gmail.com> | 2023-02-03 12:29:01 -0800 |
| commit | c1928033047409f977b26ffc938d59188f1ced97 (patch) | |
| tree | ca2d6248fb629ec8eff457ba992ad4e2447ed864 /lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py | |
| parent | a48c4a45e0c517bf1508b3c55cf1d4d875a92353 (diff) | |
[lldb] Add a way to get a scripted process implementation from the SBAPI
This patch introduces a new `GetScriptedImplementation` method to the
SBProcess class in the SBAPI. It will allow users of Scripted Processes to
fetch the scripted implementation object from to script interpreter to be
able to interact with it directly (without having to go through lldb).
This allows to user to perform action that are not specified in the
scripted process interface, like calling un-specified methods, but also
to enrich the implementation, by passing it complex objects.
Differential Revision: https://reviews.llvm.org/D143236
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 | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py index 9cb33fb83201..50ef5ffadd81 100644 --- a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py +++ b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py @@ -10,6 +10,8 @@ from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil from lldbsuite.test import lldbtest +import dummy_scripted_process + class ScriptedProcesTestCase(TestBase): NO_DEBUG_INFO_TESTCASE = True @@ -118,6 +120,14 @@ class ScriptedProcesTestCase(TestBase): self.assertEqual(process.GetProcessID(), 42) self.assertEqual(process.GetNumThreads(), 1) + py_impl = process.GetScriptedImplementation() + self.assertTrue(py_impl) + self.assertTrue(isinstance(py_impl, dummy_scripted_process.DummyScriptedProcess)) + self.assertFalse(hasattr(py_impl, 'my_super_secret_member')) + py_impl.my_super_secret_member = 42 + self.assertTrue(hasattr(py_impl, 'my_super_secret_member')) + self.assertEqual(py_impl.my_super_secret_method(), 42) + addr = 0x500000000 message = "Hello, world!" buff = process.ReadCStringFromMemory(addr, len(message) + 1, error) |
