From: Tom Tromey Date: Mon, 5 Mar 2012 20:53:15 +0000 (+0000) Subject: * value.c (value_primitive_field): Don't fetch contents for X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9f9f1f31e7b0df2da2fac6a8de06d9286f71f4d2;p=binutils-gdb.git * value.c (value_primitive_field): Don't fetch contents for non-virtual bases. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2def55d8833..65ba222512d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2012-03-05 Tom Tromey + + * value.c (value_primitive_field): Don't fetch contents for + non-virtual bases. + 2012-03-05 Tom Tromey * jv-valprint.c (java_value_print): Correctly compute 'obj_addr'. diff --git a/gdb/value.c b/gdb/value.c index bee69074130..e8eb33f3400 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));