This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Fix auto-solib-add bug (long - example w/analysis)


There is a bug in gdb that manifests itself when auto-solib-add is set
to zero to disable automatic loading of shared library symbols.  If
you run the inferior, manually load a shared library, set a breakpoint
in the shared library, and then rerun the inferior twice, it starts up
OK the second time but when rerun the third time gdb fails to reinsert
the breakpoint in the shared library.

Here is a typescript showing an example of this behavior.  Note that I
manually removed some fully qualified pathnames from the gdb output in
order to simplify the example output.

  Script started on Wed Sep  6 08:47:00 2000
  $ cat bug.cc
      #include <iostream.h>
  
      int add(int a, int b);
  
      main ()
      {
          cerr << "Start of main" << endl;
          int total = add(4,6);
          cerr << "End of main: " << total << endl;
      }
  $ cat bugshared.cc
      int add(int a, int b)
      {
          return a+b;
      }
  $ g++ -g -o bug.o -c bug.cc
  $ g++ -g -o bugshared.o -c bugshared.cc
  $ g++ -g -o libbugshared.so -shared bugshared.o
  $ g++ -g -o bug bug.o -L. -Wl,-rpath . -lbugshared
  $ /usr/sourceware/bin/gdb -nw bug
  GNU gdb 5.0
  Copyright 2000 Free Software Foundation, Inc.
  GDB is free software, covered by the GNU General Public License, and you are
  welcome to change it and/or distribute copies of it under certain conditions.
  Type "show copying" to see the conditions.
  There is absolutely no warranty for GDB.  Type "show warranty" for details.
  This GDB was configured as "i686-pc-linux"...
  (gdb) set auto-solib-add 0
  (gdb) break main
  Breakpoint 1 at 0x80486c6: file bug.cc, line 7.
  (gdb) run
  Starting program: bug
  
  Breakpoint 1, main () at bug.cc:7
  7               cerr << "Start of main" << endl;
  (gdb) share bugshared
  Reading symbols from ./libbugshared.so...done.
  Loaded symbols for ./libbugshared.so
  (gdb) break bugshared.cc:3
  Breakpoint 2 at 0x400157e3: file bugshared.cc, line 3.
  (gdb) cont
  Continuing.
  Start of main
  
  Breakpoint 2, add (a=4, b=6) at bugshared.cc:3
  3               return a+b;
  (gdb) info shared
  From        To          Syms Read   Shared Object Library
  0x40015000  0x400169c4  Yes         ./libbugshared.so
  0x4001e000  0x4005ff90  No          /usr/lib/libstdc++-libc6.1-1.so.2
  0x40060000  0x4007c9d8  No          /lib/libm.so.6
  0x4007d000  0x4017185c  No          /lib/libc.so.6
  0x40000000  0x40013ed0  No          /lib/ld-linux.so.2
  (gdb) info break
  Num Type           Disp Enb Address    What
  1   breakpoint     keep y   0x080486c6 in main at bug.cc:7
          breakpoint already hit 1 time
  2   breakpoint     keep y   0x400157e3 in add(int, int) at bugshared.cc:3
          breakpoint already hit 1 time
  (gdb) run
  The program being debugged has been started already.
  Start it from the beginning? (y or n) y
  Starting program: bug
  
  Breakpoint 1, main () at bug.cc:7
  7               cerr << "Start of main" << endl;
  (gdb) info break
  Num Type           Disp Enb Address    What
  1   breakpoint     keep y   0x080486c6 in main at bug.cc:7
          breakpoint already hit 1 time
  2   breakpoint     keep y   0x400157e3 bugshared.cc:3
  (gdb) run
  The program being debugged has been started already.
  Start it from the beginning? (y or n) y
  Starting program: bug
  warning: Cannot insert breakpoint 2:
  Cannot access memory at address 0x400157e3
  (gdb) info break
  Num Type           Disp Enb Address    What
  1   breakpoint     keep y   0x080486c6 in main at bug.cc:7
  2   breakpoint     keep y   0x400157e3 bugshared.cc:3
  (gdb) quit
  The program is running.  Exit anyway? (y or n) y
  $ exit
  exit
  
  Script done on Wed Sep  6 08:50:30 2000

Here is an annotated output of an instrumented gdb:

         top.c: cmd: execute command 'file bug'
         top.c: cmd: execute command 'set auto-solib-add 0'
         top.c: cmd: execute command 'break main'

  (The first set of commands that load the shared library and set the
   breakpoints.  Notice that do_clear_solib is queued to be executed
   on the next 'run' command)

         top.c: cmd: execute command 'run'
  breakpoint.c: | >insert_breakpoints
  breakpoint.c: | <insert_breakpoints
  breakpoint.c: | >re_enable_breakpoints_in_shlibs
  breakpoint.c: | <re_enable_breakpoints_in_shlibs
  breakpoint.c: | >insert_breakpoints
  breakpoint.c: | <insert_breakpoints
  breakpoint.c: | >re_enable_breakpoints_in_shlibs
  breakpoint.c: | <re_enable_breakpoints_in_shlibs
  breakpoint.c: | >insert_breakpoints
  breakpoint.c: | <insert_breakpoints
         top.c: cmd: execute command 'share libS'
       solib.c: | >solib_add
       solib.c: | | >update_solib_list
       solib.c: | | | | solib: add so_list entry for './libShared.so'
       solib.c: | | | | solib: add so_list entry for '/lib/libm.so.6'
       solib.c: | | | | solib: add so_list entry for '/lib/libc.so.6'
       solib.c: | | | | solib: add so_list entry for '/lib/ld-linux.so.2'
       solib.c: | | | solib: queued do_clear_solib with make_run_cleanup
       solib.c: | | | | solib: process shared library './libShared.so'
       solib.c: | | | | solib: open bfd for './libShared.so'
       solib.c: | | | | solib: process shared library '/lib/libm.so.6'
       solib.c: | | | | solib: open bfd for '/lib/libm.so.6'
       solib.c: | | | | solib: process shared library '/lib/libc.so.6'
       solib.c: | | | | solib: open bfd for '/lib/libc.so.6'
       solib.c: | | | | solib: process shared library '/lib/ld-linux.so.2'
       solib.c: | | | | solib: open bfd for '/lib/ld-linux.so.2'
       solib.c: | | <update_solib_list
       solib.c: | | solib: load symbols for shared library './libShared.so'
       solib.c: | <solib_add
         top.c: cmd: execute command 'break shared.C:3'
         top.c: cmd: execute command 'cont'
  breakpoint.c: >insert_breakpoints
  breakpoint.c: <insert_breakpoints
         top.c: cmd: execute command 'info share'
       solib.c: | >update_solib_list
       solib.c: | | | solib: add so_list entry for './libShared.so'
       solib.c: | | | solib: add so_list entry for '/lib/libm.so.6'
       solib.c: | | | solib: add so_list entry for '/lib/libc.so.6'
       solib.c: | | | solib: add so_list entry for '/lib/ld-linux.so.2'
       solib.c: | <update_solib_list
         top.c: cmd: execute command 'info break'

  (The second run command.  What to note here is that do_clear_solib
  runs and discards the low level shared library information that
  solib_address uses to determine if an address is in a shared library.
  It also disables the breakpoints, so that gdb does not try to reinsert
  the shared library breakpoint until after the shared library is mapped
  back in.)

         top.c: cmd: execute command 'run'
       solib.c: >do_clear_solib
  breakpoint.c: | | >disable_breakpoints_in_shlibs
       solib.c: | | | >solib_address
       solib.c: | | | | solib: check if address 0x804a766 is in a shared lib
       solib.c: | | | <solib_address
       solib.c: | | | >solib_address
       solib.c: | | | | solib: check if address 0x40015806 is in a shared lib
       solib.c: | | | | solib: found it in './libShared.so'
       solib.c: | | | <solib_address
  breakpoint.c: | | <disable_breakpoints_in_shlibs
       solib.c: <do_clear_solib
  breakpoint.c: | >insert_breakpoints
  breakpoint.c: | <insert_breakpoints
  breakpoint.c: | >re_enable_breakpoints_in_shlibs
  breakpoint.c: | <re_enable_breakpoints_in_shlibs
  breakpoint.c: | >insert_breakpoints
  breakpoint.c: | <insert_breakpoints
  breakpoint.c: | >re_enable_breakpoints_in_shlibs
  breakpoint.c: | <re_enable_breakpoints_in_shlibs
  breakpoint.c: | >insert_breakpoints
  breakpoint.c: | <insert_breakpoints
         top.c: cmd: execute command 'info break'

  (The third run command.  Note that the low level solib info was discarded
   during the previous run, and nothing has reloaded it.  So the breakpoint
   in the shared library remains enabled.  Since the library is not yet mapped
   in, the breakpoint insertion fails.  If you were to run 'info share' before
   this run command, update_solib_list would be called and this run would
   then proceed correctly).

         top.c: cmd: execute command 'run'
  breakpoint.c: | >insert_breakpoints
       solib.c: | | >solib_address
       solib.c: | | | solib: check if address 0x40015806 is in a shared lib
       solib.c: | | <solib_address
    corefile.c: | | >memory_error

