From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fred Fish To: fnf@redhat.com Cc: kevinb@cygnus.com (Kevin Buettner), fnf@cygnus.com, gdb-patches@sourceware.cygnus.com Subject: [PATCH] Fix auto-solib-add bug (patch revised 7/1/2001) Date: Sun, 01 Jul 2001 15:21:00 -0000 Message-id: <200107012207.f61M73600827@gofish.ninemoons.com> References: <200106290209.f5T29qh20491@gofish.ninemoons.com> X-SW-Source: 2001-07/msg00003.html > > What does ``INT_MAX >> 22'' represent? > > I don't recall now why I chose that particular value, I've revised the patch so that the code uses -1 to indicate that symbols should be unconditionally loaded such as with the "sharedlibrary" command. Here is the latest patch, which should apply cleanly to the sourceware gdb sources as of today. I also made a couple of other minor tweaks and cleanups. -Fred 2001-07-01 Fred Fish * symfile.h (auto_solib_add): Remove decl. * coff-solib.h (auto_solib_add): Add decl. * solib.h (auto_solib_add): Ditto. * somsolib.h (auto_solib_add): Ditto. * coff-solib.c (coff_solib_add): Add syms if threshold is nonzero. * irix5-nat.c: Ditto. * osfsolib.c (solib_add): Ditto. * solib.c (solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * irix5-nat.c (sharedlibrary_command): Pass -1 as threshold 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. * coff-solib.h (coff_solib_add): Adjust prototype for new threshold arg. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * 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 new threshold arg. * irix5-nat.c (solib_add): Ditto. * osfsolib.c (solib_add): Ditto. * pa64solib.c (pa64_solib_add): Ditto. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * solib.c (solib_add): Ditto. * somsolib.c (som_solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * coff-solib.c (coff_solib_create_inferior_hook): Call solib_add unconditionally with auto_solib_add. * irix5-nat.c (solib_create_inferior_hook): Ditto. * osfsolib.c (solib_create_inferior_hook): Ditto. * solib-osf.c (osf_solib_create_inferior_hook): Ditto. * solib-svr4.c (svr4_solib_create_inferior_hook): Ditto. * corelow.c (solib_add_stub): Add auto_solib_add to args passed via SOLIB_ADD. * sol-thread.c (sol_thread_attach): Ditto. * config/rs6000/nm-rs6000.h (SOLIB_ADD): Ditto. * infcmd.c (attach_command): Remove auto_solib_add decl. Call SOLIB_ADD directly with auto_solib_add. * infrun.c (handle_inferior_event): Ditto. * coff-solib.h (SOLIB_ADD): Add threshold arg. * pa64solib.h (SOLIB_ADD): Ditto. * solib.h (SOLIB_ADD): Ditto. * somsolib.h (SOLIB_ADD): Ditto. * config/i386/tm-cygwin.h (SOLIB_ADD): Ditto. * fork-child.c (clone_and_follow_inferior): Remove unused auto_solib_add decl. * pa64solib.c (pa64_solib_add): Call add_to_solist with threshold. (read_dld_descriptor): Ditto. (pa64_solib_add): Call read_dld_descriptor with threshold. (pa64_solib_in_dynamic_linker): Ditto. * somsolib.c (som_solib_add): A megabyte is 1048576 bytes. * pa64solib.c (add_to_solist): Ditto. Index: coff-solib.c =================================================================== RCS file: /cvs/src/src/gdb/coff-solib.c,v retrieving revision 1.4 diff -c -p -r1.4 coff-solib.c *** coff-solib.c 2001/06/28 19:54:41 1.4 --- coff-solib.c 2001/07/01 22:13:22 *************** *** 43,59 **** SYNOPSIS void coff_solib_add (char *arg_string, int from_tty, ! struct target_ops *target) DESCRIPTION */ void ! coff_solib_add (char *arg_string, int from_tty, struct target_ops *target) { asection *libsect; libsect = bfd_get_section_by_name (exec_bfd, ".lib"); if (libsect) --- 43,62 ---- SYNOPSIS void coff_solib_add (char *arg_string, int from_tty, ! struct target_ops *target, int threshold) DESCRIPTION */ void ! coff_solib_add (char *arg_string, int from_tty, struct target_ops *target, int threshold) { asection *libsect; + if (threshold == 0) + return; + libsect = bfd_get_section_by_name (exec_bfd, ".lib"); if (libsect) *************** coff_solib_add (char *arg_string, int fr *** 127,131 **** void coff_solib_create_inferior_hook (void) { ! coff_solib_add ((char *) 0, 0, (struct target_ops *) 0); } --- 130,134 ---- void coff_solib_create_inferior_hook (void) { ! 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.3 diff -c -p -r1.3 coff-solib.h *** coff-solib.h 2001/03/06 08:21:06 1.3 --- coff-solib.h 2001/07/01 22:13:22 *************** struct target_ops; *** 30,41 **** extern void coff_clear_solib (void); #endif /* 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) ! extern void coff_solib_add (char *, int, struct target_ops *); /* Function to be called when the inferior starts up, to discover the names of shared libraries that are dynamically linked, the base addresses to --- 30,54 ---- extern void coff_clear_solib (void); #endif + /* Whether to auto load solibs at startup time: + + 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. A negative + value (used internally) means force the symbol table to be loaded. + + On other platforms, != 0 means "always auto load". */ + + extern int auto_solib_add; + /* Called to add symbols from a shared library to gdb's symbol table. */ ! #define SOLIB_ADD(filename, from_tty, targ, threshold) \ ! coff_solib_add (filename, from_tty, targ, threshold) ! 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 Index: corelow.c =================================================================== RCS file: /cvs/src/src/gdb/corelow.c,v retrieving revision 1.17 diff -c -p -r1.17 corelow.c *** corelow.c 2001/05/15 00:03:36 1.17 --- corelow.c 2001/07/01 22:13:23 *************** core_close_cleanup (void *ignore) *** 222,228 **** static int solib_add_stub (PTR from_ttyp) { ! SOLIB_ADD (NULL, *(int *) from_ttyp, ¤t_target); re_enable_breakpoints_in_shlibs (); return 0; } --- 222,228 ---- static int solib_add_stub (PTR from_ttyp) { ! SOLIB_ADD (NULL, *(int *) from_ttyp, ¤t_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.13 diff -c -p -r1.13 fork-child.c *** fork-child.c 2001/05/04 04:15:24 1.13 --- fork-child.c 2001/07/01 22:13:23 *************** fork_inferior (char *exec_file_arg, char *** 388,395 **** 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. */ --- 388,393 ---- Index: infcmd.c =================================================================== RCS file: /cvs/src/src/gdb/infcmd.c,v retrieving revision 1.29 diff -c -p -r1.29 infcmd.c *** infcmd.c 2001/06/11 16:05:25 1.29 --- infcmd.c 2001/07/01 22:13:23 *************** nofp_registers_info (char *addr_exp, int *** 1645,1654 **** 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; --- 1645,1650 ---- *************** attach_command (char *args, int from_tty *** 1710,1721 **** } #ifdef SOLIB_ADD ! if (auto_solib_add) ! { ! /* Add shared library symbols from the newly attached process, if any. */ ! SOLIB_ADD ((char *) 0, from_tty, ¤t_target); ! re_enable_breakpoints_in_shlibs (); ! } #endif /* Take any necessary post-attaching actions for this platform. --- 1706,1714 ---- } #ifdef SOLIB_ADD ! /* Add shared library symbols from the newly attached process, if any. */ ! SOLIB_ADD ((char *) 0, from_tty, ¤t_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.41 diff -c -p -r1.41 infrun.c *** infrun.c 2001/06/28 21:48:41 1.41 --- infrun.c 2001/07/01 22:13:25 *************** handle_inferior_event (struct execution_ *** 1532,1546 **** 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 (); ! } /* Reinsert breakpoints and continue. */ if (breakpoints_inserted) --- 1532,1543 ---- remove_breakpoints (); /* Check for any newly added shared libraries if we're ! 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) *************** handle_inferior_event (struct execution_ *** 2460,2474 **** 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 (); ! } /* Try to reenable shared library breakpoints, additional code segments in shared libraries might be mapped in now. */ --- 2457,2468 ---- breakpoints_inserted = 0; /* Check for any newly added shared libraries if we're ! 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.13 diff -c -p -r1.13 irix5-nat.c *** irix5-nat.c 2001/05/04 04:15:25 1.13 --- irix5-nat.c 2001/07/01 22:13:25 *************** symbol_add_stub (void *arg) *** 862,875 **** SYNOPSIS void solib_add (char *arg_string, int from_tty, ! struct target_ops *target) DESCRIPTION */ void ! solib_add (char *arg_string, int from_tty, struct target_ops *target) { register struct so_list *so = NULL; /* link map state variable */ --- 862,875 ---- SYNOPSIS void solib_add (char *arg_string, int from_tty, ! struct target_ops *target, int threshold) DESCRIPTION */ void ! solib_add (char *arg_string, int from_tty, struct target_ops *target, int threshold) { register struct so_list *so = NULL; /* link map state variable */ *************** solib_add (char *arg_string, int from_tt *** 880,885 **** --- 880,888 ---- int count; int old; + if (threshold == 0) + return; + if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL) { error ("Invalid regexp: %s", re_err); *************** solib_create_inferior_hook (void) *** 1251,1258 **** 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); stop_soon_quietly = 0; } --- 1254,1260 ---- and will put out an annoying warning. Delaying the resetting of stop_soon_quietly until after symbol loading suppresses the warning. */ ! solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add); stop_soon_quietly = 0; } *************** static void *** 1274,1280 **** sharedlibrary_command (char *args, int from_tty) { dont_repeat (); ! solib_add (args, from_tty, (struct target_ops *) 0); } void --- 1276,1282 ---- sharedlibrary_command (char *args, int from_tty) { dont_repeat (); ! solib_add (args, from_tty, (struct target_ops *) 0, -1); } void Index: osfsolib.c =================================================================== RCS file: /cvs/src/src/gdb/osfsolib.c,v retrieving revision 1.9 diff -c -p -r1.9 osfsolib.c *** osfsolib.c 2001/05/04 04:15:26 1.9 --- osfsolib.c 2001/07/01 22:13:25 *************** symbol_add_stub (char *arg) *** 596,609 **** SYNOPSIS void solib_add (char *arg_string, int from_tty, ! struct target_ops *target) DESCRIPTION */ void ! solib_add (char *arg_string, int from_tty, struct target_ops *target) { register struct so_list *so = NULL; /* link map state variable */ --- 596,609 ---- SYNOPSIS void solib_add (char *arg_string, int from_tty, ! struct target_ops *target, int threshold) DESCRIPTION */ void ! solib_add (char *arg_string, int from_tty, struct target_ops *target, int threshold) { register struct so_list *so = NULL; /* link map state variable */ *************** solib_add (char *arg_string, int from_tt *** 614,619 **** --- 614,622 ---- int count; int old; + if (threshold == 0) + return; + if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL) { error ("Invalid regexp: %s", re_err); *************** solib_create_inferior_hook (void) *** 887,894 **** 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); stop_soon_quietly = 0; } --- 890,896 ---- and will put out an annoying warning. Delaying the resetting of stop_soon_quietly until after symbol loading suppresses the warning. */ ! solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add); stop_soon_quietly = 0; } *************** static void *** 911,917 **** sharedlibrary_command (char *args, int from_tty) { dont_repeat (); ! solib_add (args, from_tty, (struct target_ops *) 0); } void --- 913,919 ---- sharedlibrary_command (char *args, int from_tty) { dont_repeat (); ! solib_add (args, from_tty, (struct target_ops *) 0, -1); } void Index: pa64solib.c =================================================================== RCS file: /cvs/src/src/gdb/pa64solib.c,v retrieving revision 1.11 diff -c -p -r1.11 pa64solib.c *** pa64solib.c 2001/03/06 08:21:11 1.11 --- pa64solib.c 2001/07/01 22:13:26 *************** static void pa64_solib_sharedlibrary_com *** 127,137 **** static void *pa64_target_read_memory (void *, CORE_ADDR, size_t, int); ! static boolean read_dld_descriptor (struct target_ops *); static boolean read_dynamic_info (asection *, dld_cache_t *); ! static void add_to_solist (boolean, char *, struct load_module_desc *, CORE_ADDR, struct target_ops *); /* When examining the shared library for debugging information we have to --- 127,137 ---- static void *pa64_target_read_memory (void *, CORE_ADDR, size_t, int); ! static boolean read_dld_descriptor (struct target_ops *, int threshold); static boolean read_dynamic_info (asection *, dld_cache_t *); ! static void add_to_solist (boolean, char *, int, struct load_module_desc *, CORE_ADDR, struct target_ops *); /* When examining the shared library for debugging information we have to *************** pa64_solib_load_symbols (struct so_list *** 372,378 **** be exceeded. */ void ! pa64_solib_add (char *arg_string, int from_tty, struct target_ops *target) { struct minimal_symbol *msymbol; CORE_ADDR addr; --- 372,378 ---- be exceeded. */ void ! pa64_solib_add (char *arg_string, int from_tty, struct target_ops *target, int threshold) { struct minimal_symbol *msymbol; CORE_ADDR addr; *************** pa64_solib_add (char *arg_string, int fr *** 415,421 **** /* Read in the load map pointer if we have not done so already. */ if (! dld_cache.have_read_dld_descriptor) ! if (! read_dld_descriptor (target)) return; /* If the libraries were not mapped private, warn the user. */ --- 415,421 ---- /* Read in the load map pointer if we have not done so already. */ if (! dld_cache.have_read_dld_descriptor) ! if (! read_dld_descriptor (target, threshold)) return; /* If the libraries were not mapped private, warn the user. */ *************** pa64_solib_add (char *arg_string, int fr *** 439,445 **** if (!dll_path) error ("pa64_solib_add, unable to read shared library path."); ! add_to_solist (from_tty, dll_path, &dll_desc, 0, target); } } --- 439,445 ---- if (!dll_path) error ("pa64_solib_add, unable to read shared library path."); ! add_to_solist (from_tty, dll_path, threshold, &dll_desc, 0, target); } } *************** pa64_solib_in_dynamic_linker (int pid, C *** 700,706 **** return 0; if (!dld_cache.have_read_dld_descriptor) ! if (!read_dld_descriptor (¤t_target)) return 0; return (pc >= dld_cache.dld_desc.text_base --- 700,706 ---- return 0; if (!dld_cache.have_read_dld_descriptor) ! if (!read_dld_descriptor (¤t_target, auto_solib_add)) return 0; return (pc >= dld_cache.dld_desc.text_base *************** static void *** 818,824 **** pa64_solib_sharedlibrary_command (char *args, int from_tty) { dont_repeat (); ! pa64_solib_add (args, from_tty, (struct target_ops *) 0); } /* Return the name of the shared library containing ADDR or NULL if ADDR --- 818,824 ---- pa64_solib_sharedlibrary_command (char *args, int from_tty) { dont_repeat (); ! pa64_solib_add (args, from_tty, (struct target_ops *) 0, -1); } /* Return the name of the shared library containing ADDR or NULL if ADDR *************** so_lib_thread_start_addr (struct so_list *** 927,933 **** return nonzero. */ static boolean ! read_dld_descriptor (struct target_ops *target) { char *dll_path; asection *dyninfo_sect; --- 927,933 ---- return nonzero. */ static boolean ! read_dld_descriptor (struct target_ops *target, int threshold) { char *dll_path; asection *dyninfo_sect; *************** read_dld_descriptor (struct target_ops * *** 986,992 **** pa64_target_read_memory, 0, dld_cache.load_map); ! add_to_solist(0, dll_path, &dld_cache.dld_desc, 0, target); return 1; } --- 986,992 ---- pa64_target_read_memory, 0, dld_cache.load_map); ! add_to_solist(0, dll_path, threshold, &dld_cache.dld_desc, 0, target); return 1; } *************** pa64_target_read_memory (void *buffer, C *** 1093,1099 **** be read from the inferior process at the address load_module_desc_addr. */ static void ! add_to_solist (boolean from_tty, char *dll_path, struct load_module_desc *load_module_desc_p, CORE_ADDR load_module_desc_addr, struct target_ops *target) { --- 1093,1099 ---- be read from the inferior process at the address load_module_desc_addr. */ static void ! add_to_solist (boolean from_tty, char *dll_path, int threshold, struct load_module_desc *load_module_desc_p, CORE_ADDR load_module_desc_addr, struct target_ops *target) { *************** add_to_solist (boolean from_tty, char *d *** 1157,1164 **** 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)); if (pa64_solib_st_size_threshhold_exceeded) { pa64_solib_add_solib_objfile (new_so, dll_path, from_tty, 1); --- 1157,1165 ---- st_size = pa64_solib_sizeof_symbol_table (dll_path); pa64_solib_st_size_threshhold_exceeded = !from_tty + && (threshold >= 0) && ( (st_size + pa64_solib_total_st_size) ! > (threshold * (LONGEST)1048576)); 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.3 diff -c -p -r1.3 pa64solib.h *** pa64solib.h 2001/03/06 08:21:11 1.3 --- pa64solib.h 2001/07/01 22:13:26 *************** struct section_offsets; *** 25,34 **** /* 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) ! extern void pa64_solib_add (char *, int, struct target_ops *); extern CORE_ADDR pa64_solib_get_got_by_pc (CORE_ADDR); --- 25,34 ---- /* Called to add symbols from a shared library to gdb's symbol table. */ ! #define SOLIB_ADD(filename, from_tty, targ, threshold) \ ! pa64_solib_add (filename, from_tty, targ, threshold) ! 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.27 diff -c -p -r1.27 sol-thread.c *** sol-thread.c 2001/05/15 00:03:36 1.27 --- sol-thread.c 2001/07/01 22:13:26 *************** sol_thread_attach (char *args, int from_ *** 415,421 **** 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); if (sol_thread_active) { --- 415,421 ---- 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, auto_solib_add); if (sol_thread_active) { Index: solib-osf.c =================================================================== RCS file: /cvs/src/src/gdb/solib-osf.c,v retrieving revision 1.2 diff -c -p -r1.2 solib-osf.c *** solib-osf.c 2001/06/28 10:36:19 1.2 --- solib-osf.c 2001/07/01 22:13:26 *************** osf_solib_create_inferior_hook (void) *** 336,343 **** 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); stop_soon_quietly = 0; /* Enable breakpoints disabled (unnecessarily) by clear_solib(). */ --- 336,342 ---- and will put out an annoying warning. Delaying the resetting of stop_soon_quietly until after symbol loading suppresses the warning. */ ! solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add); stop_soon_quietly = 0; /* Enable breakpoints disabled (unnecessarily) by clear_solib(). */ Index: solib-svr4.c =================================================================== RCS file: /cvs/src/src/gdb/solib-svr4.c,v retrieving revision 1.15 diff -c -p -r1.15 solib-svr4.c *** solib-svr4.c 2001/05/04 04:15:27 1.15 --- solib-svr4.c 2001/07/01 22:13:27 *************** svr4_solib_create_inferior_hook (void) *** 1594,1601 **** warning ("shared library handler failed to disable breakpoint"); } ! if (auto_solib_add) ! solib_add ((char *) 0, 0, (struct target_ops *) 0); #endif /* ! _SCO_DS */ #endif } --- 1594,1600 ---- warning ("shared library handler failed to disable breakpoint"); } ! solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add); #endif /* ! _SCO_DS */ #endif } Index: solib.c =================================================================== RCS file: /cvs/src/src/gdb/solib.c,v retrieving revision 1.42 diff -c -p -r1.42 solib.c *** solib.c 2001/06/04 07:45:08 1.42 --- solib.c 2001/07/01 22:13:27 *************** update_solib_list (int from_tty, struct *** 493,499 **** SYNOPSIS ! void solib_add (char *pattern, int from_tty, struct target_ops *TARGET) DESCRIPTION --- 493,500 ---- SYNOPSIS ! void solib_add (char *pattern, int from_tty, struct target_ops ! *TARGET, int threshold) DESCRIPTION *************** update_solib_list (int from_tty, struct *** 501,510 **** match PATTERN. (If we've already read a shared object's symbol info, leave it alone.) If PATTERN is zero, read them all. FROM_TTY and TARGET are as described for update_solib_list, above. */ void ! solib_add (char *pattern, int from_tty, struct target_ops *target) { struct so_list *gdb; --- 502,513 ---- match PATTERN. (If we've already read a shared object's symbol info, leave it alone.) If PATTERN is zero, read them all. + If THRESHOLD is 0, defer reading symbolic information until later. + FROM_TTY and TARGET are as described for update_solib_list, above. */ void ! solib_add (char *pattern, int from_tty, struct target_ops *target, int threshold) { struct so_list *gdb; *************** solib_add (char *pattern, int from_tty, *** 538,544 **** } else { ! if (catch_errors (symbol_add_stub, gdb, "Error while reading shared library symbols:\n", RETURN_MASK_ALL)) --- 541,547 ---- } else { ! if ((threshold != 0) && catch_errors (symbol_add_stub, gdb, "Error while reading shared library symbols:\n", RETURN_MASK_ALL)) *************** static void *** 804,810 **** sharedlibrary_command (char *args, int from_tty) { dont_repeat (); ! solib_add (args, from_tty, (struct target_ops *) 0); } /* LOCAL FUNCTION --- 807,813 ---- sharedlibrary_command (char *args, int from_tty) { dont_repeat (); ! solib_add (args, from_tty, (struct target_ops *) 0, -1); } /* LOCAL FUNCTION Index: solib.h =================================================================== RCS file: /cvs/src/src/gdb/solib.h,v retrieving revision 1.7 diff -c -p -r1.7 solib.h *** solib.h 2001/05/14 18:45:45 1.7 --- solib.h 2001/07/01 22:13:27 *************** struct target_ops; *** 29,40 **** 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) ! extern void solib_add (char *, int, struct target_ops *); /* Function to be called when the inferior starts up, to discover the names of shared libraries that are dynamically linked, the base addresses to --- 29,53 ---- extern void clear_solib (void); + /* Whether to auto load solibs at startup time: + + 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. A negative + value (used internally) means force the symbol table to be loaded. + + On other platforms, != 0 means "always auto load". */ + + extern int auto_solib_add; + /* Called to add symbols from a shared library to gdb's symbol table. */ ! #define SOLIB_ADD(filename, from_tty, targ, threshold) \ ! solib_add (filename, from_tty, targ, threshold) ! 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.12 diff -c -p -r1.12 somsolib.c *** somsolib.c 2001/05/06 22:22:03 1.12 --- somsolib.c 2001/07/01 22:13:28 *************** som_solib_load_symbols (struct so_list * *** 403,413 **** /* Add symbols from shared libraries into the symtab list, unless the ! size threshold (specified by auto_solib_add, in megabytes) would ! be exceeded. */ void ! som_solib_add (char *arg_string, int from_tty, struct target_ops *target) { struct minimal_symbol *msymbol; struct so_list *so_list_tail; --- 403,414 ---- /* Add symbols from shared libraries into the symtab list, unless the ! size threshold (specified by THRESHOLD, in megabytes) would be ! exceeded. A negative threshold means force symbols to be ! loaded. */ void ! som_solib_add (char *arg_string, int from_tty, struct target_ops *target, int threshold) { struct minimal_symbol *msymbol; struct so_list *so_list_tail; *************** som_solib_add (char *arg_string, int fro *** 777,783 **** 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)); if (som_solib_st_size_threshold_exceeded) { --- 778,785 ---- st_size = som_solib_sizeof_symbol_table (name); som_solib_st_size_threshold_exceeded = !from_tty && ! (threshold >= 0) && ! ((st_size + som_solib_total_st_size) > (threshold * (LONGEST) 1048576)); if (som_solib_st_size_threshold_exceeded) { *************** static void *** 1467,1473 **** som_solib_sharedlibrary_command (char *args, int from_tty) { dont_repeat (); ! som_solib_add (args, from_tty, (struct target_ops *) 0); } --- 1469,1475 ---- som_solib_sharedlibrary_command (char *args, int from_tty) { dont_repeat (); ! som_solib_add (args, from_tty, (struct target_ops *) 0, -1); } Index: somsolib.h =================================================================== RCS file: /cvs/src/src/gdb/somsolib.h,v retrieving revision 1.3 diff -c -p -r1.3 somsolib.h *** somsolib.h 2001/03/06 08:21:17 1.3 --- somsolib.h 2001/07/01 22:13:28 *************** struct target_ops; *** 27,38 **** struct objfile; struct section_offsets; /* 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) ! extern void som_solib_add (char *, int, struct target_ops *); extern CORE_ADDR som_solib_get_got_by_pc (CORE_ADDR); --- 27,51 ---- struct objfile; struct section_offsets; + /* Whether to auto load solibs at startup time: + + 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. A negative + value (used internally) means force the symbol table to be loaded. + + On other platforms, != 0 means "always auto load". */ + + extern int auto_solib_add; + /* Called to add symbols from a shared library to gdb's symbol table. */ ! #define SOLIB_ADD(filename, from_tty, targ, threshold) \ ! som_solib_add (filename, from_tty, targ, threshold) ! 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.34 diff -c -p -r1.34 symfile.c *** symfile.c 2001/06/06 17:12:30 1.34 --- symfile.c 2001/07/01 22:13:28 *************** int symbol_reloading = 0; *** 192,199 **** report all the functions that are actually present. 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." */ int auto_solib_add = 1; --- 192,201 ---- report all the functions that are actually present. Note that HP-UX interprets this variable to mean, "threshhold size ! in megabytes, where zero means never add and negative means always ! add". Other platforms interpret this variable to mean, "always add ! if non-zero, never add if zero." ! */ int auto_solib_add = 1; Index: symfile.h =================================================================== RCS file: /cvs/src/src/gdb/symfile.h,v retrieving revision 1.9 diff -c -p -r1.9 symfile.h *** symfile.h 2001/03/06 08:21:17 1.9 --- symfile.h 2001/07/01 22:13:29 *************** extern char *obconcat (struct obstack *o *** 218,236 **** /* 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); --- 218,223 ---- Index: win32-nat.c =================================================================== RCS file: /cvs/src/src/gdb/win32-nat.c,v retrieving revision 1.27 diff -c -p -r1.27 win32-nat.c *** win32-nat.c 2001/05/04 04:15:28 1.27 --- win32-nat.c 2001/07/01 22:13:29 *************** out: *** 1633,1640 **** } void ! child_solib_add (char *filename ATTRIBUTE_UNUSED, int from_tty ATTRIBUTE_UNUSED, struct target_ops *target) { if (core_bfd) { child_clear_solibs (); --- 1633,1643 ---- } void ! child_solib_add (char *filename ATTRIBUTE_UNUSED, int from_tty ATTRIBUTE_UNUSED, struct target_ops *target, int threshold) { + if (threshold == 0) + return; + if (core_bfd) { child_clear_solibs (); Index: config/i386/tm-cygwin.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/tm-cygwin.h,v retrieving revision 1.8 diff -c -p -r1.8 tm-cygwin.h *** config/i386/tm-cygwin.h 2001/05/04 04:15:31 1.8 --- config/i386/tm-cygwin.h 2001/07/01 22:13:29 *************** extern CORE_ADDR skip_trampoline_code (C *** 32,45 **** #endif #define ATTACH_NO_WAIT ! #define SOLIB_ADD(filename, from_tty, targ) child_solib_add(filename, from_tty, targ) #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 (ptid_t ptid); ! void child_solib_add (char *, int, struct target_ops *); char *child_solib_loaded_library_pathname(int); void child_clear_solibs (void); void dll_symbol_command (char *, int); --- 32,45 ---- #endif #define ATTACH_NO_WAIT ! #define SOLIB_ADD(filename, from_tty, targ, threshold) child_solib_add(filename, from_tty, targ, threshold) #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 (ptid_t ptid); ! 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.8 diff -c -p -r1.8 nm-rs6000.h *** config/rs6000/nm-rs6000.h 2001/05/04 04:15:33 1.8 --- config/rs6000/nm-rs6000.h 2001/07/01 22:13:29 *************** *** 43,49 **** /* 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) \ if (PIDGET (inferior_ptid)) \ /* Attach to process. */ \ xcoff_relocate_symtab (PIDGET (inferior_ptid)); \ --- 43,49 ---- /* 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, threshold) \ if (PIDGET (inferior_ptid)) \ /* Attach to process. */ \ xcoff_relocate_symtab (PIDGET (inferior_ptid)); \ Index: doc/ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/doc/ChangeLog,v retrieving revision 1.79 diff -c -p -r1.79 ChangeLog *** doc/ChangeLog 2001/06/29 16:21:45 1.79 --- doc/ChangeLog 2001/07/01 22:13:30 *************** *** 1,3 **** --- 1,7 ---- + 2001-07-01 Fred Fish + + * gdbint.texinfo (SOLIB_ADD): Document the new threshold arg. + 2001-06-28 Andrew Cagney * gdbint.texinfo (Target Architecture Definition): Update Index: doc/gdbint.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v retrieving revision 1.28 diff -c -p -r1.28 gdbint.texinfo *** doc/gdbint.texinfo 2001/06/29 16:21:45 1.28 --- doc/gdbint.texinfo 2001/07/01 22:13:32 *************** Defaults to @code{"/bin/sh"}. *** 3823,3829 **** @item SOLIB_ADD (@var{filename}, @var{from_tty}, @var{targ}) @findex SOLIB_ADD Define this to expand into an expression that will cause the symbols in ! @var{filename} to be added to @value{GDBN}'s symbol table. @item SOLIB_CREATE_INFERIOR_HOOK @findex SOLIB_CREATE_INFERIOR_HOOK --- 3823,3834 ---- @item SOLIB_ADD (@var{filename}, @var{from_tty}, @var{targ}) @findex SOLIB_ADD Define this to expand into an expression that will cause the symbols in ! @var{filename} to be added to @value{GDBN}'s symbol table. If ! @var{threshold} is zero symbols are not read but any necessary low level ! processing for @var{filename} is still done. If @var{threshold} is ! non-zero, it is interpreted on some systems as a threshold (in MB) above ! which symbol reading is suppressed, and on all other systems as a flag ! to enable symbol reading. @item SOLIB_CREATE_INFERIOR_HOOK @findex SOLIB_CREATE_INFERIOR_HOOK