summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/hppa-tdep.c25
-rw-r--r--gdb/hppa-tdep.h4
-rw-r--r--gdb/solib-som.c35
4 files changed, 45 insertions, 28 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4a272487adc..10310d060d5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 44c6f8d7d25..46a7b080192 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -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). */
diff --git a/gdb/hppa-tdep.h b/gdb/hppa-tdep.h
index 548c21b8dfb..31537579d10 100644
--- a/gdb/hppa-tdep.h
+++ b/gdb/hppa-tdep.h
@@ -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 */
diff --git a/gdb/solib-som.c b/gdb/solib-som.c
index 38c1803c8c2..886eb4b7bd2 100644
--- a/gdb/solib-som.c
+++ b/gdb/solib-som.c
@@ -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);