]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ada-lang.c
Fix Ada "ptype" bug with array types
authorTom Tromey <tromey@adacore.com>
Wed, 13 Mar 2019 14:40:25 +0000 (08:40 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 18 Mar 2019 12:45:16 +0000 (06:45 -0600)
commitbff8c71fd8dece639e69b399883f90b3404a2a48
tree63f669a3e2568e89797dce78b3a2cf55098dcd35
parentaf60449c260235478f9b1f9db39a587fe4c75290
Fix Ada "ptype" bug with array types

Using ptype on an array type in Ada can sometimes show an incorrect
high bound.  This happens because ada_evaluate_subexp will create an
array with an incorrect upper bound in the EVAL_AVOID_SIDE_EFFECTS
case.

This patch fixes the problem by arranging to always create such an
array with valid bounds.

Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-03-18  Tom Tromey  <tromey@adacore.com>

* ada-lang.c (empty_array): Add "high" parameter.
(ada_evaluate_subexp): Update.

gdb/testsuite/ChangeLog
2019-03-18  Joel Brobecker  <brobecker@adacore.com>
    Tom Tromey  <tromey@adacore.com>

* gdb.ada/ptype_array/pck.adb: New file.
* gdb.ada/ptype_array/pck.ads: New file.
* gdb.ada/ptype_array/foo.adb: New file.
* gdb.ada/ptype_array.exp: New file.
gdb/ChangeLog
gdb/ada-lang.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/ptype_array.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/ptype_array/foo.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/ptype_array/pck.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/ptype_array/pck.ads [new file with mode: 0644]