diff options
author | Jerome Guitton <guitton@adacore.com> | 2014-02-12 12:08:23 +0100 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2014-03-10 14:40:35 +0100 |
commit | 5ec18f2b48ab74bbbaf436324ce3947df3bc048e (patch) | |
tree | 5f01e6d0aa8c860be1e8befb994d2b15ec8d415b /gdb/testsuite/gdb.ada/tagged_access.exp | |
parent | 7d03f2eb64305b386f2ae8b733e0a2a143fd4ffd (diff) |
[Ada] Full view of tagged type with ptype
When evaluating an expression, if it is of a tagged type, GDB reads
the tag in memory and deduces the full view. At parsing time, however,
this operation is done only in the case of OP_VAR_VALUE. ptype does
not go through a full evaluation of expressions so it may return some
odd results:
(gdb) print c.menu_name
$1 = 0x0
(gdb) ptype $
type = system.strings.string_access
(gdb) ptype c.menu_name
type = <void>
This change removes this peculiarity by extending the tag resolution
to UNOP_IND and STRUCTOP_STRUCT. As in the case of OP_VAR_VALUE, this
implies switching from EVAL_AVOID_SIDE_EFFECTS to EVAL_NORMAL when a
tagged type is dereferenced.
gdb/
* ada-lang.c (ada_evaluate_subexp): Resolve tagged types to
full view in the case of UNOP_IND and STRUCTOP_STRUCT.
gdb/testsuite/
* gdb.ada/tagged_access: New testcase.
Diffstat (limited to 'gdb/testsuite/gdb.ada/tagged_access.exp')
-rw-r--r-- | gdb/testsuite/gdb.ada/tagged_access.exp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.ada/tagged_access.exp b/gdb/testsuite/gdb.ada/tagged_access.exp new file mode 100644 index 0000000000..c5832e8f0a --- /dev/null +++ b/gdb/testsuite/gdb.ada/tagged_access.exp @@ -0,0 +1,33 @@ +# Copyright 2014 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +load_lib "ada.exp" + +standard_ada_testfile p + +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } { + return -1 +} + +clean_restart ${testfile} + +set bp_location [gdb_get_line_number "BREAK" ${testdir}/p.adb] +runto "p.adb:$bp_location" + +gdb_test "ptype c.all" \ + " = new pack\\.interactive_command with record\r\n\\s+menu_name: pack\\.string_access;\r\nend record" + +gdb_test "ptype c.menu_name" \ + " = access array \\(<>\\) of character" |