* hppa-tdep.c (hppa_lookup_stub_minimal_symbol): New function.
authorJoel Brobecker <brobecker@gnat.com>
Fri, 17 Dec 2004 07:42:48 +0000 (07:42 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Fri, 17 Dec 2004 07:42:48 +0000 (07:42 +0000)
        * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Add declaration.
        * solib-som.c (som_solib_create_inferior_hook): Replace stub
        msymbol search by call to hppa_lookup_stub_minimal_symbol. This
        extends the search to all objfiles, not just shared libraries.
        Remove unused variable.

gdb/ChangeLog
gdb/hppa-tdep.c
gdb/hppa-tdep.h
gdb/solib-som.c

index 4a27248..10310d0 100644 (file)
@@ -1,3 +1,12 @@
+2004-12-17  Joel Brobecker  <brobecker@gnat.com>
+
+       * hppa-tdep.c (hppa_lookup_stub_minimal_symbol): New function.
+       * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Add declaration.
+       * solib-som.c (som_solib_create_inferior_hook): Replace stub
+       msymbol search by call to hppa_lookup_stub_minimal_symbol. This
+       extends the search to all objfiles, not just shared libraries.
+       Remove unused variable.
+
 2004-12-16  Michael Snyder  <msnyder@redhat.com>
 
        * MAINTAINERS: Add myself as maintainer for mn10300.
index 44c6f8d..46a7b08 100644 (file)
@@ -2255,6 +2255,31 @@ hppa_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return pc & ~0x3;
 }
 
+/* Return the minimal symbol whose name is NAME and stub type is STUB_TYPE.
+   Return NULL if no such symbol was found.  */
+
+struct minimal_symbol *
+hppa_lookup_stub_minimal_symbol (const char *name,
+                                 enum unwind_stub_types stub_type)
+{
+  struct objfile *objfile;
+  struct minimal_symbol *msym;
+
+  ALL_MSYMBOLS (objfile, msym)
+    {
+      if (strcmp (SYMBOL_LINKAGE_NAME (msym), name) == 0)
+        {
+          struct unwind_table_entry *u;
+
+          u = find_unwind_entry (SYMBOL_VALUE (msym));
+          if (u != NULL && u->stub_unwind.stub_type == stub_type)
+            return msym;
+        }
+    }
+
+  return NULL;
+}
+
 /* Instead of this nasty cast, add a method pvoid() that prints out a
    host VOID data type (remember %p isn't portable).  */
 
index 548c21b..3153757 100644 (file)
@@ -231,4 +231,8 @@ extern void hppa_write_pc (CORE_ADDR pc, ptid_t ptid);
 extern CORE_ADDR hppa_unwind_pc (struct gdbarch *gdbarch,
                                 struct frame_info *next_frame);
 
+extern struct minimal_symbol *
+  hppa_lookup_stub_minimal_symbol (const char *name,
+                                   enum unwind_stub_types stub_type);
+
 #endif  /* HPPA_TDEP_H */
index 38c1803..886eb4b 100644 (file)
@@ -161,7 +161,6 @@ som_solib_create_inferior_hook (void)
   unsigned int dld_flags, status, have_endo;
   asection *shlib_info;
   char buf[4];
-  struct objfile *objfile;
   CORE_ADDR anaddr;
 
   /* First, remove all the solib event breakpoints.  Their addresses
@@ -226,33 +225,13 @@ som_solib_create_inferior_hook (void)
 
   /* Grrr, this might not be an export symbol!  We have to find the
      export stub.  */
-  ALL_OBJFILES (objfile)
-  {
-    struct unwind_table_entry *u;
-    struct minimal_symbol *msymbol2;
-
-    /* What a crock.  */
-    msymbol2 =
-      lookup_minimal_symbol_solib_trampoline (SYMBOL_LINKAGE_NAME (msymbol),
-                                             objfile);
-    /* Found a symbol with the right name.  */
-    if (msymbol2)
-      {
-       struct unwind_table_entry *u;
-       /* It must be a shared library trampoline.  */
-       if (SYMBOL_TYPE (msymbol2) != mst_solib_trampoline)
-         continue;
-
-       /* It must also be an export stub.  */
-       u = find_unwind_entry (SYMBOL_VALUE (msymbol2));
-       if (!u || u->stub_unwind.stub_type != EXPORT)
-         continue;
-
-       /* OK.  Looks like the correct import stub.  */
-       anaddr = SYMBOL_VALUE (msymbol2);
-       dld_cache.hook_stub.address = anaddr;
-      }
-  }
+  msymbol = hppa_lookup_stub_minimal_symbol (SYMBOL_LINKAGE_NAME (msymbol),
+                                             EXPORT);
+  if (msymbol != NULL)
+    {
+      anaddr = SYMBOL_VALUE (msymbol);
+      dld_cache.hook_stub.address = anaddr;
+    }
   store_unsigned_integer (buf, 4, anaddr);
 
   msymbol = lookup_minimal_symbol ("__dld_hook", NULL, symfile_objfile);