[Lldb-commits] [PATCH] D145260: [lldb/swig] Fix ref counting issue in SBProcess::GetScriptedImplementation

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 3 12:36:17 PST 2023


mib updated this revision to Diff 502222.
mib added a comment.

Add test


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145260/new/

https://reviews.llvm.org/D145260

Files:
  lldb/bindings/python/python-typemaps.swig
  lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py


Index: lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
===================================================================
--- lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
+++ lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
@@ -80,6 +80,15 @@
         self.assertEqual(process.GetProcessID(), 666)
         self.assertEqual(process.GetNumThreads(), 0)
 
+        impl = process.GetScriptedImplementation()
+        self.assertTrue(impl)
+        impl = process.GetScriptedImplementation()
+        self.assertTrue(impl)
+        impl = process.GetScriptedImplementation()
+        self.assertTrue(impl)
+        impl = process.GetScriptedImplementation()
+        self.assertTrue(impl)
+
         addr = 0x500000000
         buff = process.ReadMemory(addr, 4, error)
         self.assertEqual(buff, None)
Index: lldb/bindings/python/python-typemaps.swig
===================================================================
--- lldb/bindings/python/python-typemaps.swig
+++ lldb/bindings/python/python-typemaps.swig
@@ -61,6 +61,8 @@
   if (!$result) {
     $result = Py_None;
     Py_INCREF(Py_None);
+  } else {
+    Py_INCREF($result);
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145260.502222.patch
Type: text/x-patch
Size: 1216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230303/fded33b2/attachment.bin>


More information about the lldb-commits mailing list