diff options
author | Joel Brobecker <brobecker@gnat.com> | 2012-02-29 19:29:12 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2012-02-29 19:29:12 +0000 |
commit | 2e6fda7d06e4fa05ef3abdde96805a5cb3880f88 (patch) | |
tree | 9af52ae865a0a9a3a31da59caf95a5c4856c793f /gdb/ada-lang.c | |
parent | 5845583db6762360b24e6b205d0e1c84a125c036 (diff) | |
download | gdb-2e6fda7d06e4fa05ef3abdde96805a5cb3880f88.zip gdb-2e6fda7d06e4fa05ef3abdde96805a5cb3880f88.tar.gz gdb-2e6fda7d06e4fa05ef3abdde96805a5cb3880f88.tar.bz2 |
[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.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 216f703..7c13910 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -7826,6 +7826,11 @@ to_fixed_array_type (struct type *type0, struct value *dval, error (_("array type with dynamic size is larger than varsize-limit")); } + /* We want to preserve the type name. This can be useful when + trying to get the type name of a value that has already been + printed (for instance, if the user did "print VAR; whatis $". */ + TYPE_NAME (result) = TYPE_NAME (type0); + if (constrained_packed_array_p) { /* So far, the resulting type has been created as if the original |