* alpha-tdep.c (alpha_register_convert_to_virtual): Tidy use of
[deliverable/binutils-gdb.git] / gdb / objfiles.c
index 16d8527a7debdbef84fd2a1b42ed8b1d3e2f7b27..e695ebef78f678298603a6ba9e4a60fed3ba7683 100644 (file)
@@ -1,7 +1,7 @@
 /* GDB routines for manipulating objfiles.
 
    Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002 Free Software Foundation, Inc.
+   2001, 2002, 2003 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support, using pieces from other GDB modules.
 
 #include <fcntl.h>
 #include "gdb_obstack.h"
 #include "gdb_string.h"
+#include "hashtab.h"
 
 #include "breakpoint.h"
+#include "block.h"
 
 /* Prototypes for local functions */
 
@@ -149,6 +151,15 @@ build_objfile_section_table (struct objfile *objfile)
    OBJF_SHARED are simply copied through to the new objfile flags
    member. */
 
+/* NOTE: carlton/2003-02-04: This function is called with args NULL, 0
+   by jv-lang.c, to create an artificial objfile used to hold
+   information about dynamically-loaded Java classes.  Unfortunately,
+   that branch of this function doesn't get tested very frequently, so
+   it's prone to breakage.  (E.g. at one time the name was set to NULL
+   in that situation, which broke a loop over all names in the dynamic
+   library loader.)  If you change this function, please try to leave
+   things in a consistent state even if abfd is NULL.  */
+
 struct objfile *
 allocate_objfile (bfd *abfd, int flags)
 {
@@ -191,6 +202,11 @@ allocate_objfile (bfd *abfd, int flags)
              objfile->md = md;
              objfile->mmfd = fd;
              /* Update pointers to functions to *our* copies */
+             if (objfile->demangled_names_hash)
+               htab_set_functions_ex
+                 (objfile->demangled_names_hash, htab_hash_string,
+                  (int (*) (const void *, const void *)) streq, NULL,
+                  objfile->md, xmcalloc, xmfree);
              obstack_chunkfun (&objfile->psymbol_cache.cache, xmmalloc);
              obstack_freefun (&objfile->psymbol_cache.cache, xmfree);
              obstack_chunkfun (&objfile->macro_cache.cache, xmmalloc);
@@ -307,6 +323,10 @@ allocate_objfile (bfd *abfd, int flags)
                 objfile->name, bfd_errmsg (bfd_get_error ()));
        }
     }
+  else
+    {
+      objfile->name = mstrsave (objfile->md, "<<anonymous objfile>>");
+    }
 
   /* Initialize the section indexes for this objfile, so that we can
      later detect if they are used w/o being properly assigned to. */
@@ -353,7 +373,7 @@ terminate_minimal_symbol_table (struct objfile *objfile)
       = &objfile->msymbols[objfile->minimal_symbol_count];
 
     memset (m, 0, sizeof (*m));
-    SYMBOL_NAME (m) = NULL;
+    DEPRECATED_SYMBOL_NAME (m) = NULL;
     SYMBOL_VALUE_ADDRESS (m) = 0;
     MSYMBOL_INFO (m) = NULL;
     MSYMBOL_TYPE (m) = mst_unknown;
@@ -551,6 +571,8 @@ free_objfile (struct objfile *objfile)
       /* Free the obstacks for non-reusable objfiles */
       bcache_xfree (objfile->psymbol_cache);
       bcache_xfree (objfile->macro_cache);
+      if (objfile->demangled_names_hash)
+       htab_delete (objfile->demangled_names_hash);
       obstack_free (&objfile->psymbol_obstack, 0);
       obstack_free (&objfile->symbol_obstack, 0);
       obstack_free (&objfile->type_obstack, 0);
@@ -645,7 +667,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
              fixup_symbol_section (sym, objfile);
 
              /* The RS6000 code from which this was taken skipped
-                any symbols in STRUCT_NAMESPACE or UNDEF_NAMESPACE.
+                any symbols in STRUCT_DOMAIN or UNDEF_DOMAIN.
                 But I'm leaving out that test, on the theory that
                 they can't possibly pass the tests below.  */
              if ((SYMBOL_CLASS (sym) == LOC_LABEL
@@ -660,8 +682,8 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
              /* Relocate Extra Function Info for ecoff.  */
 
              else if (SYMBOL_CLASS (sym) == LOC_CONST
-                      && SYMBOL_NAMESPACE (sym) == LABEL_NAMESPACE
-                      && strcmp (SYMBOL_NAME (sym), MIPS_EFI_SYMBOL_NAME) == 0)
+                      && SYMBOL_DOMAIN (sym) == LABEL_DOMAIN
+                      && strcmp (DEPRECATED_SYMBOL_NAME (sym), MIPS_EFI_SYMBOL_NAME) == 0)
                ecoff_relocate_efi (sym, ANOFFSET (delta,
                                                   s->block_line_section));
 #endif
This page took 0.02549 seconds and 4 git commands to generate.