My analysis of the problem is that the auto-solib-add flag is intended
to prevent the automatic loading of shared library symbols (which can
be time consuming for large shared libraries or when there are lots of
shared libraries).  However the way it is currently used, which is to
decide whether or not to call solib_add, is too aggressive since
solib_add does things other than loading shared library symbol
information.  In particular, solib_add for our example calls
update_solib_list internally, which updates gdb's low level
information about currently mapped shared libraries.  Without this
information, things like solib_address don't work correctly.

I believe the correct fix is to always call solib_add, and let
solib_add for the given platform do whatever low level magic it needs
to, but use the auto-solib-add information to decide for itself
whether or not to load symbols.  Note that the HPUX ports already use
the auto-solib-add information internally to decide when to stop
loading symbols.

I've attached a proposed patch that does the following things:

(1) Adds a new "limit" argument to all the solib_add calls.  This
allows the callee to either pass in the current setting of the
auto_solib_add variable, or some other value as appropriate.  At this
time only the auto_solib_add value is passed, so strictly speaking, we
could get by with having the solib_add code just check the global
auto_solib_add value.  This would greatly simplify the patch and if it
is deemed more desirable to do it that way, I can redo the patch.

(2) Pave the way for adoption of the HPUX feature, or a modified
version of it, that allows the auto-solib-add value to be a threshold
of some sort rather than just a no/yes flag.  To be more portable
across platforms, it may need to be the aggregate size of the shared
library files, or perhaps the size of individual files, rather than
attempting to track the actual size of loaded symbols.  I.E. only
auto-load shared libraries that are smaller than some threshold value.

(3) Makes the default threshold value a manifest constant in each of
the *solib.h files, though it's currently only used for the HPUX
ports.

(4) Removes a couple cases of unused/dead code or variables related
to shared libraries.

If this patch is acceptable as is, please apply it.  Thanks!

-Fred

============================================================================

2000-09-06  Fred Fish  <fnf@cygnus.com>

	* symfile.c (auto_solib_add): Define, default to INT_MAX.
	* symfile.h (auto_solib_add): Remove declaration.
	* coff-solib.h (auto_solib_add): Declare.
	* pa64solib.h (auto_solib_add): Declare.
	* solib.h (auto_solib_add): Declare.
	* somsolib.h (auto_solib_add): Declare.
	* xcoffsolib.h (auto_solib_add): Declare.
	
	* coff-solib.h (SOLIB_ADD): Add limit argument.
	* pa64solib.h (SOLIB_ADD): Ditto.
	* solib.h (SOLIB_ADD): Ditto.
	* somsolib.h (SOLIB_ADD): Ditto.
	* config/rs6000/nm-rs6000.h (SOLIB_ADD): Ditto.
	* config/i386/tm-cygwin.h (SOLIB_ADD): Ditto.

	* coff-solib.h (coff_solib_add): Add limit arg to prototype decl.
	* pa64solib.h (pa64_solib_add): Ditto.
	* solib.h (solib_add): Ditto.
	* somsolib.h (som_solib_add): Ditto
	* config/i386/tm-cygwin.h (child_solib_add): Ditto.

	* coff-solib.c (coff_solib_add): Add "limit" argument.
	* irix5-nat.c (solib_add): Ditto.
	* osfsolib.c (solib_add): Ditto.
	* pa64solib.c (pa64_solib_add): Ditto.
	* solib.c (solib_add): Ditto.
	* somsolib.c (som_solib_add): Ditto.
	* xcoffsolib.c (solib_add): Ditto.
	* win32-nat.c (child_solib_add): Ditto.

	* irix5-nat.c (sharedlibrary_command): Pass auto_solib_add to solib_add.
	* osfsolib.c (sharedlibrary_command): Ditto.
	* pa64solib.c (pa64_solib_sharedlibrary_command): Ditto.
	* solib.c (sharedlibrary_command): Ditto.
	* somsolib.c (som_solib_sharedlibrary_command):  Ditto.
	* xcoffsolib.c (sharedlibrary_command):  Ditto.

	* coff-solib.c (coff_solib_add): Load symbols only if user explicitly
	asked for them, or the limit is not zero.
	* osfsolib.c (solib_add): Ditto.
	* irix5-nat.c (solib_add): Ditto.
	* solib.c (solib_add): Ditto.
	* xcoffsolib.c (solib_add): Ditto.
	* pa64solib.c (add_to_solist):  Load symbols only if user explicitly
	asked for them, or the threshold is not exceeded.
	* somsolib.c (som_solib_add): Ditto.

	* coff-solib.h (AUTO_SOLIB_ADD_THRESHOLD): Define, default 100 Mb.
	* solib.h (AUTO_SOLIB_ADD_THRESHOLD):  Define, default 100 Mb.
	* somsolib.h (AUTO_SOLIB_ADD_THRESHOLD):  Define, default 100 Mb.
	* pa64solib.h (AUTO_SOLIB_ADD_THRESHOLD):  Define, default 100 Mb.
	* xcoffsolib.h (AUTO_SOLIB_ADD_THRESHOLD): Define, default 100 Mb.

	* somsolib.c (_initialize_som_solib):  Reduce auto_solib_add to
	AUTO_SOLIB_ADD_THRESHOLD from INT_MAX.
	* pa64solib.c (_initialize_pa64_solib): Ditto.

	* pa64solib.c (pa64_solib_st_size_threshold): Local variable
	to hold limit passed to solib_add.
	(pa64_solib_add): Stash limit argument in pa64_solib_st_size_threshold.

	* irix5-nat.c (solib_create_inferior_hook):  Pass auto_solib_add to solib_add
	as the limit argument, rather than testing it directly.
	* osfsolib.c (solib_create_inferior_hook): Ditto.
	* solib.c (solib_create_inferior_hook): Ditto.
	* infrun.c (handle_inferior_event): Pass auto_solib_add as
	limit arg to SOLIB_ADD macro, rather than testing it directly.
	* infcmd.c (attach_command): Ditto.

	* coff-solib.c (coff_solib_create_inferior_hook): Call coff_solib_add with
	auto_solib_add as the limit argument.
	* sol-thread.c (sol_thread_attach): Call solib_add with auto_solib_add as
	the limit argument.
	* corelow.c (solib_add_stub): Pass auto_solib_add as limit
	arg in SOLIB_ADD macro.

	* coff-solib.h (DISABLE_UNSETTABLE_BREAK):  Remove unused macro that
	references a nonexistant coff_solib_address function.
	(solib_address): Remove unused decl.
	* infcmd.c (attach_command): Remove local decl of auto_solib_add.
	* fork-child.c (clone_and_follow_inferior): Remove unused decl of
	auto_solib_add.

