+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.
+
2011-11-27 Joel Brobecker <brobecker@acacore.com>
* remote.c (remote_get_tracepoint_status): Delete addrbuf
{
gdb_py_ulongest pc;
struct block *block;
- struct obj_section *section;
- struct symtab *symtab;
+ struct obj_section *section = NULL;
+ struct symtab *symtab = NULL;
+ volatile struct gdb_exception except;
if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
return NULL;
- section = find_pc_mapped_section (pc);
- symtab = find_pc_sect_symtab (pc, section);
+ TRY_CATCH (except, RETURN_MASK_ALL)
+ {
+ section = find_pc_mapped_section (pc);
+ symtab = find_pc_sect_symtab (pc, section);
+ }
+ GDB_PY_HANDLE_EXCEPTION (except);
+
if (!symtab || symtab->objfile == NULL)
{
PyErr_SetString (PyExc_RuntimeError,
{
breakpoint_object *self_bp = (breakpoint_object *) self;
long value;
+ volatile struct gdb_exception except;
BPPY_SET_REQUIRE_VALID (self_bp);
if (value < 0)
value = 0;
- set_ignore_count (self_bp->number, (int) value, 0);
+
+ TRY_CATCH (except, RETURN_MASK_ALL)
+ {
+ set_ignore_count (self_bp->number, (int) value, 0);
+ }
+ GDB_PY_SET_HANDLE_EXCEPTION (except);
return 0;
}
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;
set_inferior_data (inferior, infpy_inf_data_key, inf_obj);
- do_cleanups (cleanup);
}
else
Py_INCREF ((PyObject *)inf_obj);
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 =
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;
typy_strip_typedefs (PyObject *self, PyObject *args)
{
struct type *type = ((type_object *) self)->type;
+ volatile struct gdb_exception except;
+
+ TRY_CATCH (except, RETURN_MASK_ALL)
+ {
+ type = check_typedef (type);
+ }
+ GDB_PY_HANDLE_EXCEPTION (except);
return type_to_type_object (check_typedef (type));
}
{
int i;
struct demangle_component *demangled;
- struct demangle_parse_info *info;
+ struct demangle_parse_info *info = NULL;
const char *err;
struct type *argtype;
struct cleanup *cleanup;
+ volatile struct gdb_exception except;
if (TYPE_NAME (type) == NULL)
{
return NULL;
}
- /* Note -- this is not thread-safe. */
- info = cp_demangled_name_to_comp (TYPE_NAME (type), &err);
+ TRY_CATCH (except, RETURN_MASK_ALL)
+ {
+ /* Note -- this is not thread-safe. */
+ info = cp_demangled_name_to_comp (TYPE_NAME (type), &err);
+ }
+ GDB_PY_HANDLE_EXCEPTION (except);
+
if (! info)
{
PyErr_SetString (PyExc_RuntimeError, err);
struct type *type;
int nonzero = 0; /* Appease GCC warning. */
- type = check_typedef (value_type (self_value->value));
-
TRY_CATCH (except, RETURN_MASK_ALL)
{
+ type = check_typedef (value_type (self_value->value));
+
if (is_integral_type (type) || TYPE_CODE (type) == TYPE_CODE_PTR)
nonzero = !!value_as_long (self_value->value);
else if (TYPE_CODE (type) == TYPE_CODE_FLT)
if (! PyArg_ParseTuple (args, "|s", &arg))
return NULL;
- cleanups = ensure_python_env (get_current_arch (), current_language);
+ cleanups = make_cleanup (null_cleanup, NULL);
TRY_CATCH (except, RETURN_MASK_ALL)
{