Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pawel Wodkowski <pwodkowski@pl.sii.eu>
To: gdb-patches@sourceware.org,	murbanski@pl.sii.eu,	sbasierski@pl.sii.eu
Cc: tim.wiederhake@intel.com,	dragos.carciumaru@intel.com,
	Bernhard Heckel <bernhard.heckel@intel.com>
Subject: [PATCH v2 4/7] Fortran: Ptype, print type extension.
Date: Mon, 19 Nov 2018 21:40:00 -0000	[thread overview]
Message-ID: <1542663530-140490-4-git-send-email-pwodkowski@pl.sii.eu> (raw)
In-Reply-To: <1542663530-140490-1-git-send-email-pwodkowski@pl.sii.eu>

From: Bernhard Heckel <bernhard.heckel@intel.com>

Print base-class of an extended type when doing a ptype.

2016-05-24 Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Changelog:
	* gdb/f-typeprint.c (f_type_print_derivation_info): New.
	(f_type_print_base): Print baseclass info.

Changes from V1 to V2:
	clear commit message.
---
 gdb/f-typeprint.c | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 3f13c111ac56..133eaf9b9848 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -256,6 +256,25 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
     }
 }
 
+/* If TYPE is an extended type, then print out derivation information.
+
+   A typical output could look like this:
+   "Type, extends(point) :: waypoint"
+   "    Type point :: point"
+   "    real(kind=4) :: angle"
+   "End Type waypoint"
+ */
+
+static void
+f_type_print_derivation_info (struct type *type, struct ui_file *stream)
+{
+  /* Fortran doesn't support multiple inheritance. */
+  int i = 0;
+
+  if (TYPE_N_BASECLASSES (type) > 0)
+    fprintf_filtered (stream, ", extends(%s) ::", TYPE_NAME (TYPE_BASECLASS (type, i)));
+}
+
 /* Print the name of the type (or the ultimate pointer target,
    function value or array element), or the description of a
    structure or union.
@@ -372,10 +391,15 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
     case TYPE_CODE_STRUCT:
     case TYPE_CODE_UNION:
       if (TYPE_CODE (type) == TYPE_CODE_UNION)
-	fprintfi_filtered (level, stream, "Type, C_Union :: ");
+	fprintfi_filtered (level, stream, "Type, C_Union ::");
       else
-	fprintfi_filtered (level, stream, "Type ");
-      fputs_filtered (TYPE_NAME (type), stream);
+	fprintfi_filtered (level, stream, "Type");
+
+      if (show > 0)
+	f_type_print_derivation_info (type, stream);
+
+      fprintf_filtered (stream, " %s", TYPE_NAME (type));
+
       /* According to the definition,
          we only print structure elements in case show > 0.  */
       if (show > 0)
-- 
2.7.4


  parent reply	other threads:[~2018-11-19 21:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-19 21:40 [PATCH v2 1/7] DWARF: Don't add nameless modules to partial symbol table Pawel Wodkowski
2018-11-19 21:40 ` [PATCH v2 3/7] Fortran: Accessing fields of inherited types via fully qualified name Pawel Wodkowski
     [not found]   ` <88ec6786-8834-7da2-207a-7392fd657e41@arm.com>
     [not found]     ` <53cac622aea64147b2c1cd25feb16bdd@pl.sii.eu>
2018-12-06 15:03       ` Richard Bunt
2018-12-09 20:41         ` Paweł Wódkowski
2019-01-16 11:11           ` Richard Bunt
2019-01-18  8:33             ` Paweł Wódkowski
     [not found]               ` <9c1d974d-d5f3-93f7-12b0-0c95ac264cde@arm.com>
2019-02-06 12:39                 ` Paweł Wódkowski
2018-11-19 21:40 ` [PATCH v2 6/7] Fortran: Nested functions, add scope parameter Pawel Wodkowski
2018-11-19 21:40 ` [PATCH v2 7/7] Fortran: Document scope operator Pawel Wodkowski
2018-11-20  5:01   ` Eli Zaretskii
2018-11-22 16:14     ` Paweł Wódkowski
2018-11-23 10:31       ` Eli Zaretskii
2018-11-19 21:40 ` Pawel Wodkowski [this message]
2019-02-01 13:06   ` [PATCH v2 4/7] Fortran: Ptype, print type extension Andrew Burgess
2018-11-19 21:40 ` [PATCH v2 2/7] Dwarf: Fortran, support DW_TAG_entry_point Pawel Wodkowski
2018-11-27 22:09   ` Andrew Burgess
2018-12-02 21:32     ` Paweł Wódkowski
2018-11-19 21:40 ` [PATCH v2 5/7] Fortran: Enable setting breakpoint on nested functions Pawel Wodkowski
2018-11-28 10:32   ` Richard Bunt
2018-12-02 22:16     ` Paweł Wódkowski
2018-11-27 19:35 ` PING Re: [PATCH v2 1/7] DWARF: Don't add nameless modules to partial symbol table Pawel Wodkowski
2018-11-27 20:29 ` Simon Marchi
2018-11-27 21:42 ` Andrew Burgess
2018-12-02 21:01   ` Paweł Wódkowski

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=1542663530-140490-4-git-send-email-pwodkowski@pl.sii.eu \
    --to=pwodkowski@pl.sii.eu \
    --cc=bernhard.heckel@intel.com \
    --cc=dragos.carciumaru@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=murbanski@pl.sii.eu \
    --cc=sbasierski@pl.sii.eu \
    --cc=tim.wiederhake@intel.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