Index: coff-solib.c
===================================================================
RCS file: /cvs/src/src/gdb/coff-solib.c,v
retrieving revision 1.2
diff -u -p -r1.2 coff-solib.c
--- coff-solib.c	2000/07/30 01:48:24	1.2
+++ coff-solib.c	2000/09/07 01:31:39
@@ -41,17 +41,20 @@
    SYNOPSIS
 
    void coff_solib_add (char *arg_string, int from_tty,
-   struct target_ops *target)
+   struct target_ops *target, int limit)
 
    DESCRIPTION
 
  */
 
 void
-coff_solib_add (char *arg_string, int from_tty, struct target_ops *target)
+coff_solib_add (char *arg_string, int from_tty, struct target_ops *target, int limit)
 {
   asection *libsect;
 
+  if (!from_tty && (limit == 0))
+    return;
+
   libsect = bfd_get_section_by_name (exec_bfd, ".lib");
 
   if (libsect)
@@ -125,5 +128,5 @@ coff_solib_add (char *arg_string, int fr
 void
 coff_solib_create_inferior_hook (void)
 {
-  coff_solib_add ((char *) 0, 0, (struct target_ops *) 0);
+  coff_solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
 }
Index: coff-solib.h
===================================================================
RCS file: /cvs/src/src/gdb/coff-solib.h,v
retrieving revision 1.2
diff -u -p -r1.2 coff-solib.h
--- coff-solib.h	2000/05/28 01:12:26	1.2
+++ coff-solib.h	2000/09/07 01:31:39
@@ -21,6 +21,38 @@
 /* Forward decl's for prototypes */
 struct target_ops;
 
+/* Control automatic loading of shared library symbols.
+
+   On all platforms, zero means do not auto load any symbols.  Shared
+   library symbols will only be loaded when explicitly requested by
+   the user via the "sharedlibrary" command.
+
+   With the exception noted below, nonzero means to automatically load
+   shared library symbols when they become available, such as when the
+   inferior is created, new libaries are loaded, or when attaching to
+   the inferior.  This is almost always what users will want to have
+   happen, but for very large programs, the startup time may become
+   excessive.  If this is a problem, the user can set this to zero and
+   then add the shared library symbols as needed.  Note that there is
+   a potential for confusion, since if the shared library symbols are
+   not loaded, commands like "info fun" will *not* report all the
+   functions that are actually present.
+	
+   On HP-UX, nonzero means to interpret the value as a threshold, in
+   megabytes, for the maximum cumulative size of solib symbols to add
+   automatically.  Once this threshold is exceeded, additional shared
+   libraries will have to be added manually.  */
+
+extern int auto_solib_add;
+
+/* Default value for auto_solib_add.  On platforms where the value is
+   tested for more than just zero/non-zero, it is a threshold size
+   in megabytes for the cumulative size of loaded symbols from shared
+   libraries.  Library symbols are automatically loaded until this
+   threshold is exceeded. */
+
+#define AUTO_SOLIB_ADD_THRESHOLD 100
+
 /* Called when we free all symtabs, to free the shared library information
    as well. */
 
@@ -32,10 +64,10 @@ extern void coff_clear_solib (void);
 
 /* Called to add symbols from a shared library to gdb's symbol table. */
 
-#define SOLIB_ADD(filename, from_tty, targ) \
-    coff_solib_add (filename, from_tty, targ)
+#define SOLIB_ADD(filename, from_tty, targ, limit) \
+    coff_solib_add (filename, from_tty, targ, limit)
 
-extern void coff_solib_add (char *, int, struct target_ops *);
+extern void coff_solib_add (char *, int, struct target_ops *, int);
 
 /* Function to be called when the inferior starts up, to discover the names
    of shared libraries that are dynamically linked, the base addresses to
@@ -175,12 +207,3 @@ extern void coff_solib_create_inferior_h
  */
 #define SOLIB_RESTART() \
   (0)
-
-/* If we can't set a breakpoint, and it's in a shared library, just
-   disable it.  */
-
-#if 0
-#define DISABLE_UNSETTABLE_BREAK(addr)	coff_solib_address(addr)
-
-extern int solib_address (CORE_ADDR);	/* solib.c */
-#endif
Index: corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.9
diff -u -p -r1.9 corelow.c
--- corelow.c	2000/09/01 23:41:20	1.9
+++ corelow.c	2000/09/07 01:31:39
@@ -219,7 +219,7 @@ core_close_cleanup (void *ignore)
 static int
 solib_add_stub (PTR from_ttyp)
 {
-  SOLIB_ADD (NULL, *(int *) from_ttyp, &current_target);
+  SOLIB_ADD (NULL, *(int *) from_ttyp, &current_target, auto_solib_add);
   re_enable_breakpoints_in_shlibs ();
   return 0;
 }
Index: fork-child.c
===================================================================
RCS file: /cvs/src/src/gdb/fork-child.c,v
retrieving revision 1.6
diff -u -p -r1.6 fork-child.c
--- fork-child.c	2000/09/01 23:39:11	1.6
+++ fork-child.c	2000/09/07 01:31:39
@@ -380,8 +380,6 @@ fork_inferior (char *exec_file, char *al
 void
 clone_and_follow_inferior (int child_pid, int *followed_child)
 {
-  extern int auto_solib_add;
-
   int debugger_pid;
   int status;
   char pid_spelling[100];	/* Arbitrary but sufficient length. */
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.11
diff -u -p -r1.11 infcmd.c
--- infcmd.c	2000/09/02 00:07:13	1.11
+++ infcmd.c	2000/09/07 01:31:39
@@ -1624,10 +1624,6 @@ nofp_registers_info (char *addr_exp, int
 void
 attach_command (char *args, int from_tty)
 {
-#ifdef SOLIB_ADD
-  extern int auto_solib_add;
-#endif
-
   char *exec_file;
   char *full_exec_path = NULL;
 
@@ -1689,12 +1685,9 @@ attach_command (char *args, int from_tty
     }
 
 #ifdef SOLIB_ADD
-  if (auto_solib_add)
-    {
-      /* Add shared library symbols from the newly attached process, if any.  */
-      SOLIB_ADD ((char *) 0, from_tty, &current_target);
-      re_enable_breakpoints_in_shlibs ();
-    }
+  /* Add shared library symbols from the newly attached process, if any.  */
+  SOLIB_ADD ((char *) 0, from_tty, &current_target, auto_solib_add);
+  re_enable_breakpoints_in_shlibs ();
 #endif
 
   /* Take any necessary post-attaching actions for this platform.
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.18
diff -u -p -r1.18 infrun.c
--- infrun.c	2000/09/02 00:08:05	1.18
+++ infrun.c	2000/09/07 01:31:40
@@ -1517,15 +1517,12 @@ handle_inferior_event (struct execution_
 	      remove_breakpoints ();
 
 	    /* Check for any newly added shared libraries if we're
-	       supposed to be adding them automatically.  */
-	    if (auto_solib_add)
-	      {
-		/* Switch terminal for any messages produced by
-		   breakpoint_re_set.  */
-		target_terminal_ours_for_output ();
-		SOLIB_ADD (NULL, 0, NULL);
-		target_terminal_inferior ();
-	      }
+	       supposed to be adding them automatically.  Switch
+	       terminal for any messages produced by
+	       breakpoint_re_set.  */
+	    target_terminal_ours_for_output ();
+	    SOLIB_ADD (NULL, 0, NULL, auto_solib_add);
+	    target_terminal_inferior ();
 
 	    /* Reinsert breakpoints and continue.  */
 	    if (breakpoints_inserted)
@@ -2438,15 +2435,12 @@ handle_inferior_event (struct execution_
 	    breakpoints_inserted = 0;
 
 	    /* Check for any newly added shared libraries if we're
-	       supposed to be adding them automatically.  */
-	    if (auto_solib_add)
-	      {
-		/* Switch terminal for any messages produced by
-		   breakpoint_re_set.  */
-		target_terminal_ours_for_output ();
-		SOLIB_ADD (NULL, 0, NULL);
-		target_terminal_inferior ();
-	      }
+	       supposed to be adding them automatically.  Switch
+	       terminal for any messages produced by
+	       breakpoint_re_set.  */
+	    target_terminal_ours_for_output ();
+	    SOLIB_ADD (NULL, 0, NULL, auto_solib_add);
+	    target_terminal_inferior ();
 
 	    /* Try to reenable shared library breakpoints, additional
 	       code segments in shared libraries might be mapped in now. */
Index: irix5-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/irix5-nat.c,v
retrieving revision 1.8
diff -u -p -r1.8 irix5-nat.c
--- irix5-nat.c	2000/08/09 20:09:01	1.8
+++ irix5-nat.c	2000/09/07 01:31:41
@@ -852,14 +852,14 @@ symbol_add_stub (void *arg)
    SYNOPSIS
 
    void solib_add (char *arg_string, int from_tty,
-   struct target_ops *target)
+   struct target_ops *target, int limit)
 
    DESCRIPTION
 
  */
 
 void
-solib_add (char *arg_string, int from_tty, struct target_ops *target)
+solib_add (char *arg_string, int from_tty, struct target_ops *target, int limit)
 {
   register struct so_list *so = NULL;	/* link map state variable */
 
@@ -875,6 +875,9 @@ solib_add (char *arg_string, int from_tt
       error ("Invalid regexp: %s", re_err);
     }
 
+  if (!from_tty && (limit == 0))
+    return;
+
   /* Add the shared library sections to the section table of the
      specified target, if any.  */
   if (target)
@@ -1241,8 +1244,7 @@ solib_create_inferior_hook (void)
      and will put out an annoying warning.
      Delaying the resetting of stop_soon_quietly until after symbol loading
      suppresses the warning.  */
-  if (auto_solib_add)
-    solib_add ((char *) 0, 0, (struct target_ops *) 0);
+  solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
   stop_soon_quietly = 0;
 }
 
@@ -1264,7 +1266,7 @@ static void
 sharedlibrary_command (char *args, int from_tty)
 {
   dont_repeat ();
-  solib_add (args, from_tty, (struct target_ops *) 0);
+  solib_add (args, from_tty, (struct target_ops *) 0, auto_solib_add);
 }
 
 void
Index: osfsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/osfsolib.c,v
retrieving revision 1.5
diff -u -p -r1.5 osfsolib.c
--- osfsolib.c	2000/07/30 01:48:26	1.5
+++ osfsolib.c	2000/09/07 01:31:41
@@ -596,14 +596,14 @@ symbol_add_stub (char *arg)
    SYNOPSIS
 
    void solib_add (char *arg_string, int from_tty,
-   struct target_ops *target)
+   struct target_ops *target, int limit)
 
    DESCRIPTION
 
  */
 
 void
-solib_add (char *arg_string, int from_tty, struct target_ops *target)
+solib_add (char *arg_string, int from_tty, struct target_ops *target, int limit)
 {
   register struct so_list *so = NULL;	/* link map state variable */
 
@@ -619,6 +619,8 @@ solib_add (char *arg_string, int from_tt
       error ("Invalid regexp: %s", re_err);
     }
 
+  if (!from_tty && (limit == 0))
+    return;
 
   /* Add the shared library sections to the section table of the
      specified target, if any.  */
@@ -887,8 +889,7 @@ solib_create_inferior_hook (void)
      and will put out an annoying warning.
      Delaying the resetting of stop_soon_quietly until after symbol loading
      suppresses the warning.  */
-  if (auto_solib_add)
-    solib_add ((char *) 0, 0, (struct target_ops *) 0);
+  solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
   stop_soon_quietly = 0;
 }
 
@@ -911,7 +912,7 @@ static void
 sharedlibrary_command (char *args, int from_tty)
 {
   dont_repeat ();
-  solib_add (args, from_tty, (struct target_ops *) 0);
+  solib_add (args, from_tty, (struct target_ops *) 0, auto_solib_add);
 }
 
 void
Index: pa64solib.c
===================================================================
RCS file: /cvs/src/src/gdb/pa64solib.c,v
retrieving revision 1.7
diff -u -p -r1.7 pa64solib.c
--- pa64solib.c	2000/08/27 22:30:29	1.7
+++ pa64solib.c	2000/09/07 01:31:41
@@ -104,6 +104,9 @@ static LONGEST pa64_solib_total_st_size;
    is exceeded due to a very large number of shlibs.) */
 static int pa64_solib_st_size_threshold_exceeded;
 
+/* The threshold size in megabytes, as passed to pa64_solib_add. */
+static int pa64_solib_st_size_threshold;
+
 /* When adding fields, be sure to clear them in _initialize_pa64_solib. */
 typedef struct
   {
@@ -371,7 +374,7 @@ pa64_solib_load_symbols (struct so_list 
    be exceeded.  */
 
 void
-pa64_solib_add (char *arg_string, int from_tty, struct target_ops *target)
+pa64_solib_add (char *arg_string, int from_tty, struct target_ops *target, int limit)
 {
   struct minimal_symbol *msymbol;
   CORE_ADDR addr;
@@ -384,6 +387,7 @@ pa64_solib_add (char *arg_string, int fr
   struct load_module_desc dll_desc;
   char *dll_path;
 
+  pa64_solib_st_size_threshold = limit;
   /* First validate our arguments.  */
   if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL)
     {
@@ -817,7 +821,7 @@ static void
 pa64_solib_sharedlibrary_command (char *args, int from_tty)
 {
   dont_repeat ();
-  pa64_solib_add (args, from_tty, (struct target_ops *) 0);
+  pa64_solib_add (args, from_tty, (struct target_ops *) 0, auto_solib_add);
 }
 
 /* Return the name of the shared library containing ADDR or NULL if ADDR
@@ -896,18 +900,7 @@ of the program and libraries exceeds thi
 Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
 		  &setlist),
      &showlist);
-
-  /* ??rehrauer: On HP-UX, the kernel parameter MAXDSIZ limits how much
-     data space a process can use.  We ought to be reading MAXDSIZ and
-     setting auto_solib_add to some large fraction of that value.  If
-     not that, we maybe ought to be setting it smaller than the default
-     for MAXDSIZ (that being 64Mb, I believe).  However, [1] this threshold
-     is only crudely approximated rather than actually measured, and [2]
-     50 Mbytes is too small for debugging gdb itself.  Thus, the arbitrary
-     100 figure.
-   */
-  auto_solib_add = 100;		/* Megabytes */
-
+  auto_solib_add = AUTO_SOLIB_ADD_THRESHOLD;
   pa64_solib_restart ();
 }
 
@@ -1155,9 +1148,9 @@ add_to_solist (boolean from_tty, char *d
 
   st_size = pa64_solib_sizeof_symbol_table (dll_path);
   pa64_solib_st_size_threshhold_exceeded =
-       !from_tty 
-    && (  (st_size + pa64_solib_total_st_size) 
-	> (auto_solib_add * (LONGEST)1000000));
+    !from_tty 
+    && ((st_size + pa64_solib_total_st_size) 
+	> (pa64_solib_st_size_threshold * (LONGEST) 1000000));
   if (pa64_solib_st_size_threshhold_exceeded)
     {
       pa64_solib_add_solib_objfile (new_so, dll_path, from_tty, 1);
Index: pa64solib.h
===================================================================
RCS file: /cvs/src/src/gdb/pa64solib.h,v
retrieving revision 1.2
diff -u -p -r1.2 pa64solib.h
--- pa64solib.h	2000/05/28 01:12:28	1.2
+++ pa64solib.h	2000/09/07 01:31:41
@@ -23,12 +23,53 @@ struct target_ops;
 struct objfile;
 struct section_offsets;
 
+/* Control automatic loading of shared library symbols.
+
+   On all platforms, zero means do not auto load any symbols.  Shared
+   library symbols will only be loaded when explicitly requested by
+   the user via the "sharedlibrary" command.
+
+   With the exception noted below, nonzero means to automatically load
+   shared library symbols when they become available, such as when the
+   inferior is created, new libaries are loaded, or when attaching to
+   the inferior.  This is almost always what users will want to have
+   happen, but for very large programs, the startup time may become
+   excessive.  If this is a problem, the user can set this to zero and
+   then add the shared library symbols as needed.  Note that there is
+   a potential for confusion, since if the shared library symbols are
+   not loaded, commands like "info fun" will *not* report all the
+   functions that are actually present.
+	
+   On HP-UX, nonzero means to interpret the value as a threshold, in
+   megabytes, for the maximum cumulative size of solib symbols to add
+   automatically.  Once this threshold is exceeded, additional shared
+   libraries will have to be added manually.  */
+
+extern int auto_solib_add;
+
+/* Default value for auto_solib_add.  On platforms where the value is
+   tested for more than just zero/non-zero, it is a threshold size
+   in megabytes for the cumulative size of loaded symbols from shared
+   libraries.  Library symbols are automatically loaded until this
+   threshold is exceeded.
+
+   ??rehrauer: On HP-UX, the kernel parameter MAXDSIZ limits how much
+   data space a process can use.  We ought to be reading MAXDSIZ and
+   setting auto_solib_add to some large fraction of that value.  If
+   not that, we maybe ought to be setting it smaller than the default
+   for MAXDSIZ (that being 64Mb, I believe).  However, [1] this
+   threshold is only crudely approximated rather than actually
+   measured, and [2] 50 Mbytes is too small for debugging gdb itself.
+   Thus, the arbitrary 100 figure. */
+
+#define AUTO_SOLIB_ADD_THRESHOLD 100
+
 /* Called to add symbols from a shared library to gdb's symbol table.  */
 
-#define SOLIB_ADD(filename, from_tty, targ) \
-    pa64_solib_add (filename, from_tty, targ)
+#define SOLIB_ADD(filename, from_tty, targ, limit) \
+    pa64_solib_add (filename, from_tty, targ, limit)
 
-extern void pa64_solib_add (char *, int, struct target_ops *);
+extern void pa64_solib_add (char *, int, struct target_ops *, int);
 
 extern CORE_ADDR pa64_solib_get_got_by_pc (CORE_ADDR);
 
Index: sol-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/sol-thread.c,v
retrieving revision 1.16
diff -u -p -r1.16 sol-thread.c
--- sol-thread.c	2000/09/05 17:43:00	1.16
+++ sol-thread.c	2000/09/07 01:31:41
@@ -454,7 +454,7 @@ sol_thread_attach (char *args, int from_
   procfs_ops.to_attach (args, from_tty);
 
   /* Must get symbols from solibs before libthread_db can run! */
-  SOLIB_ADD ((char *) 0, from_tty, (struct target_ops *) 0);
+  SOLIB_ADD ((char *) 0, from_tty, (struct target_ops *) 0, auto_solib_add);
 
   if (sol_thread_active)
     {
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.22
diff -u -p -r1.22 solib.c
--- solib.c	2000/08/31 00:39:10	1.22
+++ solib.c	2000/09/07 01:31:42
@@ -1551,7 +1551,7 @@ update_solib_list (int from_tty, struct 
 
    SYNOPSIS
 
-   void solib_add (char *pattern, int from_tty, struct target_ops *TARGET)
+   void solib_add (char *pattern, int from_tty, struct target_ops *TARGET, int limit)
 
    DESCRIPTION
 
@@ -1562,7 +1562,7 @@ update_solib_list (int from_tty, struct 
    FROM_TTY and TARGET are as described for update_solib_list, above.  */
 
 void
-solib_add (char *pattern, int from_tty, struct target_ops *target)
+solib_add (char *pattern, int from_tty, struct target_ops *target, int limit)
 {
   struct so_list *gdb;
 
@@ -1579,6 +1579,7 @@ solib_add (char *pattern, int from_tty, 
   /* Walk the list of currently loaded shared libraries, and read
      symbols for any that match the pattern --- or any whose symbols
      aren't already loaded, if no pattern was given.  */
+  if (from_tty || (limit != 0))
   {
     int any_matches = 0;
     int loaded_any_symbols = 0;
@@ -2187,8 +2188,7 @@ solib_create_inferior_hook (void)
       warning ("shared library handler failed to disable breakpoint");
     }
 
-  if (auto_solib_add)
-    solib_add ((char *) 0, 0, (struct target_ops *) 0);
+  solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
 #endif /* ! _SCO_DS */
 #endif
 }
@@ -2278,7 +2278,7 @@ static void
 sharedlibrary_command (char *args, int from_tty)
 {
   dont_repeat ();
-  solib_add (args, from_tty, (struct target_ops *) 0);
+  solib_add (args, from_tty, (struct target_ops *) 0, auto_solib_add);
 }
 
 #endif /* HAVE_LINK_H */
Index: solib.h
===================================================================
RCS file: /cvs/src/src/gdb/solib.h,v
retrieving revision 1.2
diff -u -p -r1.2 solib.h
--- solib.h	2000/05/28 01:12:29	1.2
+++ solib.h	2000/09/07 01:31:42
@@ -21,6 +21,38 @@
 /* Forward decl's for prototypes */
 struct target_ops;
 
+/* Control automatic loading of shared library symbols.
+
+   On all platforms, zero means do not auto load any symbols.  Shared
+   library symbols will only be loaded when explicitly requested by
+   the user via the "sharedlibrary" command.
+
+   With the exception noted below, nonzero means to automatically load
+   shared library symbols when they become available, such as when the
+   inferior is created, new libaries are loaded, or when attaching to
+   the inferior.  This is almost always what users will want to have
+   happen, but for very large programs, the startup time may become
+   excessive.  If this is a problem, the user can set this to zero and
+   then add the shared library symbols as needed.  Note that there is
+   a potential for confusion, since if the shared library symbols are
+   not loaded, commands like "info fun" will *not* report all the
+   functions that are actually present.
+	
+   On HP-UX, nonzero means to interpret the value as a threshold, in
+   megabytes, for the maximum cumulative size of solib symbols to add
+   automatically.  Once this threshold is exceeded, additional shared
+   libraries will have to be added manually. */
+
+extern int auto_solib_add;
+
+/* Default value for auto_solib_add.  On platforms where the value is
+   tested for more than just zero/non-zero, it is a threshold size
+   in megabytes for the cumulative size of loaded symbols from shared
+   libraries.  Library symbols are automatically loaded until this
+   threshold is exceeded. */
+
+#define AUTO_SOLIB_ADD_THRESHOLD 100
+
 /* Called when we free all symtabs, to free the shared library information
    as well. */
 
@@ -30,10 +62,10 @@ extern void clear_solib (void);
 
 /* Called to add symbols from a shared library to gdb's symbol table. */
 
-#define SOLIB_ADD(filename, from_tty, targ) \
-    solib_add (filename, from_tty, targ)
+#define SOLIB_ADD(filename, from_tty, targ, limit) \
+    solib_add (filename, from_tty, targ, limit)
 
-extern void solib_add (char *, int, struct target_ops *);
+extern void solib_add (char *, int, struct target_ops *, int);
 
 /* Function to be called when the inferior starts up, to discover the names
    of shared libraries that are dynamically linked, the base addresses to
Index: somsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/somsolib.c,v
retrieving revision 1.6
diff -u -p -r1.6 somsolib.c
--- somsolib.c	2000/08/27 22:30:29	1.6
+++ somsolib.c	2000/09/07 01:31:42
@@ -389,7 +389,7 @@ som_solib_load_symbols (struct so_list *
    be exceeded.  */
 
 void
-som_solib_add (char *arg_string, int from_tty, struct target_ops *target)
+som_solib_add (char *arg_string, int from_tty, struct target_ops *target, int limit)
 {
   struct minimal_symbol *msymbol;
   struct so_list *so_list_tail;
@@ -758,8 +758,8 @@ som_solib_add (char *arg_string, int fro
        */
       st_size = som_solib_sizeof_symbol_table (name);
       som_solib_st_size_threshold_exceeded =
-	!from_tty &&
-	((st_size + som_solib_total_st_size) > (auto_solib_add * (LONGEST) 1000000));
+	!from_tty
+	&& ((st_size + som_solib_total_st_size) > (limit * (LONGEST) 1000000));
 
       if (som_solib_st_size_threshold_exceeded)
 	{
@@ -1458,7 +1458,7 @@ static void
 som_solib_sharedlibrary_command (char *args, int from_tty)
 {
   dont_repeat ();
-  som_solib_add (args, from_tty, (struct target_ops *) 0);
+  som_solib_add (args, from_tty, (struct target_ops *) 0, auto_solib_add);
 }
 
 
@@ -1552,18 +1552,7 @@ of the program and libraries exceeds thi
 Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
 		  &setlist),
      &showlist);
-
-  /* ??rehrauer: On HP-UX, the kernel parameter MAXDSIZ limits how much
-     data space a process can use.  We ought to be reading MAXDSIZ and
-     setting auto_solib_add to some large fraction of that value.  If
-     not that, we maybe ought to be setting it smaller than the default
-     for MAXDSIZ (that being 64Mb, I believe).  However, [1] this threshold
-     is only crudely approximated rather than actually measured, and [2]
-     50 Mbytes is too small for debugging gdb itself.  Thus, the arbitrary
-     100 figure.
-   */
-  auto_solib_add = 100;		/* Megabytes */
-
+  auto_solib_add = AUTO_SOLIB_ADD_THRESHOLD;
   som_solib_restart ();
 }
 
Index: somsolib.h
===================================================================
RCS file: /cvs/src/src/gdb/somsolib.h,v
retrieving revision 1.2
diff -u -p -r1.2 somsolib.h
--- somsolib.h	2000/05/28 01:12:29	1.2
+++ somsolib.h	2000/09/07 01:31:42
@@ -26,12 +26,44 @@ struct target_ops;
 struct objfile;
 struct section_offsets;
 
+/* Control automatic loading of shared library symbols.
+
+   On all platforms, zero means do not auto load any symbols.  Shared
+   library symbols will only be loaded when explicitly requested by
+   the user via the "sharedlibrary" command.
+
+   With the exception noted below, nonzero means to automatically load
+   shared library symbols when they become available, such as when the
+   inferior is created, new libaries are loaded, or when attaching to
+   the inferior.  This is almost always what users will want to have
+   happen, but for very large programs, the startup time may become
+   excessive.  If this is a problem, the user can set this to zero and
+   then add the shared library symbols as needed.  Note that there is
+   a potential for confusion, since if the shared library symbols are
+   not loaded, commands like "info fun" will *not* report all the
+   functions that are actually present.
+	
+   On HP-UX, nonzero means to interpret the value as a threshold, in
+   megabytes, for the maximum cumulative size of solib symbols to add
+   automatically.  Once this threshold is exceeded, additional shared
+   libraries will have to be added manually.  */
+
+extern int auto_solib_add;
+
+/* Default value for auto_solib_add.  On platforms where the value is
+   tested for more than just zero/non-zero, it is a threshold size
+   in megabytes for the cumulative size of loaded symbols from shared
+   libraries.  Library symbols are automatically loaded until this
+   threshold is exceeded. */
+
+#define AUTO_SOLIB_ADD_THRESHOLD 100
+
 /* Called to add symbols from a shared library to gdb's symbol table. */
 
-#define SOLIB_ADD(filename, from_tty, targ) \
-    som_solib_add (filename, from_tty, targ)
+#define SOLIB_ADD(filename, from_tty, targ, limit) \
+    som_solib_add (filename, from_tty, targ, limit)
 
-extern void som_solib_add (char *, int, struct target_ops *);
+extern void som_solib_add (char *, int, struct target_ops *, int);
 
 extern CORE_ADDR som_solib_get_got_by_pc (CORE_ADDR);
 
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.18
diff -u -p -r1.18 symfile.c
--- symfile.c	2000/09/02 00:09:06	1.18
+++ symfile.c	2000/09/07 01:31:43
@@ -178,27 +178,29 @@ int symbol_reloading = SYMBOL_RELOADING_
 int symbol_reloading = 0;
 #endif
 
-/* If non-zero, then on HP-UX (i.e., platforms that use somsolib.c),
-   this variable is interpreted as a threshhold.  If adding a new
-   library's symbol table to those already known to the debugger would
-   exceed this threshhold, then the shlib's symbols are not added.
+/* Control automatic loading of shared library symbols.
 
-   If non-zero on other platforms, shared library symbols will be added
-   automatically when the inferior is created, new libraries are loaded,
-   or when attaching to the inferior.  This is almost always what users
-   will want to have happen; but for very large programs, the startup
-   time will be excessive, and so if this is a problem, the user can
-   clear this flag and then add the shared library symbols as needed.
-   Note that there is a potential for confusion, since if the shared
-   library symbols are not loaded, commands like "info fun" will *not*
-   report all the functions that are actually present. 
+   On all platforms, zero means do not auto load any symbols.  Shared
+   library symbols will only be loaded when explicitly requested by
+   the user via the "sharedlibrary" command.
 
-   Note that HP-UX interprets this variable to mean, "threshhold size
-   in megabytes, where zero means never add".  Other platforms interpret
-   this variable to mean, "always add if non-zero, never add if zero."
- */
+   With the exception noted below, nonzero means to automatically load
+   shared library symbols when they become available, such as when the
+   inferior is created, new libaries are loaded, or when attaching to
+   the inferior.  This is almost always what users will want to have
+   happen, but for very large programs, the startup time may become
+   excessive.  If this is a problem, the user can set this to zero and
+   then add the shared library symbols as needed.  Note that there is
+   a potential for confusion, since if the shared library symbols are
+   not loaded, commands like "info fun" will *not* report all the
+   functions that are actually present.
+	
+   On HP-UX, nonzero means to interpret the value as a threshold, in
+   megabytes, for the maximum cumulative size of solib symbols to add
+   automatically.  Once this threshold is exceeded, additional shared
+   libraries will have to be added manually.  */
 
-int auto_solib_add = 1;
+int auto_solib_add = INT_MAX;
 
 
 /* Since this function is called from within qsort, in an ANSI environment
Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.6
diff -u -p -r1.6 symfile.h
--- symfile.h	2000/09/02 00:12:17	1.6
+++ symfile.h	2000/09/07 01:31:43
@@ -217,19 +217,6 @@ extern char *obconcat (struct obstack *o
 
 			/*   Variables   */
 
-/* whether to auto load solibs at startup time:  0/1. 
-
-   On all platforms, 0 means "don't auto load".
-
-   On HP-UX, > 0 means a threshhold, in megabytes, of symbol table which will
-   be auto loaded.  When the cumulative size of solib symbol table exceeds
-   this threshhold, solibs' symbol tables will not be loaded.
-
-   On other platforms, > 0 means, "always auto load".
- */
-
-extern int auto_solib_add;
-
 /* From symfile.c */
 
 extern CORE_ADDR entry_point_address (void);
Index: win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.15
diff -u -p -r1.15 win32-nat.c
--- win32-nat.c	2000/08/27 04:21:35	1.15
+++ win32-nat.c	2000/09/07 01:31:44
@@ -1618,7 +1618,7 @@ out:
 }
 
 void
-child_solib_add (char *filename ATTRIBUTE_UNUSED, int from_tty ATTRIBUTE_UNUSED, struct target_ops *target)
+child_solib_add (char *filename ATTRIBUTE_UNUSED, int from_tty ATTRIBUTE_UNUSED, struct target_ops *target, int limit ATTRIBUTE_UNUSED)
 {
   if (core_bfd)
     {
Index: xcoffsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/xcoffsolib.c,v
retrieving revision 1.5
diff -u -p -r1.5 xcoffsolib.c
--- xcoffsolib.c	2000/07/30 01:48:28	1.5
+++ xcoffsolib.c	2000/09/07 01:31:44
@@ -45,7 +45,7 @@ extern int current_source_line;
    the section list.  */
 
 void
-solib_add (char *arg_string, int from_tty, struct target_ops *target)
+solib_add (char *arg_string, int from_tty, struct target_ops *target, int limit)
 {
   char *val;
   struct vmap *vp = vmap;
@@ -65,6 +65,9 @@ solib_add (char *arg_string, int from_tt
   if (!vp || !vp->nxt)
     return;
 
+  if (!from_tty && (limit == 0))
+    return;
+
   /* save current symbol table and line number, in case they get changed
      in symbol loading process. */
 
@@ -207,7 +210,7 @@ sharedlibrary_command (char *args, int f
     (*xcoff_relocate_symtab_hook) (inferior_pid);
 
 #ifdef SOLIB_SYMBOLS_MANUAL
-  solib_add (args, from_tty, (struct target_ops *) 0);
+  solib_add (args, from_tty, (struct target_ops *) 0, auto_solib_add);
 #endif /* SOLIB_SYMBOLS_MANUAL */
 }
 
Index: xcoffsolib.h
===================================================================
RCS file: /cvs/src/src/gdb/xcoffsolib.h,v
retrieving revision 1.2
diff -u -p -r1.2 xcoffsolib.h
--- xcoffsolib.h	2000/06/04 00:41:09	1.2
+++ xcoffsolib.h	2000/09/07 01:31:44
@@ -59,3 +59,37 @@ extern struct vmap *vmap;
 /* Hook for symbol table relocation at runtime. */
 
 extern void (*xcoff_relocate_symtab_hook) (unsigned int);
+
+/* Control automatic loading of shared library symbols.
+
+   On all platforms, zero means do not auto load any symbols.  Shared
+   library symbols will only be loaded when explicitly requested by
+   the user via the "sharedlibrary" command.
+
+   With the exception noted below, nonzero means to automatically load
+   shared library symbols when they become available, such as when the
+   inferior is created, new libaries are loaded, or when attaching to
+   the inferior.  This is almost always what users will want to have
+   happen, but for very large programs, the startup time may become
+   excessive.  If this is a problem, the user can set this to zero and
+   then add the shared library symbols as needed.  Note that there is
+   a potential for confusion, since if the shared library symbols are
+   not loaded, commands like "info fun" will *not* report all the
+   functions that are actually present.
+	
+   On HP-UX, nonzero means to interpret the value as a threshold, in
+   megabytes, for the maximum cumulative size of solib symbols to add
+   automatically.  Once this threshold is exceeded, additional shared
+   libraries will have to be added manually.  */
+
+extern int auto_solib_add;
+
+/* Default value for auto_solib_add.  On platforms where the value is
+   tested for more than just zero/non-zero, it is a threshold size
+   in megabytes for the cumulative size of loaded symbols from shared
+   libraries.  Library symbols are automatically loaded until this
+   threshold is exceeded. */
+
+#define AUTO_SOLIB_ADD_THRESHOLD 100
+
+
Index: config/i386/tm-cygwin.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-cygwin.h,v
retrieving revision 1.6
diff -u -p -r1.6 tm-cygwin.h
--- config/i386/tm-cygwin.h	2000/08/27 04:21:35	1.6
+++ config/i386/tm-cygwin.h	2000/09/07 01:31:44
@@ -31,14 +31,14 @@ extern CORE_ADDR skip_trampoline_code (C
 #endif
 
 #define ATTACH_NO_WAIT
-#define SOLIB_ADD(filename, from_tty, targ) child_solib_add(filename, from_tty, targ)
+#define SOLIB_ADD(filename, from_tty, targ, limit) child_solib_add(filename, from_tty, targ, limit)
 #define SOLIB_LOADED_LIBRARY_PATHNAME(pid) child_solib_loaded_library_pathname(pid)
 #define CLEAR_SOLIB child_clear_solibs
 #define ADD_SHARED_SYMBOL_FILES dll_symbol_command
 
 struct target_ops;
 char *cygwin_pid_to_str (int pid);
-void child_solib_add (char *, int, struct target_ops *);
+void child_solib_add (char *, int, struct target_ops *, int);
 char *child_solib_loaded_library_pathname(int);
 void child_clear_solibs (void);
 void dll_symbol_command (char *, int);
Index: config/rs6000/nm-rs6000.h
===================================================================
RCS file: /cvs/src/src/gdb/config/rs6000/nm-rs6000.h,v
retrieving revision 1.3
diff -u -p -r1.3 nm-rs6000.h
--- config/rs6000/nm-rs6000.h	2000/06/16 21:02:22	1.3
+++ config/rs6000/nm-rs6000.h	2000/09/07 01:31:46
@@ -45,7 +45,7 @@
 /* When a target process or core-file has been attached, we sneak in
    and figure out where the shared libraries have got to.  */
 
-#define	SOLIB_ADD(a, b, c)	\
+#define	SOLIB_ADD(a, b, c, d)	\
   if (inferior_pid)	\
     /* Attach to process.  */  \
     xcoff_relocate_symtab (inferior_pid); \
Index: doc/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/doc/ChangeLog,v
retrieving revision 1.49
diff -u -p -r1.49 ChangeLog
--- doc/ChangeLog	2000/08/10 13:42:29	1.49
+++ doc/ChangeLog	2000/09/07 01:31:47
@@ -1,3 +1,7 @@
+2000-09-05  Fred Fish  <fnf@cygnus.com>
+
+	* gdbint.texinfo (SOLIB_ADD): Document use of new limit arg.
+
 2000-08-10  Mark Kettenis  <kettenis@gnu.org>
 
 	* gdbint.texinfo (Overall Structure): Spelling fix.
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.15
diff -u -p -r1.15 gdbint.texinfo
--- doc/gdbint.texinfo	2000/08/10 13:42:29	1.15
+++ doc/gdbint.texinfo	2000/09/07 01:31:48
@@ -2562,9 +2562,11 @@ inferior.
 If defined, this is the name of the shell to use to run the inferior.
 Defaults to @code{"/bin/sh"}.
 
-@item SOLIB_ADD (filename, from_tty, targ)
+@item SOLIB_ADD (filename, from_tty, targ, limit)
 Define this to expand into an expression that will cause the symbols in
-@var{filename} to be added to @value{GDBN}'s symbol table.
+@var{filename} to be added to @value{GDBN}'s symbol table.  The
+@var{limit} value sets a limit in megabytes on the aggregate size of
+shared libraries that will be automatically loaded.
 
 @item SOLIB_CREATE_INFERIOR_HOOK
 Define this to expand into any shared-library-relocation code that you

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]