From 990f9fe3aa352be5de8c798a21164f52248590ee Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Thu, 1 Nov 2001 16:17:08 +0000 Subject: [PATCH] Approved by kev@cygnus.com ChangeLog entry: 2001-11-01 Fred Fish * coff-solib.c (coff_solib_add): Add new readsyms 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. * xcoffsolib.c (solib_add): Ditto. * coff-solib.h (coff_solib_add): Add new readsyms arg to prototype. * 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): If readsyms is zero don't read symbols but do any other needed work for shared libs. * irix5-nat.c: Ditto. * osfsolib.c (solib_add): Ditto. * solib.c (solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * xcoffsolib.c (solib_add): Ditto. * irix5-nat.c (sharedlibrary_command): Pass 1 as readsyms to solib_add to force reading of shared library symbols. * 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_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.c (solib_create_inferior_hook): Ditto. * solib-osf.c (osf_solib_create_inferior_hook): Ditto. * solib-svr4.c (enable_break): Ditto. * solib-sunos.c (sunos_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 readsyms 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 readsyms. (read_dld_descriptor): Ditto. (pa64_solib_add): Call read_dld_descriptor with readsyms. (pa64_solib_in_dynamic_linker): Ditto. * corelow.c (symfile.h): Need this for auto_solib_add declaration. * sol-thread.c (symfile.h): Ditto. Approved by eliz@is.elta.co.il doc/ChangeLog entry: 2001-11-01 Fred Fish * gdbint.texinfo (SOLIB_ADD): Document additional new "readsyms" arg. --- gdb/ChangeLog | 72 +++++++++++++++++++++++++++++++++++ gdb/coff-solib.c | 9 +++-- gdb/coff-solib.h | 6 +-- gdb/config/i386/tm-cygwin.h | 4 +- gdb/config/rs6000/nm-rs6000.h | 2 +- gdb/corelow.c | 3 +- gdb/doc/ChangeLog | 5 +++ gdb/doc/gdbint.texinfo | 6 ++- gdb/fork-child.c | 2 - gdb/infcmd.c | 13 ++----- gdb/infrun.c | 30 ++++++--------- gdb/irix5-nat.c | 12 +++--- gdb/osfsolib.c | 12 +++--- gdb/pa64solib.c | 22 +++++------ gdb/pa64solib.h | 6 +-- gdb/sol-thread.c | 3 +- gdb/solib-osf.c | 3 +- gdb/solib-sunos.c | 3 +- gdb/solib-svr4.c | 2 +- gdb/solib.c | 12 ++++-- gdb/solib.h | 6 +-- gdb/somsolib.c | 6 +-- gdb/somsolib.h | 6 +-- gdb/win32-nat.c | 4 +- gdb/windows-nat.c | 4 +- 25 files changed, 166 insertions(+), 87 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 32df4a104ca..a2c8b38fdea 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,75 @@ +2001-11-01 Fred Fish + + * coff-solib.c (coff_solib_add): Add new readsyms 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. + * xcoffsolib.c (solib_add): Ditto. + + * coff-solib.h (coff_solib_add): Add new readsyms arg to prototype. + * 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): If readsyms is zero don't read + symbols but do any other needed work for shared libs. + * irix5-nat.c: Ditto. + * osfsolib.c (solib_add): Ditto. + * solib.c (solib_add): Ditto. + * win32-nat.c (child_solib_add): Ditto. + * xcoffsolib.c (solib_add): Ditto. + + * irix5-nat.c (sharedlibrary_command): Pass 1 as readsyms to + solib_add to force reading of shared library symbols. + * 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_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.c (solib_create_inferior_hook): Ditto. + * solib-osf.c (osf_solib_create_inferior_hook): Ditto. + * solib-svr4.c (enable_break): Ditto. + * solib-sunos.c (sunos_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 readsyms 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 readsyms. + (read_dld_descriptor): Ditto. + (pa64_solib_add): Call read_dld_descriptor with readsyms. + (pa64_solib_in_dynamic_linker): Ditto. + + * corelow.c (symfile.h): Need this for auto_solib_add declaration. + * sol-thread.c (symfile.h): Ditto. + 2001-10-31 Andrew Cagney * s390-nat.c (s390_remove_watchpoint): Use xfree. diff --git a/gdb/coff-solib.c b/gdb/coff-solib.c index fc13bca7b00..64dca7bbefd 100644 --- a/gdb/coff-solib.c +++ b/gdb/coff-solib.c @@ -43,17 +43,20 @@ SYNOPSIS void coff_solib_add (char *arg_string, int from_tty, - struct target_ops *target) + struct target_ops *target, int readsyms) 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 readsyms) { asection *libsect; + if (!readsyms) + return; + libsect = bfd_get_section_by_name (exec_bfd, ".lib"); if (libsect) @@ -127,5 +130,5 @@ coff_solib_add (char *arg_string, int from_tty, struct target_ops *target) 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); } diff --git a/gdb/coff-solib.h b/gdb/coff-solib.h index be66a773227..144f36df700 100644 --- a/gdb/coff-solib.h +++ b/gdb/coff-solib.h @@ -32,10 +32,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, readsyms) \ + coff_solib_add (filename, from_tty, targ, readsyms) -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 diff --git a/gdb/config/i386/tm-cygwin.h b/gdb/config/i386/tm-cygwin.h index b0cb572a8f1..756a6eaf74e 100644 --- a/gdb/config/i386/tm-cygwin.h +++ b/gdb/config/i386/tm-cygwin.h @@ -32,14 +32,14 @@ extern CORE_ADDR skip_trampoline_code (CORE_ADDR pc, char *name); #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, readsyms) child_solib_add(filename, from_tty, targ, readsyms) #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 *); +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); diff --git a/gdb/config/rs6000/nm-rs6000.h b/gdb/config/rs6000/nm-rs6000.h index 441b3818c00..728497e7871 100644 --- a/gdb/config/rs6000/nm-rs6000.h +++ b/gdb/config/rs6000/nm-rs6000.h @@ -43,7 +43,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 (PIDGET (inferior_ptid)) \ /* Attach to process. */ \ xcoff_relocate_symtab (PIDGET (inferior_ptid)); \ diff --git a/gdb/corelow.c b/gdb/corelow.c index 5d8d3ceb972..59318b179a6 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -37,6 +37,7 @@ #include "gdbcore.h" #include "gdbthread.h" #include "regcache.h" +#include "symfile.h" #ifndef O_BINARY #define O_BINARY 0 @@ -222,7 +223,7 @@ core_close_cleanup (void *ignore) static int solib_add_stub (PTR from_ttyp) { - SOLIB_ADD (NULL, *(int *) from_ttyp, ¤t_target); + SOLIB_ADD (NULL, *(int *) from_ttyp, ¤t_target, auto_solib_add); re_enable_breakpoints_in_shlibs (); return 0; } diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index d22fe874c4f..dfde0f2b77d 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2001-11-01 Fred Fish + + * gdbint.texinfo (SOLIB_ADD): Document additional new + "readsyms" arg. + 2001-10-30 Don Howard * gdb.texinfo: (Command Files) Added documentation for the diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 46b9e95bb11..3e900c5b252 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -4000,10 +4000,12 @@ inferior. If defined, this is the name of the shell to use to run the inferior. Defaults to @code{"/bin/sh"}. -@item SOLIB_ADD (@var{filename}, @var{from_tty}, @var{targ}) +@item SOLIB_ADD (@var{filename}, @var{from_tty}, @var{targ}, @var{readsyms}) @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. +@var{filename} to be added to @value{GDBN}'s symbol table. If +@var{readsyms} is zero symbols are not read but any necessary low level +processing for @var{filename} is still done. @item SOLIB_CREATE_INFERIOR_HOOK @findex SOLIB_CREATE_INFERIOR_HOOK diff --git a/gdb/fork-child.c b/gdb/fork-child.c index de148c6d664..21e508939b6 100644 --- a/gdb/fork-child.c +++ b/gdb/fork-child.c @@ -388,8 +388,6 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env, 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. */ diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 51883f99092..482db0f26a4 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1633,10 +1633,6 @@ nofp_registers_info (char *addr_exp, int from_tty) 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; @@ -1698,12 +1694,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, ¤t_target); - re_enable_breakpoints_in_shlibs (); - } + /* 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. diff --git a/gdb/infrun.c b/gdb/infrun.c index 0730f91b65f..d56363656d6 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1518,15 +1518,12 @@ handle_inferior_event (struct execution_control_state *ecs) 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) @@ -2446,15 +2443,12 @@ handle_inferior_event (struct execution_control_state *ecs) 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. */ diff --git a/gdb/irix5-nat.c b/gdb/irix5-nat.c index 2781bf3d1fe..c3543b19869 100644 --- a/gdb/irix5-nat.c +++ b/gdb/irix5-nat.c @@ -862,14 +862,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 readsyms) 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 readsyms) { register struct so_list *so = NULL; /* link map state variable */ @@ -880,6 +880,9 @@ solib_add (char *arg_string, int from_tty, struct target_ops *target) int count; int old; + if (!readsyms) + return; + if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL) { error ("Invalid regexp: %s", re_err); @@ -1252,8 +1255,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; } @@ -1275,7 +1277,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, 1); } void diff --git a/gdb/osfsolib.c b/gdb/osfsolib.c index ac5c4de17c4..2ef7947676b 100644 --- a/gdb/osfsolib.c +++ b/gdb/osfsolib.c @@ -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 readsyms) 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 readsyms) { register struct so_list *so = NULL; /* link map state variable */ @@ -614,6 +614,9 @@ solib_add (char *arg_string, int from_tty, struct target_ops *target) int count; int old; + if (!readsyms) + return; + if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL) { error ("Invalid regexp: %s", re_err); @@ -888,8 +891,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; } @@ -912,7 +914,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, 1); } void diff --git a/gdb/pa64solib.c b/gdb/pa64solib.c index 441095e92a7..0058cbf6ead 100644 --- a/gdb/pa64solib.c +++ b/gdb/pa64solib.c @@ -127,11 +127,11 @@ static void pa64_solib_sharedlibrary_command (char *, int); static void *pa64_target_read_memory (void *, CORE_ADDR, size_t, int); -static boolean read_dld_descriptor (struct target_ops *); +static boolean read_dld_descriptor (struct target_ops *, int readsyms); static boolean read_dynamic_info (asection *, dld_cache_t *); -static void add_to_solist (boolean, char *, struct load_module_desc *, +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 @@ -372,7 +372,7 @@ pa64_solib_load_symbols (struct so_list *so, char *name, int from_tty, 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 readsyms) { struct minimal_symbol *msymbol; CORE_ADDR addr; @@ -415,7 +415,7 @@ pa64_solib_add (char *arg_string, int from_tty, struct target_ops *target) /* 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)) + if (! read_dld_descriptor (target, readsyms)) return; /* If the libraries were not mapped private, warn the user. */ @@ -439,7 +439,7 @@ pa64_solib_add (char *arg_string, int from_tty, struct target_ops *target) if (!dll_path) error ("pa64_solib_add, unable to read shared library path."); - add_to_solist (from_tty, dll_path, &dll_desc, 0, target); + add_to_solist (from_tty, dll_path, readsyms, &dll_desc, 0, target); } } @@ -700,7 +700,7 @@ pa64_solib_in_dynamic_linker (int pid, CORE_ADDR pc) return 0; if (!dld_cache.have_read_dld_descriptor) - if (!read_dld_descriptor (¤t_target)) + if (!read_dld_descriptor (¤t_target, auto_solib_add)) return 0; return (pc >= dld_cache.dld_desc.text_base @@ -818,7 +818,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, 1); } /* Return the name of the shared library containing ADDR or NULL if ADDR @@ -936,7 +936,7 @@ so_lib_thread_start_addr (struct so_list *so) return nonzero. */ static boolean -read_dld_descriptor (struct target_ops *target) +read_dld_descriptor (struct target_ops *target, int readsyms) { char *dll_path; asection *dyninfo_sect; @@ -995,7 +995,7 @@ read_dld_descriptor (struct target_ops *target) pa64_target_read_memory, 0, dld_cache.load_map); - add_to_solist(0, dll_path, &dld_cache.dld_desc, 0, target); + add_to_solist(0, dll_path, readsyms, &dld_cache.dld_desc, 0, target); return 1; } @@ -1102,7 +1102,7 @@ pa64_target_read_memory (void *buffer, CORE_ADDR ptr, size_t bufsiz, int ident) be read from the inferior process at the address load_module_desc_addr. */ static void -add_to_solist (boolean from_tty, char *dll_path, +add_to_solist (boolean from_tty, char *dll_path, int readsyms, struct load_module_desc *load_module_desc_p, CORE_ADDR load_module_desc_addr, struct target_ops *target) { @@ -1166,7 +1166,7 @@ add_to_solist (boolean from_tty, char *dll_path, st_size = pa64_solib_sizeof_symbol_table (dll_path); pa64_solib_st_size_threshhold_exceeded = !from_tty - && auto_solib_add + && readsyms && ( (st_size + pa64_solib_total_st_size) > (auto_solib_limit * (LONGEST) (1024 * 1024))); if (pa64_solib_st_size_threshhold_exceeded) diff --git a/gdb/pa64solib.h b/gdb/pa64solib.h index 3cf77dba7fc..7a3a068ff8d 100644 --- a/gdb/pa64solib.h +++ b/gdb/pa64solib.h @@ -25,10 +25,10 @@ struct section_offsets; /* 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, readsyms) \ + pa64_solib_add (filename, from_tty, targ, readsyms) -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); diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index f92c49e4b3f..18b812ccbee 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -60,6 +60,7 @@ #include "gdbcmd.h" #include "gdbcore.h" #include "regcache.h" +#include "symfile.h" extern struct target_ops sol_thread_ops; /* Forward declaration */ extern struct target_ops sol_core_ops; /* Forward declaration */ @@ -415,7 +416,7 @@ sol_thread_attach (char *args, int from_tty) 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) { diff --git a/gdb/solib-osf.c b/gdb/solib-osf.c index eb78a419a2d..a00e488ee04 100644 --- a/gdb/solib-osf.c +++ b/gdb/solib-osf.c @@ -336,8 +336,7 @@ osf_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; /* Enable breakpoints disabled (unnecessarily) by clear_solib(). */ diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c index b5d95864c0b..304657c52ea 100644 --- a/gdb/solib-sunos.c +++ b/gdb/solib-sunos.c @@ -852,8 +852,7 @@ sunos_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); } static void diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 8441fa1b6f0..987e776df3a 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -909,7 +909,7 @@ enable_break (void) if (inferior_sos) { /* Connected to a running target. Update our shared library table. */ - solib_add (NULL, 0, NULL); + solib_add (NULL, 0, NULL, auto_solib_add); } while (inferior_sos) { diff --git a/gdb/solib.c b/gdb/solib.c index a2f4c81d252..853fab82bef 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -493,7 +493,8 @@ update_solib_list (int from_tty, struct target_ops *target) 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 readsyms) DESCRIPTION @@ -501,10 +502,13 @@ update_solib_list (int from_tty, struct target_ops *target) match PATTERN. (If we've already read a shared object's symbol info, leave it alone.) If PATTERN is zero, read them all. + If READSYMS is 0, defer reading symbolic information until later + but still do any needed low level processing. + 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 readsyms) { struct so_list *gdb; @@ -536,7 +540,7 @@ solib_add (char *pattern, int from_tty, struct target_ops *target) printf_unfiltered ("Symbols already loaded for %s\n", gdb->so_name); } - else + else if (readsyms) { if (catch_errors (symbol_add_stub, gdb, @@ -806,7 +810,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, 1); } /* LOCAL FUNCTION diff --git a/gdb/solib.h b/gdb/solib.h index 56a4a400cf8..76f287b2269 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -31,10 +31,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, readsyms) \ + solib_add (filename, from_tty, targ, readsyms) -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 diff --git a/gdb/somsolib.c b/gdb/somsolib.c index 5f2b2cbc88f..fdb2e16c27a 100644 --- a/gdb/somsolib.c +++ b/gdb/somsolib.c @@ -406,7 +406,7 @@ som_solib_load_symbols (struct so_list *so, char *name, int from_tty, 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 readsyms) { struct minimal_symbol *msymbol; struct so_list *so_list_tail; @@ -777,7 +777,7 @@ som_solib_add (char *arg_string, int from_tty, struct target_ops *target) st_size = som_solib_sizeof_symbol_table (name); som_solib_st_size_threshold_exceeded = !from_tty && - auto_solib_add && + readsyms && ((st_size + som_solib_total_st_size) > (auto_solib_limit * (LONGEST) (1024 * 1024))); if (som_solib_st_size_threshold_exceeded) @@ -1470,7 +1470,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, 1); } diff --git a/gdb/somsolib.h b/gdb/somsolib.h index 13944d4f488..4b23760199c 100644 --- a/gdb/somsolib.h +++ b/gdb/somsolib.h @@ -29,10 +29,10 @@ 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) +#define SOLIB_ADD(filename, from_tty, targ, readsyms) \ + som_solib_add (filename, from_tty, targ, readsyms) -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); diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index 10847b8373d..ab5f3f32878 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -1707,8 +1707,10 @@ out: } void -child_solib_add (char *filename ATTRIBUTE_UNUSED, int from_tty, struct target_ops *target) +child_solib_add (char *filename ATTRIBUTE_UNUSED, int from_tty, struct target_ops *target, int readsyms) { + if (!readsyms) + return; if (core_bfd) { child_clear_solibs (); diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 10847b8373d..ab5f3f32878 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1707,8 +1707,10 @@ out: } void -child_solib_add (char *filename ATTRIBUTE_UNUSED, int from_tty, struct target_ops *target) +child_solib_add (char *filename ATTRIBUTE_UNUSED, int from_tty, struct target_ops *target, int readsyms) { + if (!readsyms) + return; if (core_bfd) { child_clear_solibs (); -- 2.30.2