summaryrefslogtreecommitdiff
path: root/gdb/c-typeprint.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2009-11-12 19:47:25 +0000
committerDaniel Jacobowitz <dan@debian.org>2009-11-12 19:47:25 +0000
commitda0b671558797a37fd5fe56eed3565f025e1d829 (patch)
tree0d2e1e7578fd9bee3d5307bf916ae507bff7a504 /gdb/c-typeprint.c
parent6296b19edda193fc58dd7db7ad6d3ca2b6e7f4e9 (diff)
downloadgdb-da0b671558797a37fd5fe56eed3565f025e1d829.tar.gz
2009-11-12 Daniel Jacobowitz <dan@codesourcery.com>
Paul Brook <paul@codesourcery.com> * c-typeprint.c (c_type_print_base): Skip artificial fields. Use get_vptr_fieldno to skip the vtable pointer. * dwarf2read.c (dwarf2_add_field): Set FIELD_ARTIFICIAL on artificial fields. (dwarf2_add_member_fn): Complain about virtual member functions without DW_AT_vtable_elem_location and force TYPE_CPLUS_DYNAMIC. * gdbtypes.c (get_vptr_fieldno): Update comment. * gdbtypes.h (struct cplus_struct_type): Add is_dynamic. (TYPE_CPLUS_DYNAMIC): New macro. * gnu-v3-abi.c (gnuv3_dynamic_class): New. (gnuv3_get_vtable): Rewrite to use gnuv3_dynamic_class. Move higher. (gnuv3_rtti_type, gnuv3_get_virtual_fn, gnuv3_baseclass_offset): Use gnuv3_get_vtable. * varobj.c (cplus_class_num_children, cplus_describe_child): Skip artificial fields. Use get_vptr_fieldno to skip the vtable pointer.
Diffstat (limited to 'gdb/c-typeprint.c')
-rw-r--r--gdb/c-typeprint.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 807eec16781..a984e3ffcca 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -761,6 +761,9 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
}
else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
{
+ struct type *basetype;
+ int vptr_fieldno;
+
cp_type_print_derivation_info (stream, type);
fprintf_filtered (stream, "{\n");
@@ -848,12 +851,16 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
do not print the field that it occupies. */
len = TYPE_NFIELDS (type);
+ vptr_fieldno = get_vptr_fieldno (type, &basetype);
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
{
QUIT;
- /* Don't print out virtual function table. */
- if (strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5) == 0
- && is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5]))
+
+ /* If we have a virtual table pointer, omit it. Even if
+ virtual table pointers are not specifically marked in
+ the debug info, they should be artificial. */
+ if ((type == basetype && i == vptr_fieldno)
+ || TYPE_FIELD_ARTIFICIAL (type, i))
continue;
/* If this is a C++ class we can print the various C++ section