aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-inferior.c
diff options
context:
space:
mode:
authorPhil Muldoon <pmuldoon@redhat.com>2011-11-28 15:49:43 +0000
committerPhil Muldoon <pmuldoon@redhat.com>2011-11-28 15:49:43 +0000
commit5d9c59954f8b3d17402ac68681556a8f858833e2 (patch)
treed30f59cc34feaca48bc61e9541daeb668e3f8cfe /gdb/python/py-inferior.c
parent641c924047c553179c24b790133286ae41960fae (diff)
downloadgdb-5d9c59954f8b3d17402ac68681556a8f858833e2.zip
gdb-5d9c59954f8b3d17402ac68681556a8f858833e2.tar.gz
gdb-5d9c59954f8b3d17402ac68681556a8f858833e2.tar.bz2
2011-11-28 Phil Muldoon <pmuldoon@redhat.com>
PR python/13369 PR python/13374 * python/python.c (gdbpy_decode_line): Do not acquire GIL. * python/py-inferior.c (inferior_to_inferior_object): Ditto. * python/py-value.c (valpy_nonzero): Use TRY_CATCH to catch GDB exceptions. * python/py-type.c (typy_strip_typedefs): Ditto. (typy_legacy_template_argument): Ditto. * python/py-inferior.c (inferior_to_inferior_object): Ditto. * python/py-breakpoint.c (bppy_set_ignore_count): Ditto.
Diffstat (limited to 'gdb/python/py-inferior.c')
-rw-r--r--gdb/python/py-inferior.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index d6086dc..7b2981e 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -157,15 +157,9 @@ inferior_to_inferior_object (struct inferior *inferior)
inf_obj = inferior_data (inferior, infpy_inf_data_key);
if (!inf_obj)
{
- struct cleanup *cleanup;
- cleanup = ensure_python_env (python_gdbarch, python_language);
-
inf_obj = PyObject_New (inferior_object, &inferior_object_type);
if (!inf_obj)
- {
- do_cleanups (cleanup);
return NULL;
- }
inf_obj->inferior = inferior;
inf_obj->threads = NULL;
@@ -173,7 +167,6 @@ inferior_to_inferior_object (struct inferior *inferior)
set_inferior_data (inferior, infpy_inf_data_key, inf_obj);
- do_cleanups (cleanup);
}
else
Py_INCREF ((PyObject *)inf_obj);
@@ -266,10 +259,15 @@ delete_thread_object (struct thread_info *tp, int ignore)
inferior_object *inf_obj;
thread_object *thread_obj;
struct threadlist_entry **entry, *tmp;
+
+ cleanup = ensure_python_env (python_gdbarch, python_language);
inf_obj = (inferior_object *) find_inferior_object (PIDGET(tp->ptid));
if (!inf_obj)
- return;
+ {
+ do_cleanups (cleanup);
+ return;
+ }
/* Find thread entry in its inferior's thread_list. */
for (entry = &inf_obj->threads; *entry != NULL; entry =
@@ -280,11 +278,10 @@ delete_thread_object (struct thread_info *tp, int ignore)
if (!*entry)
{
Py_DECREF (inf_obj);
+ do_cleanups (cleanup);
return;
}
- cleanup = ensure_python_env (python_gdbarch, python_language);
-
tmp = *entry;
tmp->thread_obj->thread = NULL;