aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-03-05 20:53:15 +0000
committerTom Tromey <tromey@redhat.com>2012-03-05 20:53:15 +0000
commit9f9f1f31e7b0df2da2fac6a8de06d9286f71f4d2 (patch)
tree698b637c0e8bef4bb35e77009177a91a29246f28 /gdb/value.c
parentb7b189f3cf682e67fb3ccd5908ec4b980735a620 (diff)
downloadgdb-9f9f1f31e7b0df2da2fac6a8de06d9286f71f4d2.zip
gdb-9f9f1f31e7b0df2da2fac6a8de06d9286f71f4d2.tar.gz
gdb-9f9f1f31e7b0df2da2fac6a8de06d9286f71f4d2.tar.bz2
* value.c (value_primitive_field): Don't fetch contents for
non-virtual bases.
Diffstat (limited to 'gdb/value.c')
-rw-r--r--gdb/value.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gdb/value.c b/gdb/value.c
index bee6907..e8eb33f 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2556,11 +2556,17 @@ value_primitive_field (struct value *arg1, int offset,
if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1))
value_fetch_lazy (arg1);
- boffset = baseclass_offset (arg_type, fieldno,
- value_contents (arg1),
- value_embedded_offset (arg1),
- value_address (arg1),
- arg1);
+ /* We special case virtual inheritance here because this
+ requires access to the contents, which we would rather avoid
+ for references to ordinary fields of unavailable values. */
+ if (BASETYPE_VIA_VIRTUAL (arg_type, fieldno))
+ boffset = baseclass_offset (arg_type, fieldno,
+ value_contents (arg1),
+ value_embedded_offset (arg1),
+ value_address (arg1),
+ arg1);
+ else
+ boffset = TYPE_FIELD_BITPOS (arg_type, fieldno) / 8;
if (value_lazy (arg1))
v = allocate_value_lazy (value_enclosing_type (arg1));