* doc/invoke.texi (TC_LARGEST_EXPONENT_IS_NORMAL): Document.
[deliverable/binutils-gdb.git] / gdb / minsyms.c
index 3292096915f6c25ca973469099876c9297f4780e..a4997bffda6495a3de01752ea5a17d698040f28a 100644 (file)
@@ -47,7 +47,8 @@
 #include "symfile.h"
 #include "objfiles.h"
 #include "demangle.h"
-#include "gdb-stabs.h"
+#include "value.h"
+#include "cp-abi.h"
 
 /* Accumulate the minimal symbols for each objfile in bunches of BUNCH_SIZE.
    At the end, copy them all into one newly allocated location on an objfile's
@@ -74,16 +75,6 @@ static int msym_bunch_index;
 
 static int msym_count;
 
-/* Prototypes for local functions. */
-
-static int compare_minimal_symbols (const void *, const void *);
-
-static int
-compact_minimal_symbols (struct minimal_symbol *, int, struct objfile *);
-
-static void add_minsym_to_demangled_hash_table (struct minimal_symbol *sym,
-                                               struct minimal_symbol **table);
-
 /* Compute a hash code based using the same criteria as `strcmp_iw'.  */
 
 unsigned int
@@ -95,8 +86,10 @@ msymbol_hash_iw (const char *string)
       while (isspace (*string))
        ++string;
       if (*string && *string != '(')
-       hash = (31 * hash) + *string;
-      ++string;
+       {
+         hash = hash * 67 + *string - 113;
+         ++string;
+       }
     }
   return hash % MINIMAL_SYMBOL_HASH_SIZE;
 }
@@ -108,7 +101,7 @@ msymbol_hash (const char *string)
 {
   unsigned int hash = 0;
   for (; *string; ++string)
-    hash = (31 * hash) + *string;
+    hash = hash * 67 + *string - 113;
   return hash % MINIMAL_SYMBOL_HASH_SIZE;
 }
 
@@ -544,14 +537,14 @@ find_stab_function_addr (char *namestring, char *filename,
     {
       /* Try again without the filename. */
       p[n] = 0;
-      msym = lookup_minimal_symbol (p, 0, objfile);
+      msym = lookup_minimal_symbol (p, NULL, objfile);
     }
   if (msym == NULL && filename != NULL)
     {
       /* And try again for Sun Fortran, but without the filename. */
       p[n] = '_';
       p[n + 1] = 0;
-      msym = lookup_minimal_symbol (p, 0, objfile);
+      msym = lookup_minimal_symbol (p, NULL, objfile);
     }
 
   return msym == NULL ? 0 : SYMBOL_VALUE_ADDRESS (msym);
@@ -685,7 +678,7 @@ prim_record_minimal_symbol_and_info (const char *name, CORE_ADDR address,
    Within groups with the same address, sort by name.  */
 
 static int
-compare_minimal_symbols (const PTR fn1p, const PTR fn2p)
+compare_minimal_symbols (const void *fn1p, const void *fn2p)
 {
   register const struct minimal_symbol *fn1;
   register const struct minimal_symbol *fn2;
@@ -957,9 +950,24 @@ install_minimal_symbols (struct objfile *objfile)
       objfile->minimal_symbol_count = mcount;
       objfile->msymbols = msymbols;
 
+      /* Try to guess the appropriate C++ ABI by looking at the names 
+        of the minimal symbols in the table.  */
+      {
+       int i;
+
+       for (i = 0; i < mcount; i++)
+         {
+           const char *name = SYMBOL_NAME (&objfile->msymbols[i]);
+           if (name[0] == '_' && name[1] == 'Z')
+             {
+               switch_to_cp_abi ("gnu-v3");
+               break;
+             }
+         }
+      }
+      
       /* Now walk through all the minimal symbols, selecting the newly added
          ones and attempting to cache their C++ demangled names. */
-
       for (; mcount-- > 0; msymbols++)
        SYMBOL_INIT_DEMANGLED_NAME (msymbols, &objfile->symbol_obstack);
 
This page took 0.024253 seconds and 4 git commands to generate.