public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@seketeli.org>
To: libabigail@sourceware.org
Subject: [PATCH, applied] ir: Improve get_debug_representation
Date: Mon, 19 Dec 2022 17:21:56 +0100	[thread overview]
Message-ID: <875ye7fjob.fsf@seketeli.org> (raw)

Hello,

While looking at something else, I noticed that the debug() function,
very useful which debugging (using GDB at least) could be improved for
classes/unions by prefixing the type name with struct/class/union as
appropriate.

Fixed thus.

	* src/abg-ir.cc (get_debug_representation): Prefix
	classes/structs/unions with the 'classes/struct/union' prefix.

Signed-off-by: Dodji Seketeli <dodji@seketeli.org>
---
 src/abg-ir.cc | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 0f8c1d2b..85b5cbb3 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -9303,6 +9303,15 @@ get_debug_representation(const type_or_decl_base* artifact)
       class_decl *clazz = is_class_type(c);
       string name = c->get_qualified_name();
       std::ostringstream o;
+      if (clazz)
+	{
+	  if (clazz->is_struct())
+	    o << "struct ";
+	  else
+	    o << "class ";
+	}
+      else if (is_union_type(c))
+	o << "union ";
       o << name;
 
       if (clazz)
@@ -9362,7 +9371,7 @@ get_debug_representation(const type_or_decl_base* artifact)
     {
       string name = e->get_qualified_name();
       std::ostringstream o;
-      o << name
+      o << "union " << name
 	<< " : "
 	<< e->get_underlying_type()->get_pretty_representation(/*internal=*/false,
 							       true)
-- 
2.31.1


-- 
		Dodji

                 reply	other threads:[~2022-12-19 16:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=875ye7fjob.fsf@seketeli.org \
    --to=dodji@seketeli.org \
    --cc=libabigail@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).