diff options
author | Bernhard Heckel <bernhard.heckel@intel.com> | 2016-05-25 08:47:17 +0200 |
---|---|---|
committer | Bernhard Heckel <bernhard.heckel@intel.com> | 2016-05-25 08:47:17 +0200 |
commit | 9b2db1fd27cea1323a7ae0beb9399c8e1c4a3741 (patch) | |
tree | 2017d76cdbef6b02c0f71e4ff3f6a14ea4f74825 | |
parent | 72b1705502a891e07d40ad215146c71193920801 (diff) | |
download | gdb-9b2db1fd27cea1323a7ae0beb9399c8e1c4a3741.zip gdb-9b2db1fd27cea1323a7ae0beb9399c8e1c4a3741.tar.gz gdb-9b2db1fd27cea1323a7ae0beb9399c8e1c4a3741.tar.bz2 |
Fortran, typeprint: Take level of details into account when printing elements of a structure.
According to the typeprint's description, elements of a structure
should not be printed when show is < 1.
This variable is also used to distinguish the level of details
between "ptype" and "whatis" expressions.
Before:
(gdb) whatis t1v
type = Type t1
integer(kind=4) :: t1_i
real(kind=4) :: t1_r
End Type t1
After:
(gdb) whatis t1v
type = Type t1
2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com>
gdb/Changelog:
* f-typeprint.c (f_type_print_base): Don't print fields when show < 0.
gdb/testsuite/Changelog:
* gdb.fortran/whatis_type.exp: Adapt expected output.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/f-typeprint.c | 27 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.fortran/whatis_type.exp | 14 |
4 files changed, 26 insertions, 23 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cba01ef..a4989dd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com> + * f-typeprint.c (f_type_print_base): Don't print fields when show < 0. + +2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com> + * f-typeprint.c (f_type_print_base): Take print level into account. 2016-05-24 Tom Tromey <tom@tromey.com> diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index 1990e1b..f38a3a0 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -364,19 +364,24 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show, else fprintfi_filtered (level, stream, "Type "); fputs_filtered (TYPE_TAG_NAME (type), stream); - fputs_filtered ("\n", stream); - for (index = 0; index < TYPE_NFIELDS (type); index++) + /* According to the definition, + we only print structure elements in case show > 0. */ + if (show > 0) { - f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, show, - level + 4); - fputs_filtered (" :: ", stream); - fputs_filtered (TYPE_FIELD_NAME (type, index), stream); - f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index), - stream, 0, 0, 0, 0); fputs_filtered ("\n", stream); - } - fprintfi_filtered (level, stream, "End Type "); - fputs_filtered (TYPE_TAG_NAME (type), stream); + for (index = 0; index < TYPE_NFIELDS (type); index++) + { + f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, show, + level + 4); + fputs_filtered (" :: ", stream); + fputs_filtered (TYPE_FIELD_NAME (type, index), stream); + f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index), + stream, 0, 0, 0, 0); + fputs_filtered ("\n", stream); + } + fprintfi_filtered (level, stream, "End Type "); + fputs_filtered (TYPE_TAG_NAME (type), stream); + } break; case TYPE_CODE_MODULE: diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 2b05192..712ee2f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com> + * gdb.fortran/whatis_type.exp: Adapt expected output. + +2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com> + * gdb.fortran/print_type.exp: Fix expected output. * gdb.fortran/whatis_type.exp: Fix expected output. diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp index 7265923..0b7a1b7 100644 --- a/gdb/testsuite/gdb.fortran/whatis_type.exp +++ b/gdb/testsuite/gdb.fortran/whatis_type.exp @@ -38,18 +38,8 @@ gdb_continue_to_breakpoint "bp1" set t1_i "$int :: t1_i" set t1_r "$real :: t1_r" -gdb_test "whatis t1" \ - [multi_line "type = Type t1" \ - " $t1_i" \ - " $t1_r" \ - "End Type t1"] \ - "whatis t1" -gdb_test "whatis t1v" \ - [multi_line "type = Type t1" \ - " $t1_i" \ - " $t1_r" \ - "End Type t1"] \ - "whatis t1v" +gdb_test "whatis t1" "type = Type t1" +gdb_test "whatis t1v" "type = Type t1" gdb_test "ptype t1" \ [multi_line "type = Type t1" \ |