This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: fix PR python/10953
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 20 Aug 2010 16:34:09 -0600
- Subject: FYI: fix PR python/10953
I'm going to check this in (but probably next week).
This fixes PR python/10953. The problem there is that Type.fields
doesn't first call check_typedef, yielding an empty field list in some
cases. That isn't very useful, so this adds the call. I looked at all
the other Type methods to see if check_typedef is needed, and ran across
a possible latent bug (lack of TRY_CATCH) in typy_template_argument.
Built and regtested on x86-64 (compile farm).
Tom
2010-08-20 Tom Tromey <tromey@redhat.com>
PR python/10953:
* python/py-type.c (typy_fields): Call check_typedef.
(typy_template_argument): Add TRY_CATCH.
gdb/ChangeLog | 6 ++++++
gdb/python/py-type.c | 17 ++++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 3098248..3ee86d6 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -216,6 +216,13 @@ typy_fields (PyObject *self, PyObject *args)
PyObject *result;
int i;
struct type *type = ((type_object *) self)->type;
+ volatile struct gdb_exception except;
+
+ TRY_CATCH (except, RETURN_MASK_ALL)
+ {
+ CHECK_TYPEDEF (type);
+ }
+ GDB_PY_HANDLE_EXCEPTION (except);
/* We would like to make a tuple here, make fields immutable, and
then memoize the result (and perhaps make Field.type() lazy).
@@ -640,9 +647,13 @@ typy_template_argument (PyObject *self, PyObject *args)
}
}
- type = check_typedef (type);
- if (TYPE_CODE (type) == TYPE_CODE_REF)
- type = check_typedef (TYPE_TARGET_TYPE (type));
+ TRY_CATCH (except, RETURN_MASK_ALL)
+ {
+ type = check_typedef (type);
+ if (TYPE_CODE (type) == TYPE_CODE_REF)
+ type = check_typedef (TYPE_TARGET_TYPE (type));
+ }
+ GDB_PY_HANDLE_EXCEPTION (except);
/* We might not have DW_TAG_template_*, so try to parse the type's
name. This is inefficient if we do not have a template type --