public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/7] Print field accessibility inline
Date: Thu, 21 Sep 2023 12:01:29 -0600	[thread overview]
Message-ID: <20230921-field-bits-v1-2-201285360900@adacore.com> (raw)
In-Reply-To: <20230921-field-bits-v1-0-201285360900@adacore.com>

This changes recursive_dump_type to print field accessibility
information "inline".  This is clearer and preserves the information
when the byte vectors are removed.
---
 gdb/gdbtypes.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 18aa8e5c29e..1aabb38fa5f 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -5289,12 +5289,21 @@ recursive_dump_type (struct type *type, int spaces)
 	gdb_printf ("%*s[%d] bitpos %s bitsize %d type ", spaces + 2, "",
 		    idx, plongest (type->field (idx).loc_bitpos ()),
 		    type->field (idx).bitsize ());
-      gdb_printf ("%s name '%s' (%s)\n",
+      gdb_printf ("%s name '%s' (%s)",
 		  host_address_to_string (type->field (idx).type ()),
 		  type->field (idx).name () != NULL
 		  ? type->field (idx).name ()
 		  : "<NULL>",
 		  host_address_to_string (type->field (idx).name ()));
+      if (TYPE_FIELD_VIRTUAL (type, idx))
+	gdb_printf (" virtual");
+      if (TYPE_FIELD_PRIVATE (type, idx))
+	gdb_printf (" private");
+      else if (TYPE_FIELD_PROTECTED (type, idx))
+	gdb_printf (" protected");
+      else if (TYPE_FIELD_IGNORE (type, idx))
+	gdb_printf (" ignored");
+      gdb_printf ("\n");
       if (type->field (idx).type () != NULL)
 	{
 	  recursive_dump_type (type->field (idx).type (), spaces + 4);

-- 
2.40.1


  parent reply	other threads:[~2023-09-21 18:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 18:01 [PATCH 0/7] Remove char-based bitfield macros Tom Tromey
2023-09-21 18:01 ` [PATCH 1/7] Use .def file to stringify type codes Tom Tromey
2023-09-25 21:58   ` Lancelot SIX
2023-09-26 13:10     ` Tom Tromey
2023-09-21 18:01 ` Tom Tromey [this message]
2023-09-21 18:01 ` [PATCH 3/7] Remove byte vectors from cplus_struct_type Tom Tromey
2023-09-25 22:32   ` Lancelot SIX
2023-10-27 14:20     ` Tom Tromey
2023-09-21 18:01 ` [PATCH 4/7] Add field::is_public Tom Tromey
2023-09-21 18:01 ` [PATCH 5/7] Remove some QUIT calls from need_access_label_p Tom Tromey
2023-09-21 18:01 ` [PATCH 6/7] Remove some type field accessor macros Tom Tromey
2023-09-21 18:01 ` [PATCH 7/7] Remove char-based bitfield macros Tom Tromey

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=20230921-field-bits-v1-2-201285360900@adacore.com \
    --to=tromey@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).