Index: hppa-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/hppa-tdep.c,v retrieving revision 1.192 diff -u -p -r1.192 hppa-tdep.c --- hppa-tdep.c 14 Dec 2004 16:35:37 -0000 1.192 +++ hppa-tdep.c 17 Dec 2004 06:49:05 -0000 @@ -2255,6 +2255,31 @@ hppa_unwind_pc (struct gdbarch *gdbarch, 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. */ + +extern 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: hppa-tdep.h =================================================================== RCS file: /cvs/src/src/gdb/hppa-tdep.h,v retrieving revision 1.17 diff -u -p -r1.17 hppa-tdep.h --- hppa-tdep.h 13 Dec 2004 04:06:15 -0000 1.17 +++ hppa-tdep.h 17 Dec 2004 06:49:05 -0000 @@ -231,4 +231,8 @@ extern void hppa_write_pc (CORE_ADDR pc, 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: solib-som.c =================================================================== RCS file: /cvs/src/src/gdb/solib-som.c,v retrieving revision 1.1 diff -u -p -r1.1 solib-som.c --- solib-som.c 8 Dec 2004 01:36:42 -0000 1.1 +++ solib-som.c 17 Dec 2004 06:49:06 -0000 @@ -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);