diff options
author | Simon Marchi <simark@simark.ca> | 2018-02-07 08:48:14 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2018-02-07 08:49:56 -0500 |
commit | c2e0e465f9488970c7e460a41e3fb7c366530619 (patch) | |
tree | 00cfae01e81e136757a6d03ff938de392d073f29 /gdb/value.c | |
parent | 407aa07cee4d075c8e7996a5e994c02e76f19276 (diff) | |
download | gdb-c2e0e465f9488970c7e460a41e3fb7c366530619.zip gdb-c2e0e465f9488970c7e460a41e3fb7c366530619.tar.gz gdb-c2e0e465f9488970c7e460a41e3fb7c366530619.tar.bz2 |
Fix type of values representing optimized out static members
As reported here:
https://sourceware.org/ml/gdb/2018-02/msg00019.html
the type of values representing static members that are optimized out is
wrong. It currently assigns the type of the containing class rather
than the type of the field. This patch fixes that.
I found a place in m-static.exp already dealing with optimized out
static members, so I just added some gdb_test there.
gdb/ChangeLog:
* value.c (value_static_field): Assign field type instead of
containing type when returning an optimized out value.
gdb/testsuite/ChangeLog:
* gdb.cp/m-static.exp: Check type of optimized out static
member.
Diffstat (limited to 'gdb/value.c')
-rw-r--r-- | gdb/value.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gdb/value.c b/gdb/value.c index 9a144fb..9cd9a2f 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2976,14 +2976,12 @@ value_static_field (struct type *type, int fieldno) reported as non-debuggable symbols. */ struct bound_minimal_symbol msym = lookup_minimal_symbol (phys_name, NULL, NULL); + struct type *field_type = TYPE_FIELD_TYPE (type, fieldno); if (!msym.minsym) - return allocate_optimized_out_value (type); + retval = allocate_optimized_out_value (field_type); else - { - retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno), - BMSYMBOL_VALUE_ADDRESS (msym)); - } + retval = value_at_lazy (field_type, BMSYMBOL_VALUE_ADDRESS (msym)); } else retval = value_of_variable (sym.symbol, sym.block); |