- QUIT;
- if (symname == NULL
- || filename_cmp (symname, symtab_to_filename_for_display (s)) == 0)
- dump_symtab (objfile, s, outfile);
+ struct objfile *objfile;
+ struct compunit_symtab *cu;
+ struct symtab *s;
+ int found = 0;
+
+ ALL_OBJFILES (objfile)
+ {
+ int print_for_objfile = 1;
+
+ if (objfile_arg != NULL)
+ print_for_objfile
+ = compare_filenames_for_search (objfile_name (objfile),
+ objfile_arg);
+ if (!print_for_objfile)
+ continue;
+
+ ALL_OBJFILE_FILETABS (objfile, cu, s)
+ {
+ int print_for_source = 0;
+
+ QUIT;
+ if (source_arg != NULL)
+ {
+ print_for_source
+ = compare_filenames_for_search
+ (symtab_to_filename_for_display (s), source_arg);
+ found = 1;
+ }
+ if (source_arg == NULL
+ || print_for_source)
+ dump_symtab (s, outfile);
+ }
+ }
+
+ if (source_arg != NULL && !found)
+ error (_("No symtab for source file: %s"), source_arg);