Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Bernhard Heckel <bernhard.heckel@intel.com>
To: qiyaoltc@gmail.com
Cc: gdb-patches@sourceware.org, Bernhard Heckel <bernhard.heckel@intel.com>
Subject: [PATCH 1/4] Fortran, typeprint: Fix wrong indentation when ptype nested structures.
Date: Tue, 10 May 2016 14:16:00 -0000	[thread overview]
Message-ID: <1462889739-30359-2-git-send-email-bernhard.heckel@intel.com> (raw)
In-Reply-To: <1462889739-30359-1-git-send-email-bernhard.heckel@intel.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


  parent reply	other threads:[~2016-05-10 14:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-10 14:16 [PATCH 0/4] Fortran, typeprint Bernhard Heckel
2016-05-10 14:16 ` [PATCH 3/4] Fortran, typeprint: Decrease level of details when printing elements of a structure Bernhard Heckel
2016-05-11 13:40   ` Yao Qi
2016-05-12  8:00     ` Bernhard Heckel
2016-05-10 14:16 ` Bernhard Heckel [this message]
2016-05-11 11:58   ` [PATCH 1/4] Fortran, typeprint: Fix wrong indentation when ptype nested structures Yao Qi
2016-05-11 11:59   ` Yao Qi
2016-05-10 14:16 ` [PATCH 2/4] Fortran, typeprint: Take level of details into account when printing elements of a structure Bernhard Heckel
2016-05-11 12:09   ` Yao Qi
2016-05-12 12:06   ` Yao Qi
2016-05-12 12:42     ` Bernhard Heckel
2016-05-10 14:18 ` [PATCH 4/4] Fortran, typeprint: Forward level of details to be printed for pointers Bernhard Heckel
2016-05-11 13:42   ` Yao Qi
2016-05-13 14:27   ` Yao Qi
2016-05-13 15:55     ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462889739-30359-2-git-send-email-bernhard.heckel@intel.com \
    --to=bernhard.heckel@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox