* emultempl/armelf.em (elf32_arm_add_stub_section): Use
[deliverable/binutils-gdb.git] / gdb / minsyms.c
index f1a6c486b4451601cd2b061b3b49a7975d88d933..59febf295e9c2baad136260c54c52e7574dc3ddd 100644 (file)
@@ -47,6 +47,7 @@
 #include "demangle.h"
 #include "value.h"
 #include "cp-abi.h"
+#include "target.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
@@ -330,6 +331,41 @@ lookup_minimal_symbol_text (const char *name, struct objfile *objf)
   return NULL;
 }
 
+/* Look through all the current minimal symbol tables and find the
+   first minimal symbol that matches NAME and PC.  If OBJF is non-NULL,
+   limit the search to that objfile.  Returns a pointer to the minimal
+   symbol that matches, or NULL if no match is found.  */
+
+struct minimal_symbol *
+lookup_minimal_symbol_by_pc_name (CORE_ADDR pc, const char *name,
+                                 struct objfile *objf)
+{
+  struct objfile *objfile;
+  struct minimal_symbol *msymbol;
+
+  unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
+
+  for (objfile = object_files;
+       objfile != NULL;
+       objfile = objfile->next)
+    {
+      if (objf == NULL || objf == objfile
+         || objf->separate_debug_objfile == objfile)
+       {
+         for (msymbol = objfile->msymbol_hash[hash];
+              msymbol != NULL;
+              msymbol = msymbol->hash_next)
+           {
+             if (SYMBOL_VALUE_ADDRESS (msymbol) == pc
+                 && strcmp (SYMBOL_LINKAGE_NAME (msymbol), name) == 0)
+               return msymbol;
+           }
+       }
+    }
+
+  return NULL;
+}
+
 /* Look through all the current minimal symbol tables and find the
    first minimal symbol that matches NAME and is a solib trampoline.
    If OBJF is non-NULL, limit the search to that objfile.  Returns a
@@ -1110,6 +1146,22 @@ find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc)
            && strcmp (SYMBOL_LINKAGE_NAME (msymbol),
                       SYMBOL_LINKAGE_NAME (tsymbol)) == 0)
          return SYMBOL_VALUE_ADDRESS (msymbol);
+
+       /* Also handle minimal symbols pointing to function descriptors.  */
+       if (MSYMBOL_TYPE (msymbol) == mst_data
+           && strcmp (SYMBOL_LINKAGE_NAME (msymbol),
+                      SYMBOL_LINKAGE_NAME (tsymbol)) == 0)
+         {
+           CORE_ADDR func;
+           func = gdbarch_convert_from_func_ptr_addr
+                   (get_objfile_arch (objfile),
+                    SYMBOL_VALUE_ADDRESS (msymbol),
+                    &current_target);
+
+           /* Ignore data symbols that are not function descriptors.  */
+           if (func != SYMBOL_VALUE_ADDRESS (msymbol))
+             return func;
+         }
       }
     }
   return 0;
This page took 0.024771 seconds and 4 git commands to generate.