Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/3] gdb: print compunit_symtab name in "maint info symtabs"
Date: Thu, 31 Mar 2022 17:20:18 -0400	[thread overview]
Message-ID: <20220331212019.2811099-2-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20220331212019.2811099-1-simon.marchi@polymtl.ca>

I think it would make sense to print a compunit_symtab's name in "maint
info symtabs".  If you are looking for a given CU in the list, that's
probably the field you will be looking at.  As the doc of
compunit_symtab::name says, it is not meant to be a reliable file name,
it is for debugging purposes (and "maint info symtabs" exists for
debugging purposes).

Sample output with the new field:

    (gdb) maintenance info symtabs
    { objfile /home/simark/build/binutils-gdb-one-target/gdb/a.out ((struct objfile *) 0x613000005d00)
      { ((struct compunit_symtab *) 0x621000131630)
        debugformat DWARF 5
        producer GNU C17 11.2.0 -mtune=generic -march=x86-64 -g3 -O0
        name test.c
        dirname /home/simark/build/binutils-gdb-one-target/gdb
        blockvector ((struct blockvector *) 0x621000131d10)
        user ((struct compunit_symtab *) (null))
            { symtab test.c ((struct symtab *) 0x6210001316b0)
              fullname (null)
              linetable ((struct linetable *) 0x621000131d40)
            }
            { symtab /home/simark/build/binutils-gdb-one-target/gdb/test.h ((struct symtab *) 0x6210001316e0)
              fullname (null)
              linetable ((struct linetable *) 0x0)
            }
            { symtab /usr/include/stdc-predef.h ((struct symtab *) 0x621000131710)
              fullname (null)
              linetable ((struct linetable *) 0x0)
            }
      }
      { ((struct compunit_symtab *) 0x6210001170a0)
        debugformat DWARF 5
        producer GNU C17 11.2.0 -mtune=generic -march=x86-64 -g3 -O0
        name foo.c
        dirname /home/simark/build/binutils-gdb-one-target/gdb
        blockvector ((struct blockvector *) 0x621000131580)
        user ((struct compunit_symtab *) (null))
            { symtab foo.c ((struct symtab *) 0x621000117120)
              fullname (null)
              linetable ((struct linetable *) 0x6210001315b0)
            }
            { symtab /usr/include/stdc-predef.h ((struct symtab *) 0x621000117150)
              fullname (null)
              linetable ((struct linetable *) 0x0)
            }
      }
    }

Change-Id: I17b87adfac2f6551cb5bda30d59f6c6882789211
---
 gdb/symmisc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 37ecc8064da5..d33ea0fed9a4 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -781,6 +781,7 @@ maintenance_info_symtabs (const char *regexp, int from_tty)
 			gdb_printf ("    producer %s\n",
 				    (cust->producer () != nullptr
 				     ? cust->producer () : "(null)"));
+			gdb_printf ("    name %s\n", cust->name);
 			gdb_printf ("    dirname %s\n",
 				    (cust->dirname () != NULL
 				     ? cust->dirname () : "(null)"));
-- 
2.35.1


  reply	other threads:[~2022-03-31 21:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 21:20 [PATCH 1/3] gdb/ctf: don't create a buildsym_compunit when building partial symbols Simon Marchi via Gdb-patches
2022-03-31 21:20 ` Simon Marchi via Gdb-patches [this message]
2022-03-31 21:20 ` [PATCH 3/3] gdb/ctf: pass partial symtab's filename to buildsym_compunit Simon Marchi via Gdb-patches
2022-04-01  0:07   ` Wei-min Pan via Gdb-patches
2022-03-31 23:56 ` [PATCH 1/3] gdb/ctf: don't create a buildsym_compunit when building partial symbols Wei-min Pan via Gdb-patches
2022-04-01  0:14   ` Simon Marchi via Gdb-patches
2022-04-01  0:57     ` Wei-min Pan via Gdb-patches
2022-04-01  1:32       ` Simon Marchi via Gdb-patches
2022-04-04 17:08 ` 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=20220331212019.2811099-2-simon.marchi@polymtl.ca \
    --to=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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