public inbox for gdb-testers@sourceware.org help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Subject: [binutils-gdb] [gdb] Print user/includes fields for maint commands Date: Wed, 08 Apr 2020 02:42:11 -0400 [thread overview] Message-ID: <7b1eff95bed765cb20dd3168cb99896a91fcdca7@gdb-build> (raw) *** TEST RESULTS FOR COMMIT 7b1eff95bed765cb20dd3168cb99896a91fcdca7 *** commit 7b1eff95bed765cb20dd3168cb99896a91fcdca7 Author: Tom de Vries <tdevries@suse.de> AuthorDate: Wed Mar 25 12:38:05 2020 +0100 Commit: Tom de Vries <tdevries@suse.de> CommitDate: Wed Mar 25 12:38:05 2020 +0100 [gdb] Print user/includes fields for maint commands The type struct compunit_symtab contains two fields (disregarding field next) that express relations with other compunit_symtabs: user and includes. These fields are currently not printed with "maint info symtabs" and "maint print symbols". Fix this such that for "maint info symtabs" we print: ... { ((struct compunit_symtab *) 0x23e8450) debugformat DWARF 2 producer (null) dirname (null) blockvector ((struct blockvector *) 0x23e8590) + user ((struct compunit_symtab *) 0x2336280) + ( includes + ((struct compunit_symtab *) 0x23e85e0) + ((struct compunit_symtab *) 0x23e8960) + ) { symtab <unknown> ((struct symtab *) 0x23e85b0) fullname (null) linetable ((struct linetable *) 0x0) } } ... And for "maint print symbols" we print: ... -Symtab for file <unknown> +Symtab for file <unknown> at 0x23e85b0 Read from object file /data/gdb_versions/devel/a.out (0x233ccf0) Language: c Blockvector: block #000, object at 0x23e8530, 0 syms/buckets in 0x0..0x0 block #001, object at 0x23e84d0 under 0x23e8530, 0 syms/buckets in 0x0..0x0 +Compunit user: 0x2336300 +Compunit include: 0x23e8900 +Compunit include: 0x23dd970 ... Note: for user and includes we don't list the actual compunit_symtab address, but instead the corresponding symtab address, which allows us to find that symtab elsewhere in the output (given that we also now print the address of symtabs). gdb/ChangeLog: 2020-03-25 Tom de Vries <tdevries@suse.de> * symtab.h (is_main_symtab_of_compunit_symtab): New function. * symmisc.c (dump_symtab_1): Print user and includes fields. (maintenance_info_symtabs): Same. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7d627b55ad..f5e54f6d65 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2020-03-25 Tom de Vries <tdevries@suse.de> + + * symtab.h (is_main_symtab_of_compunit_symtab): New function. + * symmisc.c (dump_symtab_1): Print user and includes fields. + (maintenance_info_symtabs): Same. + 2020-03-25 Andrew Burgess <andrew.burgess@embecosm.com> PR gdb/25534 diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 3df526bddb..bee136ed46 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -279,8 +279,10 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile) const struct block *b; int depth; - fprintf_filtered (outfile, "\nSymtab for file %s\n", - symtab_to_filename_for_display (symtab)); + fprintf_filtered (outfile, "\nSymtab for file %s at %s\n", + symtab_to_filename_for_display (symtab), + host_address_to_string (symtab)); + if (SYMTAB_DIRNAME (symtab) != NULL) fprintf_filtered (outfile, "Compilation directory is %s\n", SYMTAB_DIRNAME (symtab)); @@ -308,7 +310,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile) } /* Now print the block info, but only for compunit symtabs since we will print lots of duplicate info otherwise. */ - if (symtab == COMPUNIT_FILETABS (SYMTAB_COMPUNIT (symtab))) + if (is_main_symtab_of_compunit_symtab (symtab)) { fprintf_filtered (outfile, "\nBlockvector:\n\n"); bv = SYMTAB_BLOCKVECTOR (symtab); @@ -371,6 +373,30 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile) "\nBlockvector same as owning compunit: %s\n\n", compunit_filename); } + + /* Print info about the user of this compunit_symtab, and the + compunit_symtabs included by this one. */ + if (is_main_symtab_of_compunit_symtab (symtab)) + { + struct compunit_symtab *cust = SYMTAB_COMPUNIT (symtab); + + if (cust->user != nullptr) + { + const char *addr + = host_address_to_string (COMPUNIT_FILETABS (cust->user)); + fprintf_filtered (outfile, "Compunit user: %s\n", addr); + } + if (cust->includes != nullptr) + for (i = 0; ; ++i) + { + struct compunit_symtab *include = cust->includes[i]; + if (include == nullptr) + break; + const char *addr + = host_address_to_string (COMPUNIT_FILETABS (include)); + fprintf_filtered (outfile, "Compunit include: %s\n", addr); + } + } } static void @@ -809,6 +835,28 @@ maintenance_info_symtabs (const char *regexp, int from_tty) " ((struct blockvector *) %s)\n", host_address_to_string (COMPUNIT_BLOCKVECTOR (cust))); + printf_filtered (" user" + " ((struct compunit_symtab *) %s)\n", + cust->user != nullptr + ? host_address_to_string (cust->user) + : "(null)"); + if (cust->includes != nullptr) + { + printf_filtered (" ( includes\n"); + for (int i = 0; ; ++i) + { + struct compunit_symtab *include + = cust->includes[i]; + if (include == nullptr) + break; + const char *addr + = host_address_to_string (include); + printf_filtered (" (%s %s)\n", + "(struct compunit_symtab *)", + addr); + } + printf_filtered (" )\n"); + } printed_compunit_symtab_start = 1; } diff --git a/gdb/symtab.h b/gdb/symtab.h index 771b5ec5bf..18be5d51b8 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1513,6 +1513,13 @@ extern struct symtab * extern enum language compunit_language (const struct compunit_symtab *cust); +/* Return true if this symtab is the "main" symtab of its compunit_symtab. */ + +static inline bool +is_main_symtab_of_compunit_symtab (struct symtab *symtab) +{ + return symtab == COMPUNIT_FILETABS (SYMTAB_COMPUNIT (symtab)); +} \f /* The virtual function table is now an array of structures which have the
next reply other threads:[~2020-04-08 6:42 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-08 6:42 gdb-buildbot [this message] 2020-04-08 6:42 ` Failures on Fedora-i686, branch master gdb-buildbot 2020-04-08 7:05 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot 2020-04-08 7:14 ` Failures on Fedora-x86_64-m32, " gdb-buildbot 2020-04-08 7:37 ` Failures on Fedora-x86_64-m64, " gdb-buildbot 2020-04-08 7:53 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot 2020-04-08 8:24 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot 2020-04-11 21:14 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot 2020-04-12 15:43 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot 2020-04-13 19:35 ` Failures on Ubuntu-Aarch64-m64, " gdb-buildbot 2020-04-13 19:52 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot 2020-04-13 21:41 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
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=7b1eff95bed765cb20dd3168cb99896a91fcdca7@gdb-build \ --to=gdb-buildbot@sergiodj.net \ --cc=gdb-testers@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: linkBe 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).