* config/m68k/monitor.mt (TDEPFILE): Add remote-es.o.
[deliverable/binutils-gdb.git] / gdb / minsyms.c
index b8d73723773da41fa834262ea68972811da98dea..8f1992c9374d7d16dfda10aaee61cc76193e70e8 100644 (file)
@@ -253,9 +253,23 @@ lookup_minimal_symbol_by_pc (pc)
                 objfile's minimal symbol table.  See if it is the best one
                 overall. */
 
-             if ((best_symbol == NULL) ||
-                 (SYMBOL_VALUE_ADDRESS (best_symbol) < 
-                  SYMBOL_VALUE_ADDRESS (&msymbol[hi])))
+             /* Skip any absolute symbols.  This is apparently what adb
+                and dbx do, and is needed for the CM-5.  There are two
+                known possible problems: (1) on ELF, apparently end, edata,
+                etc. are absolute.  Not sure ignoring them here is a big
+                deal, but if we want to use them, the fix would go in
+                elfread.c.  (2) I think shared library entry points on the
+                NeXT are absolute.  If we want special handling for this
+                it probably should be triggered by a special
+                mst_abs_or_lib or some such.  */
+             while (hi >= 0
+                    && msymbol[hi].type == mst_abs)
+               --hi;
+
+             if (hi >= 0
+                 && ((best_symbol == NULL) ||
+                     (SYMBOL_VALUE_ADDRESS (best_symbol) < 
+                      SYMBOL_VALUE_ADDRESS (&msymbol[hi]))))
                {
                  best_symbol = &msymbol[hi];
                }
@@ -278,47 +292,50 @@ init_minimal_symbol_collection ()
 }
 
 void
-prim_record_minimal_symbol (name, address, ms_type)
+prim_record_minimal_symbol (name, address, ms_type, objfile)
      const char *name;
      CORE_ADDR address;
      enum minimal_symbol_type ms_type;
+     struct objfile *objfile;
 {
-  register struct msym_bunch *new;
-  register struct minimal_symbol *msymbol;
-
-  if (msym_bunch_index == BUNCH_SIZE)
-    {
-      new = (struct msym_bunch *) xmalloc (sizeof (struct msym_bunch));
-      msym_bunch_index = 0;
-      new -> next = msym_bunch;
-      msym_bunch = new;
-    }
-  msymbol = &msym_bunch -> contents[msym_bunch_index];
-  SYMBOL_NAME (msymbol) = (char *) name;
-  SYMBOL_INIT_LANGUAGE_SPECIFIC (msymbol, language_unknown);
-  SYMBOL_VALUE_ADDRESS (msymbol) = address;
-  SYMBOL_SECTION (msymbol) = -1;
-  MSYMBOL_TYPE (msymbol) = ms_type;
-  /* FIXME:  This info, if it remains, needs its own field.  */
-  MSYMBOL_INFO (msymbol) = NULL; /* FIXME! */
-  msym_bunch_index++;
-  msym_count++;
+  prim_record_minimal_symbol_and_info (name, address, ms_type,
+                                      NULL, -1, objfile);
 }
 
-/* FIXME:  Why don't we just combine this function with the one above
-   and pass it a NULL info pointer value if info is not needed? */
-
 void
-prim_record_minimal_symbol_and_info (name, address, ms_type, info, section)
+prim_record_minimal_symbol_and_info (name, address, ms_type, info, section,
+                                    objfile)
      const char *name;
      CORE_ADDR address;
      enum minimal_symbol_type ms_type;
      char *info;
      int section;
+     struct objfile *objfile;
 {
   register struct msym_bunch *new;
   register struct minimal_symbol *msymbol;
 
+  if (ms_type == mst_file_text)
+    {
+      /* Don't put gcc_compiled, __gnu_compiled_cplus, and friends into
+        the minimal symbols, because if there is also another symbol
+        at the same address (e.g. the first function of the file),
+        lookup_minimal_symbol_by_pc would have no way of getting the
+        right one.  */
+      if (name[0] == 'g'
+         && (strcmp (name, GCC_COMPILED_FLAG_SYMBOL) == 0
+             || strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0))
+       return;
+
+      {
+       const char *tempstring = name;
+       if (tempstring[0] == bfd_get_symbol_leading_char (objfile->obfd))
+         ++tempstring;
+       if (STREQN (tempstring, "__gnu_compiled", 14))
+         return;
+      }
+    }
+
   if (msym_bunch_index == BUNCH_SIZE)
     {
       new = (struct msym_bunch *) xmalloc (sizeof (struct msym_bunch));
This page took 0.023957 seconds and 4 git commands to generate.