]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ada-lang.c
[Ada] Full view of tagged type with ptype
authorJerome Guitton <guitton@adacore.com>
Wed, 12 Feb 2014 11:08:23 +0000 (12:08 +0100)
committerJoel Brobecker <brobecker@adacore.com>
Mon, 10 Mar 2014 13:40:35 +0000 (14:40 +0100)
commit5ec18f2b48ab74bbbaf436324ce3947df3bc048e
tree5f01e6d0aa8c860be1e8befb994d2b15ec8d415b
parent7d03f2eb64305b386f2ae8b733e0a2a143fd4ffd
[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.
gdb/ChangeLog
gdb/ada-lang.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/tagged_access.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/tagged_access/p.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/tagged_access/pack.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/tagged_access/pack.ads [new file with mode: 0644]