aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-infthread.c
diff options
context:
space:
mode:
authorMaksim Dzabraev <dzabraew@gmail.com>2017-10-29 01:14:34 +0700
committerSimon Marchi <simon.marchi@ericsson.com>2017-10-28 14:19:08 -0400
commit484d8d361de65a8489252d14511b77c142d859a1 (patch)
tree247fd9182f1133aa53e6d20dc31babeb2e8f8433 /gdb/python/py-infthread.c
parentd91f0b20e561e326ee91a09a76206257bde8438b (diff)
downloadgdb-484d8d361de65a8489252d14511b77c142d859a1.zip
gdb-484d8d361de65a8489252d14511b77c142d859a1.tar.gz
gdb-484d8d361de65a8489252d14511b77c142d859a1.tar.bz2
Make gdb.selected_thread().inferior return a new reference
thpy_get_inferior function should return a new reference to the existing inferior object, and therefore should increment its refcount. Fixed bug looks like this. If multiple time call gdb.selected_thread ().inferior, gdb throws exception: (gdb) pi gdb.selected_thread().inferior <gdb.Inferior object at 0x7f1952bea698> (gdb) pi gdb.selected_thread().inferior Python Exception <type 'exceptions.AttributeError'> 'NoneType' object has no attribute 'inferior': Error while executing Python code. (gdb) info threads Id Target Id Frame * 1 Thread 0x7f54f0474740 (LWP 584) "mc" 0x00007f54ef055c33 in
Diffstat (limited to 'gdb/python/py-infthread.c')
-rw-r--r--gdb/python/py-infthread.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index 626c15c..31d576f 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -162,6 +162,7 @@ thpy_get_inferior (PyObject *self, void *ignore)
thread_object *thread_obj = (thread_object *) self;
THPY_REQUIRE_VALID (thread_obj);
+ Py_INCREF (thread_obj->inf_obj);
return thread_obj->inf_obj;
}