]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ada-lang.c
[Ada] whatis not printing array type name for value from history
authorJoel Brobecker <brobecker@gnat.com>
Wed, 29 Feb 2012 19:29:12 +0000 (19:29 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Wed, 29 Feb 2012 19:29:12 +0000 (19:29 +0000)
commit2e6fda7d06e4fa05ef3abdde96805a5cb3880f88
tree9af52ae865a0a9a3a31da59caf95a5c4856c793f
parent5845583db6762360b24e6b205d0e1c84a125c036
[Ada] whatis not printing array type name for value from history

Consider the following declaration:

   type Full_Table is array (Color) of Integer;
   Full : Full_Table := (144, 233, 377, 610, 987);

The debugger correctly prints the type name of variable "full":

        (gdb) whatis full
        type = pck.full_table

But is unable to do so when using the value history:

        (gdb) print full
        $1 = (144, 233, 377, 610, 987)
        (gdb) whatis $
 !!! -> type = array (black .. white) of integer

This is because the evaluation creates a "fixed" version of
the array type, and that "fixed" version is missing a type name.
As a result, whatis falls back to describing the type (a la ptype)
instead of printing the type name.

gdb/ChangeLog:

        * ada-lang.c (to_fixed_array_type): Set result's type name.

gdb/testsuite/ChangeLog:

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