From 44ea7b70f90e6f139269b8210568fd08f3dd4fbe Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Mon, 14 Apr 2003 18:42:28 +0000 Subject: gdb/ChangeLog: 2003-04-10 Jim Blandy * symmisc.c: #include "gdb_regex.h". (maintenance_list_symtabs, maintenance_list_psymtabs): New functions. * maint.c (maintenance_list_command): New function. (_initialize_maint_cmds): Register the above as commands. * symtab.h (maintenance_list_symtabs, maintenance_list_psymtabs): New declarations. * cli/cli-cmds.c (maintenancelistlist): New variable. (init_cmd_lists): Initialize it. * cli/cli-cmds.h (maintenancelistlist): New declaration. * gdbcmd.h (maintenancelistlist): New declaration. * Makefile.in (symmisc.o): Update dependencies. gdb/doc/ChangeLog: 2003-04-09 Jim Blandy * gdb.texinfo (Symbols): Document 'maint list symtabs' and 'maint list psymtabs'. --- gdb/symmisc.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) (limited to 'gdb/symmisc.c') diff --git a/gdb/symmisc.c b/gdb/symmisc.c index f6e78eb..70eb125 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -33,6 +33,7 @@ #include "language.h" #include "bcache.h" #include "block.h" +#include "gdb_regex.h" #include "gdb_string.h" #include @@ -985,6 +986,145 @@ maintenance_print_objfiles (char *ignore, int from_tty) immediate_quit--; } + +/* List all the symbol tables. */ +void +maintenance_list_symtabs (char *regexp, int from_tty) +{ + struct objfile *objfile; + + if (regexp) + re_comp (regexp); + + ALL_OBJFILES (objfile) + { + struct symtab *symtab; + + /* We don't want to print anything for this objfile until we + actually find a symtab whose name matches. */ + int printed_objfile_start = 0; + + ALL_OBJFILE_SYMTABS (objfile, symtab) + if (! regexp + || re_exec (symtab->filename)) + { + if (! printed_objfile_start) + { + printf_filtered ("{ objfile %s ", objfile->name); + wrap_here (" "); + printf_filtered ("((struct objfile *) %p)\n", objfile); + printed_objfile_start = 1; + } + + printf_filtered (" { symtab %s ", symtab->filename); + wrap_here (" "); + printf_filtered ("((struct symtab *) %p)\n", symtab); + printf_filtered (" dirname %s\n", + symtab->dirname ? symtab->dirname : "(null)"); + printf_filtered (" fullname %s\n", + symtab->fullname ? symtab->fullname : "(null)"); + printf_filtered (" blockvector ((struct blockvector *) %p)%s\n", + symtab->blockvector, + symtab->primary ? " (primary)" : ""); + printf_filtered (" debugformat %s\n", symtab->debugformat); + printf_filtered (" }\n"); + } + + if (printed_objfile_start) + printf_filtered ("}\n"); + } +} + + +/* List all the partial symbol tables. */ +void +maintenance_list_psymtabs (char *regexp, int from_tty) +{ + struct objfile *objfile; + + if (regexp) + re_comp (regexp); + + ALL_OBJFILES (objfile) + { + struct partial_symtab *psymtab; + + /* We don't want to print anything for this objfile until we + actually find a symtab whose name matches. */ + int printed_objfile_start = 0; + + ALL_OBJFILE_PSYMTABS (objfile, psymtab) + if (! regexp + || re_exec (psymtab->filename)) + { + if (! printed_objfile_start) + { + printf_filtered ("{ objfile %s ", objfile->name); + wrap_here (" "); + printf_filtered ("((struct objfile *) %p)\n", objfile); + printed_objfile_start = 1; + } + + printf_filtered (" { psymtab %s ", psymtab->filename); + wrap_here (" "); + printf_filtered ("((struct partial_symtab *) %p)\n", psymtab); + printf_filtered (" readin %s\n", + psymtab->readin ? "yes" : "no"); + printf_filtered (" fullname %s\n", + psymtab->fullname ? psymtab->fullname : "(null)"); + printf_filtered (" text addresses "); + print_address_numeric (psymtab->textlow, 1, gdb_stdout); + printf_filtered (" -- "); + print_address_numeric (psymtab->texthigh, 1, gdb_stdout); + printf_filtered ("\n"); + printf_filtered (" globals "); + if (psymtab->n_global_syms) + { + printf_filtered ("(* (struct partial_symbol **) %p @ %d)\n", + (psymtab->objfile->global_psymbols.list + + psymtab->globals_offset), + psymtab->n_global_syms); + } + else + printf_filtered ("(none)\n"); + printf_filtered (" statics "); + if (psymtab->n_static_syms) + { + printf_filtered ("(* (struct partial_symbol **) %p @ %d)\n", + (psymtab->objfile->static_psymbols.list + + psymtab->statics_offset), + psymtab->n_static_syms); + } + else + printf_filtered ("(none)\n"); + printf_filtered (" dependencies "); + if (psymtab->number_of_dependencies) + { + int i; + + printf_filtered ("{\n"); + for (i = 0; i < psymtab->number_of_dependencies; i++) + { + struct partial_symtab *dep = psymtab->dependencies[i]; + + /* Note the string concatenation there --- no comma. */ + printf_filtered (" psymtab %s " + "((struct partial_symtab *) %p)\n", + dep->filename, dep); + } + printf_filtered (" }\n"); + } + else + printf_filtered ("(none)\n"); + printf_filtered (" }\n"); + } + + if (printed_objfile_start) + printf_filtered ("}\n"); + } +} + + /* Check consistency of psymtabs and symtabs. */ void -- cgit v1.1