diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/symmisc.c | 54 | ||||
-rw-r--r-- | gdb/symtab.h | 7 |
3 files changed, 64 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7d627b5..f5e54f6 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 3df526b..bee136e 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 771b5ec..18be5d5 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)); +} /* The virtual function table is now an array of structures which have the |