From: Simon Marchi Date: Thu, 31 Mar 2022 21:20:18 +0000 (-0400) Subject: gdb: print compunit_symtab name in "maint info symtabs" X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=af7047e8589d198229f6f657c3bef04969036d21;p=binutils-gdb.git gdb: print compunit_symtab name in "maint info symtabs" 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 --- diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 37ecc8064da..d33ea0fed9a 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)"));