* hppa-tdep.c (hppa_push_arguments): Allocate enough space for
[deliverable/binutils-gdb.git] / gdb / solib.c
index e4bf9d73ec4625a5c13c0462de5bdb3bf7bd29e8..417fb600e3ff70e982fa53f37cf1928636ef6da7 100644 (file)
@@ -259,6 +259,38 @@ solib_map_sections (so)
 
 #ifndef SVR4_SHARED_LIBS
 
+/* This routine can be a real performance hog.  According to some gprof data
+   which mtranle@paris.IntelliCorp.COM (Minh Tran-Le) sent, almost all the
+   time spend in solib_add (up to 20 minutes with 35 shared libraries) is
+   spent here, with 5/6 in lookup_minimal_symbol and 1/6 in read_memory.
+
+   Possible solutions:
+
+   * Hash the minimal symbols.
+
+   * Just record the name of the minimal symbol and lazily patch the
+   addresses.
+
+   * Tell everyone to switch to Solaris2.  
+
+(1)  Move the call to special_symbol_handling out of the find_solib
+loop in solib_add.  This will call it once, rather than 35 times, when
+you have 35 shared libraries.  It's in the loop to pass the current
+solib's objfile so the symbols are added to that objfile's minsym.
+But since the symbols are in common (BSS), it doesn't really matter
+which objfile's minsyms they are added to, I think.
+
+(2)  Indeed, it might be best to create an objfile just for common minsyms,
+thus not needing any objfile argument to solib_add_common_symbols.
+
+(3)  Remove the call to lookup_minimal_symbol from
+solib_add_common_symbols.  If a symbol appears multiple times in the
+minsyms, we probably cope, more or less.  Note that if we had an
+objfile for just minsyms, install_minimal_symbols would automatically
+remove duplicates caused by running solib_add_common_symbols several
+times.
+*/
+
 static void
 solib_add_common_symbols (rtc_symp, objfile)
     struct rtc_symb *rtc_symp;
@@ -766,7 +798,8 @@ solib_add (arg_string, from_tty, target)
            }
          else if (catch_errors
                   (symbol_add_stub, (char *) so,
-                   "Error while reading shared library symbols:\n"))
+                   "Error while reading shared library symbols:\n",
+                   RETURN_MASK_ALL))
            {
              special_symbol_handling (so);
              so -> symbols_loaded = 1;
@@ -1198,12 +1231,17 @@ FIXME
 void 
 solib_create_inferior_hook()
 {
-  
+  /* If we are using the BKPT_AT_SYMBOL code, then we don't need the base
+     yet.  In fact, in the case of a SunOS4 executable being run on
+     Solaris, we can't get it yet.  find_solib will get it when it needs
+     it.  */
+#if !(defined (SVR4_SHARED_LIBS) && defined (BKPT_AT_SYMBOL))
   if ((debug_base = locate_base ()) == 0)
     {
       /* Can't find the symbol or the executable is statically linked. */
       return;
     }
+#endif
 
   if (!enable_break ())
     {
This page took 0.024537 seconds and 4 git commands to generate.