This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/4] Fortran, typeprint: Fix wrong indentation when ptype nested structures.
- From: Bernhard Heckel <bernhard dot heckel at intel dot com>
- To: qiyaoltc at gmail dot com
- Cc: gdb-patches at sourceware dot org, Bernhard Heckel <bernhard dot heckel at intel dot com>
- Date: Tue, 10 May 2016 16:15:36 +0200
- Subject: [PATCH 1/4] Fortran, typeprint: Fix wrong indentation when ptype nested structures.
- Authentication-results: sourceware.org; auth=none
- References: <1462889739-30359-1-git-send-email-bernhard dot heckel at intel dot com>
Level of indentation was not proper handled when printing
the elements type's name.
Before:
type = Type t1
integer(kind=4) :: var_1
integer(kind=4) :: var_2
End Type t1
After:
type = Type t1
integer(kind=4) :: var_1
integer(kind=4) :: var_2
End Type t1
2016-03-18 Bernhard Heckel <bernhard.heckel@intel.com>
gdb/Changelog:
* f-typeprint.c (f_type_print_base): Take print level into account.
gdb/testsuite/Changelog:
* print_type.exp: Fix expected output.
---
gdb/f-typeprint.c | 2 +-
gdb/testsuite/gdb.fortran/whatis_type.exp | 26 ++++++++++++++++++--------
2 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 32989d4..1990e1b 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -288,7 +288,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
if ((show <= 0) && (TYPE_NAME (type) != NULL))
{
- fputs_filtered (TYPE_NAME (type), stream);
+ fprintfi_filtered (level, stream, "%s", TYPE_NAME (type));
return;
}
diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
index af897a6..edaf4fd 100644
--- a/gdb/testsuite/gdb.fortran/whatis_type.exp
+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
@@ -39,15 +39,25 @@ set t1_i "$int :: t1_i"
set t1_r "$real :: t1_r"
gdb_test "whatis t1" \
- "type = Type t1\r\n${t1_i}\r\n${t1_r}\r\nEnd Type t1" \
- "whatis t1"
+ [multi_line "type = Type t1" \
+ " $t1_i" \
+ " $t1_r" \
+ "End Type t1"]
+
gdb_test "whatis t1v" \
- "type = Type t1\r\n${t1_i}\r\n${t1_r}\r\nEnd Type t1" \
- "whatis t1v"
+ [multi_line "type = Type t1" \
+ " $t1_i" \
+ " $t1_r" \
+ "End Type t1"]
gdb_test "ptype t1" \
- "type = Type t1\r\n ${t1_i}\r\n ${t1_r}\r\nEnd Type t1" \
- "ptype t1"
+ [multi_line "type = Type t1" \
+ " $t1_i" \
+ " $t1_r" \
+ "End Type t1"]
+
gdb_test "ptype t1v" \
- "type = Type t1\r\n ${t1_i}\r\n ${t1_r}\r\nEnd Type t1" \
- "ptype t1v"
+ [multi_line "type = Type t1" \
+ " $t1_i" \
+ " $t1_r" \
+ "End Type t1"]
--
2.7.1.339.g0233b80