From c1928033047409f977b26ffc938d59188f1ced97 Mon Sep 17 00:00:00 2001 From: Med Ismail Bennani Date: Fri, 3 Feb 2023 12:28:47 -0800 Subject: [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 --- lldb/test/API/python_api/process/TestProcessAPI.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lldb/test/API/python_api/process/TestProcessAPI.py') diff --git a/lldb/test/API/python_api/process/TestProcessAPI.py b/lldb/test/API/python_api/process/TestProcessAPI.py index 3fad30a78a17..cf05335b2384 100644 --- a/lldb/test/API/python_api/process/TestProcessAPI.py +++ b/lldb/test/API/python_api/process/TestProcessAPI.py @@ -18,6 +18,18 @@ class ProcessAPITestCase(TestBase): "main.cpp", "// Set break point at this line and check variable 'my_char'.") + def test_scripted_implementation(self): + self.build() + exe = self.getBuildArtifact("a.out") + + (target, process, _, _) = \ + lldbutil.run_to_source_breakpoint(self, "Set break point", + lldb.SBFileSpec("main.cpp")) + + self.assertTrue(process, PROCESS_IS_VALID) + self.assertEqual(process.GetScriptedImplementation(), None) + + def test_read_memory(self): """Test Python SBProcess.ReadMemory() API.""" self.build() -- cgit v1.2.3