Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jerome Guitton <guitton@adacore.com>
To: gdb-patches@sourceware.org
Cc: Jerome Guitton <guitton@adacore.com>
Subject: [RFA/Ada 2/4] Strip interface tags from visible fields
Date: Thu, 29 Nov 2012 13:37:00 -0000	[thread overview]
Message-ID: <1354196235-8414-2-git-send-email-guitton@adacore.com> (raw)
In-Reply-To: <1354196235-8414-1-git-send-email-guitton@adacore.com>

The following Ada type:

   type Circle is new Shape and Drawable with record
        Center : Point;
        Radius : Natural;
   end record;

...is displayed as follow in GDB:

 (gdb) ptype circle
 type = new classes.shape with record
     V51s: ada.tags.interface_tag;
     center: classes.point;
     radius: natural;
 end record

V51s is an internal field that is of no interest for the user. It should
not be displayed.

gdb/ChangeLog:

	* ada-lang.c (ada_is_interface_tag): New function.
	(ada_is_ignored_field): Add interface tags to the list
	of ignored fields.

OK to apply?
---
 gdb/ada-lang.c |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index a34ba29..deefcfb 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -5937,6 +5937,19 @@ ada_is_dispatch_table_ptr_type (struct type *type)
   return (strcmp (name, "ada__tags__dispatch_table") == 0);
 }
 
+/* Return non-zero if TYPE is an interface tag.  */
+
+static int
+ada_is_interface_tag (struct type *type)
+{
+  const char *name = TYPE_NAME (type);
+
+  if (name == NULL)
+    return 0;
+
+  return (strcmp (name, "ada__tags__interface_tag") == 0);
+}
+
 /* True if field number FIELD_NUM in struct or union type TYPE is supposed
    to be invisible to users.  */
 
@@ -5967,9 +5980,11 @@ ada_is_ignored_field (struct type *type, int field_num)
       return 1;
   }
 
-  /* If this is the dispatch table of a tagged type, then ignore.  */
+  /* If this is the dispatch table of a tagged type or an interface tag,
+     then ignore.  */
   if (ada_is_tagged_type (type, 1)
-      && ada_is_dispatch_table_ptr_type (TYPE_FIELD_TYPE (type, field_num)))
+      && (ada_is_dispatch_table_ptr_type (TYPE_FIELD_TYPE (type, field_num))
+	  || ada_is_interface_tag (TYPE_FIELD_TYPE (type, field_num))))
     return 1;
 
   /* Not a special field, so it should not be ignored.  */
-- 
1.7.10.4


  parent reply	other threads:[~2012-11-29 13:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29 13:37 [RFA/Ada 1/4] Full view of interface-wide types Jerome Guitton
2012-11-29 13:37 ` [RFA/testsuite 3/4] New testcase for interface type printing Jerome Guitton
2012-11-29 14:20   ` Joel Brobecker
2012-11-29 13:37 ` Jerome Guitton [this message]
2012-11-29 14:20   ` [RFA/Ada 2/4] Strip interface tags from visible fields Joel Brobecker
2012-11-29 13:37 ` [RFA/testsuite 4/4] update ptype_tagged_param.exp Jerome Guitton
2012-11-29 14:22   ` Joel Brobecker
2012-11-29 16:36     ` Jerome Guitton
2012-11-29 14:20 ` [RFA/Ada 1/4] Full view of interface-wide types Joel Brobecker

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=1354196235-8414-2-git-send-email-guitton@adacore.com \
    --to=guitton@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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