aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2011-11-10 19:15:10 +0000
committerDoug Evans <dje@google.com>2011-11-10 19:15:10 +0000
commitf6b47be484b30121c0d162eafd6c4a64dbd8d59f (patch)
tree57edd4b9d22beaeba5f4403846ed67b513904b02 /gdb/python
parentbd119cf1520d4fc5b6733f7d035461dd277c951e (diff)
downloadgdb-f6b47be484b30121c0d162eafd6c4a64dbd8d59f.zip
gdb-f6b47be484b30121c0d162eafd6c4a64dbd8d59f.tar.gz
gdb-f6b47be484b30121c0d162eafd6c4a64dbd8d59f.tar.bz2
* python/py-type.c (typy_fields_items): Call check_typedef.
testsuite/ * gdb.python/py-type.c (TS): New typedef. (ts): New global. * gdb.python/py-type.exp: Test field list of typedef.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-type.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 67696fd..44a2223 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -294,14 +294,33 @@ make_fielditem (struct type *type, int i, enum gdbpy_iter_kind kind)
static PyObject *
typy_fields_items (PyObject *self, enum gdbpy_iter_kind kind)
{
+ PyObject *py_type = self;
PyObject *result = NULL, *iter = NULL;
-
- iter = typy_make_iter (self, kind);
- if (iter == NULL)
- return NULL;
-
- result = PySequence_List (iter);
- Py_DECREF (iter);
+ volatile struct gdb_exception except;
+ struct type *type = ((type_object *) py_type)->type;
+ struct type *checked_type = type;
+
+ TRY_CATCH (except, RETURN_MASK_ALL)
+ {
+ CHECK_TYPEDEF (checked_type);
+ }
+ GDB_PY_HANDLE_EXCEPTION (except);
+
+ if (checked_type != type)
+ py_type = type_to_type_object (checked_type);
+ iter = typy_make_iter (py_type, kind);
+ if (checked_type != type)
+ {
+ /* Need to wrap this in braces because Py_DECREF isn't wrapped
+ in a do{}while(0). */
+ Py_DECREF (py_type);
+ }
+ if (iter != NULL)
+ {
+ result = PySequence_List (iter);
+ Py_DECREF (iter);
+ }
+
return result;
}