aboutsummaryrefslogtreecommitdiff
path: root/gdb/cp-valprint.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-09-27 16:04:23 +0000
committerTom Tromey <tromey@redhat.com>2012-09-27 16:04:23 +0000
commit7977e5d2a6287c48bbfe41fdc5fc795b58e98dfe (patch)
treea3010f595c4802223eaaf34634ba36b76a153e77 /gdb/cp-valprint.c
parent807160da3c24f9a8adfb0c2b04352ab56ebc1d61 (diff)
downloadgdb-7977e5d2a6287c48bbfe41fdc5fc795b58e98dfe.zip
gdb-7977e5d2a6287c48bbfe41fdc5fc795b58e98dfe.tar.gz
gdb-7977e5d2a6287c48bbfe41fdc5fc795b58e98dfe.tar.bz2
Fix https://bugzilla.redhat.com/show_bug.cgi?id=849357
* cp-valprint.c (cp_print_value_fields): Use get_vptr_fieldno. gdb/testsuite * gdb.cp/derivation.exp: Add regression test. * gdb.cp/derivation.cc (class V_base, class V_inter, class V_derived): New. (vderived): New global.
Diffstat (limited to 'gdb/cp-valprint.c')
-rw-r--r--gdb/cp-valprint.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index c066aa5..e6a99ec 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -210,7 +210,9 @@ cp_print_value_fields (struct type *type, struct type *real_type,
{
int statmem_obstack_initial_size = 0;
int stat_array_obstack_initial_size = 0;
-
+ struct type *vptr_basetype = NULL;
+ int vptr_fieldno;
+
if (dont_print_statmem == 0)
{
statmem_obstack_initial_size =
@@ -225,6 +227,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
}
}
+ vptr_fieldno = get_vptr_fieldno (type, &vptr_basetype);
for (i = n_baseclasses; i < len; i++)
{
/* If requested, skip printing of static fields. */
@@ -358,7 +361,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
v, stream, recurse + 1,
options);
}
- else if (i == TYPE_VPTR_FIELDNO (type))
+ else if (i == vptr_fieldno && type == vptr_basetype)
{
int i_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
struct type *i_type = TYPE_FIELD_TYPE (type, i);