2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
[deliverable/binutils-gdb.git] / gdb / buildsym.c
index e0e2d4dca00ba064c47ff7edad0a684cd8351d99..ae0750a3a2eb77f872099f3eb7f5897508b6f2b8 100644 (file)
@@ -959,7 +959,10 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
            }
 
          /* Now, allocate a symbol table.  */
-         symtab = allocate_symtab (subfile->name, objfile);
+         if (subfile->symtab == NULL)
+           symtab = allocate_symtab (subfile->name, objfile);
+         else
+           symtab = subfile->symtab;
 
          /* Fill in its components.  */
          symtab->blockvector = blockvector;
@@ -1048,6 +1051,26 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
       symtab->primary = 1;
     }
 
+  /* Default any symbols without a specified symtab to the primary
+     symtab.  */
+  if (blockvector)
+    {
+      int block_i;
+
+      for (block_i = 0; block_i < BLOCKVECTOR_NBLOCKS (blockvector); block_i++)
+       {
+         struct block *block = BLOCKVECTOR_BLOCK (blockvector, block_i);
+         struct symbol *sym;
+         struct dict_iterator iter;
+
+         for (sym = dict_iterator_first (BLOCK_DICT (block), &iter);
+              sym != NULL;
+              sym = dict_iterator_next (&iter))
+           if (SYMBOL_SYMTAB (sym) == NULL)
+             SYMBOL_SYMTAB (sym) = symtab;
+       }
+    }
+
   last_source_file = NULL;
   current_subfile = NULL;
   pending_macros = NULL;
This page took 0.023629 seconds and 4 git commands to generate.