[lldb/swig] Fix ref counting issue in SBProcess::GetScriptedImplementation

When using SBProcess::GetScriptedImplementation in python, if the
process has a valid implementation, we returned a reference of the
object without incrementing the reference counting. That causes the
interpreter to crash after accessing the reference several times.

This patch address this by incrementing the reference count when passing
the valid object reference.

Differential Revision: https://reviews.llvm.org/D145260

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
Med Ismail Bennani
2023-03-03 12:35:42 -08:00
parent efc52361dd
commit ebdbc26a3e
2 changed files with 11 additions and 0 deletions

View File

@@ -80,6 +80,15 @@ class ScriptedProcesTestCase(TestBase):
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)