*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / buildsym.c
index f94c14dc551fc794d1940fa07df87ae1a96f8e4b..e690a0ca0e7236adcbc1ca7ffdad9f45b2025153 100644 (file)
@@ -1,7 +1,7 @@
 /* Support routines for building symbol tables in GDB's internal format.
    Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009
-   Free Software Foundation, Inc.
+   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009,
+   2010 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -163,8 +163,8 @@ find_symbol_in_list (struct pending *list, char *name, int length)
       for (j = list->nsyms; --j >= 0;)
        {
          pp = SYMBOL_LINKAGE_NAME (list->symbol[j]);
-         if (*pp == *name && strncmp (pp, name, length) == 0 &&
-             pp[length] == '\0')
+         if (*pp == *name && strncmp (pp, name, length) == 0
+             && pp[length] == '\0')
            {
              return (list->symbol[j]);
            }
@@ -235,6 +235,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
              CORE_ADDR start, CORE_ADDR end,
              struct objfile *objfile)
 {
+  struct gdbarch *gdbarch = get_objfile_arch (objfile);
   struct pending *next, *next1;
   struct block *block;
   struct pending_block *pblock;
@@ -331,8 +332,9 @@ finish_block (struct symbol *symbol, struct pending **listhead,
       else
        {
          complaint (&symfile_complaints,
-                    _("block end address 0x%s less than block start address 0x%s (patched it)"),
-                    paddr_nz (BLOCK_END (block)), paddr_nz (BLOCK_START (block)));
+                    _("block end address %s less than block start address %s (patched it)"),
+                    paddress (gdbarch, BLOCK_END (block)),
+                    paddress (gdbarch, BLOCK_START (block)));
        }
       /* Better than nothing */
       BLOCK_END (block) = BLOCK_START (block);
@@ -368,11 +370,11 @@ finish_block (struct symbol *symbol, struct pending **listhead,
              else
                {
                  complaint (&symfile_complaints,
-                            _("inner block (0x%s-0x%s) not inside outer block (0x%s-0x%s)"),
-                            paddr_nz (BLOCK_START (pblock->block)),
-                            paddr_nz (BLOCK_END (pblock->block)),
-                            paddr_nz (BLOCK_START (block)),
-                            paddr_nz (BLOCK_END (block)));
+                            _("inner block (%s-%s) not inside outer block (%s-%s)"),
+                            paddress (gdbarch, BLOCK_START (pblock->block)),
+                            paddress (gdbarch, BLOCK_END (pblock->block)),
+                            paddress (gdbarch, BLOCK_START (block)),
+                            paddress (gdbarch, BLOCK_END (block)));
                }
              if (BLOCK_START (pblock->block) < BLOCK_START (block))
                BLOCK_START (pblock->block) = BLOCK_START (block);
@@ -384,6 +386,9 @@ finish_block (struct symbol *symbol, struct pending **listhead,
       opblock = pblock;
     }
 
+  block_set_using (block, using_directives, &objfile->objfile_obstack);
+  using_directives = NULL;
+
   record_pending_block (objfile, block, opblock);
 
   return block;
@@ -579,8 +584,8 @@ start_subfile (char *name, char *dirname)
      source file. */
 
   subfile->language = deduce_language_from_filename (subfile->name);
-  if (subfile->language == language_unknown &&
-      subfile->next != NULL)
+  if (subfile->language == language_unknown
+      && subfile->next != NULL)
     {
       subfile->language = subfile->next->language;
     }
@@ -652,8 +657,8 @@ patch_subfile_names (struct subfile *subfile, char *name)
          symbols have been processed for a given source file. */
 
       subfile->language = deduce_language_from_filename (subfile->name);
-      if (subfile->language == language_unknown &&
-         subfile->next != NULL)
+      if (subfile->language == language_unknown
+         && subfile->next != NULL)
        {
          subfile->language = subfile->next->language;
        }
@@ -669,7 +674,7 @@ void
 push_subfile (void)
 {
   struct subfile_stack *tem
-  = (struct subfile_stack *) xmalloc (sizeof (struct subfile_stack));
+    = (struct subfile_stack *) xmalloc (sizeof (struct subfile_stack));
 
   tem->next = subfile_stack;
   subfile_stack = tem;
@@ -703,8 +708,8 @@ void
 record_line (struct subfile *subfile, int line, CORE_ADDR pc)
 {
   struct linetable_entry *e;
-  /* Ignore the dummy line number in libg.o */
 
+  /* Ignore the dummy line number in libg.o */
   if (line == 0xffff)
     {
       return;
@@ -812,10 +817,6 @@ start_symtab (char *name, char *dirname, CORE_ADDR start_addr)
   /* We shouldn't have any address map at this point.  */
   gdb_assert (! pending_addrmap);
 
-  /* Set up support for C++ namespace support, in case we need it.  */
-
-  cp_initialize_namespace ();
-
   /* Initialize the list of sub source files with one entry for this
      file (the top-level source file).  */
 
@@ -999,7 +1000,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
      are no-ops.  FIXME: Is this handled right in case of QUIT?  Can
      we make this cleaner?  */
 
-  cleanup_undefined_types ();
+  cleanup_undefined_types (objfile);
   finish_global_stabs (objfile);
 
   if (pending_blocks == NULL
@@ -1021,8 +1022,6 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
       finish_block (0, &global_symbols, 0, last_source_start_addr, end_addr,
                    objfile);
       blockvector = make_blockvector (objfile);
-      cp_finalize_namespace (BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK),
-                            &objfile->objfile_obstack);
     }
 
   /* Read the line table if it has to be read separately.  */
@@ -1191,6 +1190,12 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
          struct symbol *sym;
          struct dict_iterator iter;
 
+         /* Inlined functions may have symbols not in the global or static
+            symbol lists.  */
+         if (BLOCK_FUNCTION (block) != NULL)
+           if (SYMBOL_SYMTAB (BLOCK_FUNCTION (block)) == NULL)
+             SYMBOL_SYMTAB (BLOCK_FUNCTION (block)) = symtab;
+
          for (sym = dict_iterator_first (BLOCK_DICT (block), &iter);
               sym != NULL;
               sym = dict_iterator_next (&iter))
@@ -1234,10 +1239,12 @@ push_context (int desc, CORE_ADDR valu)
   new->params = param_symbols;
   new->old_blocks = pending_blocks;
   new->start_addr = valu;
+  new->using_directives = using_directives;
   new->name = NULL;
 
   local_symbols = NULL;
   param_symbols = NULL;
+  using_directives = NULL;
 
   return new;
 }
This page took 0.073263 seconds and 4 git commands to generate.