+ int printed_compunit_symtab_start = 0;
+
+ ALL_COMPUNIT_FILETABS (cust, symtab)
+ {
+ QUIT;
+
+ if (! regexp
+ || re_exec (symtab_to_filename_for_display (symtab)))
+ {
+ if (! printed_objfile_start)
+ {
+ printf_filtered ("{ objfile %s ", objfile_name (objfile));
+ wrap_here (" ");
+ printf_filtered ("((struct objfile *) %s)\n",
+ host_address_to_string (objfile));
+ printed_objfile_start = 1;
+ }
+ if (! printed_compunit_symtab_start)
+ {
+ printf_filtered (" { ((struct compunit_symtab *) %s)\n",
+ host_address_to_string (cust));
+ printf_filtered (" debugformat %s\n",
+ COMPUNIT_DEBUGFORMAT (cust));
+ printf_filtered (" producer %s\n",
+ COMPUNIT_PRODUCER (cust) != NULL
+ ? COMPUNIT_PRODUCER (cust)
+ : "(null)");
+ printf_filtered (" dirname %s\n",
+ COMPUNIT_DIRNAME (cust) != NULL
+ ? COMPUNIT_DIRNAME (cust)
+ : "(null)");
+ printf_filtered (" blockvector"
+ " ((struct blockvector *) %s)\n",
+ host_address_to_string
+ (COMPUNIT_BLOCKVECTOR (cust)));
+ printed_compunit_symtab_start = 1;
+ }
+
+ printf_filtered ("\t{ symtab %s ",
+ symtab_to_filename_for_display (symtab));
+ wrap_here (" ");
+ printf_filtered ("((struct symtab *) %s)\n",
+ host_address_to_string (symtab));
+ printf_filtered ("\t fullname %s\n",
+ symtab->fullname != NULL
+ ? symtab->fullname
+ : "(null)");
+ printf_filtered ("\t "
+ "linetable ((struct linetable *) %s)\n",
+ host_address_to_string (symtab->linetable));
+ printf_filtered ("\t}\n");
+ }
+ }
+
+ if (printed_compunit_symtab_start)
+ printf_filtered (" }\n");
+ }
+
+ if (printed_objfile_start)
+ printf_filtered ("}\n");
+ }
+}
+
+/* Check consistency of symtabs.
+ An example of what this checks for is NULL blockvectors.
+ They can happen if there's a bug during debug info reading.
+ GDB assumes they are always non-NULL.
+
+ Note: This does not check for psymtab vs symtab consistency.
+ Use "maint check-psymtabs" for that. */
+
+static void
+maintenance_check_symtabs (char *ignore, int from_tty)
+{
+ struct program_space *pspace;
+ struct objfile *objfile;
+
+ ALL_PSPACES (pspace)
+ ALL_PSPACE_OBJFILES (pspace, objfile)
+ {
+ struct compunit_symtab *cust;
+
+ /* We don't want to print anything for this objfile until we
+ actually find something worth printing. */
+ int printed_objfile_start = 0;
+
+ ALL_OBJFILE_COMPUNITS (objfile, cust)
+ {
+ int found_something = 0;
+ struct symtab *symtab = compunit_primary_filetab (cust);
+