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/testsuite | |
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/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/m-static.exp | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 0af50b0..18512b9 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-02-07 Simon Marchi <simon.marchi@ericsson.com> + + * gdb.cp/m-static.exp: Check type of optimized out static + member. + 2018-02-03 Andrew Burgess <andrew.burgess@embecosm.com> * config/sid.exp (gdb_target_sid): Remove use of cleanup. diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp index 6566171..ffcbf53 100644 --- a/gdb/testsuite/gdb.cp/m-static.exp +++ b/gdb/testsuite/gdb.cp/m-static.exp @@ -165,6 +165,8 @@ if {[test_compiler_info {gcc-[0-3]-*}] setup_xfail *-*-* } gdb_test "print test4.nowhere" "<optimized out>" "static const int initialized nowhere (print field)" +gdb_test "ptype test4.nowhere" "type = const int" +gdb_test "print test4.nowhere.nowhere" "Attempt to extract a component of a value that is not a structure." # Same, but print the whole struct. gdb_test "print test4" "static nowhere = <optimized out>.*" "static const int initialized nowhere (whole struct)" |