+2013-08-07  Tom Tromey  <tromey@redhat.com>
+
+       * symfile.c (set_initial_language): Look up "main" symbol
+       and use its language.
+       * symtab.c (find_main_filename): Remove.
+       * symtab.h (find_main_filename): Remove.
+
 2013-08-07  Tom Tromey  <tromey@redhat.com>
 
        * dwarf2read.c (recursively_compute_inclusions): Add
 
     lang = language_of_main;
   else
     {
-      const char *filename;
+      char *name = main_name ();
+      struct symbol *sym = lookup_symbol (name, NULL, VAR_DOMAIN, NULL);
 
-      filename = find_main_filename ();
-      if (filename != NULL)
-       lang = deduce_language_from_filename (filename);
+      if (sym != NULL)
+       lang = SYMBOL_LANGUAGE (sym);
     }
 
   if (lang == language_unknown)
 
   return (struct type *) 0;
 }
 
-/* Find the name of the file containing main().  */
-/* FIXME:  What about languages without main() or specially linked
-   executables that have no main() ?   */
-
-const char *
-find_main_filename (void)
-{
-  struct objfile *objfile;
-  char *name = main_name ();
-
-  ALL_OBJFILES (objfile)
-  {
-    const char *result;
-
-    if (!objfile->sf)
-      continue;
-    result = objfile->sf->qf->find_symbol_file (objfile, name);
-    if (result)
-      return result;
-  }
-  return (NULL);
-}
-
 /* Search BLOCK for symbol NAME in DOMAIN.
 
    Note that if NAME is the demangled form of a C++ symbol, we will fail
 
 
 int matching_obj_sections (struct obj_section *, struct obj_section *);
 
-extern const char *find_main_filename (void);
-
 extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *);
 
 extern struct symtab_and_line find_function_start_sal (struct symbol *sym,
 
+2013-08-07  Tom Tromey  <tromey@redhat.com>
+
+       * gdb.base/maint.exp: Allow zero symtabs to be expanded.
+
 2013-08-07  Tom Tromey  <tromey@redhat.com>
 
        * gdb.dwarf2/dwz.exp: New file.
 
 gdb_test_no_output "mt set per on" "mt set per on for expand-symtabs"
 gdb_test_multiple "mt expand-symtabs $subdir/break\[.\]c$" \
     "mt expand-symtabs" {
-       -re "#primary symtabs: (1|2) \\(\[+\](1|2)\\),.*$gdb_prompt $" {
-           # This should expand one or at most two primary symtabs.
-           # "Normally" it will expand just the one for break.c, but if the
+       -re "#primary symtabs: (1|2) \\(\[+\](0|1|2)\\),.*$gdb_prompt $" {
+           # This should expand at most two primary symtabs.
+           # "Normally" it will not expand any, because the symtab
+           # holding "main" will already have been expanded, but if the
            # file is compiled with -fdebug-types-section then a second primary
            # symtab for break.c will be created for any types.
            pass "mt expand-symtabs"