* [RFA] Fix a couple of auto-solib-add problems
@ 2001-10-30 15:35 Fred Fish
2001-10-31 4:02 ` Eli Zaretskii
0 siblings, 1 reply; 21+ messages in thread
From: Fred Fish @ 2001-10-30 15:35 UTC (permalink / raw)
To: gdb-patches; +Cc: fnf
Currently gdb has some problems with auto-solib-add. Normally
auto-solib-add is on by default, but turning it off causes some side
affects other than just suppressing automatic reading of shared
library symbols:
(1) If auto-solib-add is off gdb does not initialize some of its other
low level information about shared libraries. For example, if you
attach to a process that is stopped in a shared library on linux, gdb
does not tell you the attached inferior is in a shared library:
$ gdb-orig main
(gdb) set auto-solib-add off
(gdb) attach 22693
Attaching to program: main, process 22693
0x4013a544 in ?? ()
(gdb)
after applying the attached patch, you get:
$ gdb-new main
(gdb) set auto-solib-add off
(gdb) attach 22693
Attaching to program: main, process 22693
0x4013a544 in ?? () from /lib/i686/libc.so.6
(gdb)
(2) On solaris, attaching to an inferior unconditionally reads all the
shared library symbols regardless of the state of the auto-solib-add
flag:
$ gdb-orig main
(gdb) set auto-solib-add off
(gdb) attach 13294
Attaching to program `main', process 13294
Reading symbols from ./libAdd.so...done.
Loaded symbols for ./libAdd.so
Reading symbols from ./libSub.so...done.
Loaded symbols for ./libSub.so
Reading symbols from /usr/lib/libm.so.1...done.
Loaded symbols for /usr/lib/libm.so.1
Reading symbols from /usr/lib/libc.so.1...done.
Loaded symbols for /usr/lib/libc.so.1
Reading symbols from /usr/lib/libdl.so.1...done.
Loaded symbols for /usr/lib/libdl.so.1
Reading symbols from /usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1...done.
Loaded symbols for /usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1
0xff2971d0 in ?? ()
(gdb)
after applying the attached patch, we get:
$ gdb-new main
(gdb) set auto-solib-add off
(gdb) attach 13294
Attaching to program `main', process 13294
0xff2971d0 in ?? ()
(gdb)
IMPLEMENTATION
The solution is to always call the target's flavor of solib_add() and
let it decide how much work it needs to do, optionally suppressing
symbol table reading when auto-solib-add is on. I.E. replace sections
of code like:
if (auto_solib_add)
SOLIB_ADD (blah, blah, blah)
with
SOLIB_ADD (blah, blah, blah, auto_solib_add)
and change the solib_add functions from:
solib_add (blah, blah, blah)
{
do low level stuff
read symbols
}
to something like:
solib_add (blah, blah, blah, readsyms)
{
do low level stuff
if (!readsyms) return
read symbols
}
The reason we add a new readsyms arg to the solib_add functions and
then pass the auto_solib_add flag, rather than just having them test
auto_solib_add themselves, is that there are times when we want to
pass 1 instead, to force symbol table reading. An example is the
implementation of the 'sharedlibrary' command where the user can
explicitly load shared library symbols.
Also note that for targets that use a solib_add function other than
the generic one in solib.c, this change is essentially a NOP since all
we are doing is calling a solib_add that immediately returns if the
passed auto_solib_add flag is off, rather than not calling it at all
if the flag is off. Only targets that use the solib_add function in
solib.c start doing some additional low level shlib handling when
auto_solib_add is off. Perhaps the other flavors of solib_add need to
be fixed so they do similar work when auto_solib_add is off. This
patch doesn't address that issue.
-Fred
============================================================================
gdb/ChangeLog entry:
2001-10-30 Fred Fish <fnf@redhat.com>
* 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): Adjust prototype for new readsyms 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): 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.
gdb/doc/ChangeLog entry:
2001-10-30 Fred Fish <fnf@redhat.com>
* gdbint.texinfo (SOLIB_ADD): Document additional new
"readsyms" arg.
Index: coff-solib.c
===================================================================
RCS file: /cvs/src/src/gdb/coff-solib.c,v
retrieving revision 1.4
diff -u -p -r1.4 coff-solib.c
--- coff-solib.c 2001/06/28 19:54:41 1.4
+++ coff-solib.c 2001/10/30 21:35:04
@@ -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 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.3
diff -u -p -r1.3 coff-solib.h
--- coff-solib.h 2001/03/06 08:21:06 1.3
+++ coff-solib.h 2001/10/30 21:35:04
@@ -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
Index: corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.17
diff -u -p -r1.17 corelow.c
--- corelow.c 2001/05/15 00:03:36 1.17
+++ corelow.c 2001/10/30 21:35:04
@@ -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;
}
Index: fork-child.c
===================================================================
RCS file: /cvs/src/src/gdb/fork-child.c,v
retrieving revision 1.13
diff -u -p -r1.13 fork-child.c
--- fork-child.c 2001/05/04 04:15:24 1.13
+++ fork-child.c 2001/10/30 21:35:04
@@ -388,8 +388,6 @@ fork_inferior (char *exec_file_arg, char
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.31
diff -u -p -r1.31 infcmd.c
--- infcmd.c 2001/10/01 18:11:19 1.31
+++ infcmd.c 2001/10/30 21:35:05
@@ -1633,10 +1633,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;
@@ -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.
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.47
diff -u -p -r1.47 infrun.c
--- infrun.c 2001/10/21 17:19:37 1.47
+++ infrun.c 2001/10/30 21:35:06
@@ -1526,15 +1526,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)
@@ -2454,15 +2451,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.15
diff -u -p -r1.15 irix5-nat.c
--- irix5-nat.c 2001/10/30 04:05:34 1.15
+++ irix5-nat.c 2001/10/30 21:35:06
@@ -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_tt
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
Index: osfsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/osfsolib.c,v
retrieving revision 1.11
diff -u -p -r1.11 osfsolib.c
--- osfsolib.c 2001/10/30 04:05:34 1.11
+++ osfsolib.c 2001/10/30 21:35:07
@@ -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_tt
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
Index: pa64solib.c
===================================================================
RCS file: /cvs/src/src/gdb/pa64solib.c,v
retrieving revision 1.13
diff -u -p -r1.13 pa64solib.c
--- pa64solib.c 2001/10/30 17:34:30 1.13
+++ pa64solib.c 2001/10/30 21:35:07
@@ -127,11 +127,11 @@ static void pa64_solib_sharedlibrary_com
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
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 fr
/* 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 fr
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, C
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
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 *
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, C
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 *d
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)
Index: pa64solib.h
===================================================================
RCS file: /cvs/src/src/gdb/pa64solib.h,v
retrieving revision 1.3
diff -u -p -r1.3 pa64solib.h
--- pa64solib.h 2001/03/06 08:21:11 1.3
+++ pa64solib.h 2001/10/30 21:35:07
@@ -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);
Index: sol-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/sol-thread.c,v
retrieving revision 1.27
diff -u -p -r1.27 sol-thread.c
--- sol-thread.c 2001/05/15 00:03:36 1.27
+++ sol-thread.c 2001/10/30 21:35:07
@@ -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_
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-osf.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-osf.c,v
retrieving revision 1.2
diff -u -p -r1.2 solib-osf.c
--- solib-osf.c 2001/06/28 10:36:19 1.2
+++ solib-osf.c 2001/10/30 21:35:07
@@ -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(). */
Index: solib-sunos.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-sunos.c,v
retrieving revision 1.1
diff -u -p -r1.1 solib-sunos.c
--- solib-sunos.c 2001/10/02 23:11:20 1.1
+++ solib-sunos.c 2001/10/30 21:35:08
@@ -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
Index: solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.20
diff -u -p -r1.20 solib-svr4.c
--- solib-svr4.c 2001/10/02 23:11:20 1.20
+++ solib-svr4.c 2001/10/30 21:35:08
@@ -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)
{
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.44
diff -u -p -r1.44 solib.c
--- solib.c 2001/10/30 04:05:34 1.44
+++ solib.c 2001/10/30 21:35:08
@@ -493,7 +493,8 @@ 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 readsyms)
DESCRIPTION
@@ -501,10 +502,13 @@ update_solib_list (int from_tty, struct
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,
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
Index: solib.h
===================================================================
RCS file: /cvs/src/src/gdb/solib.h,v
retrieving revision 1.7
diff -u -p -r1.7 solib.h
--- solib.h 2001/05/14 18:45:45 1.7
+++ solib.h 2001/10/30 21:35:08
@@ -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
Index: somsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/somsolib.c,v
retrieving revision 1.16
diff -u -p -r1.16 somsolib.c
--- somsolib.c 2001/10/30 17:34:30 1.16
+++ somsolib.c 2001/10/30 21:35:09
@@ -406,7 +406,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 readsyms)
{
struct minimal_symbol *msymbol;
struct so_list *so_list_tail;
@@ -777,7 +777,7 @@ som_solib_add (char *arg_string, int fro
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);
}
Index: somsolib.h
===================================================================
RCS file: /cvs/src/src/gdb/somsolib.h,v
retrieving revision 1.3
diff -u -p -r1.3 somsolib.h
--- somsolib.h 2001/03/06 08:21:17 1.3
+++ somsolib.h 2001/10/30 21:35:09
@@ -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);
Index: win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.34
diff -u -p -r1.34 win32-nat.c
--- win32-nat.c 2001/10/30 17:34:30 1.34
+++ win32-nat.c 2001/10/30 21:35:09
@@ -1692,8 +1692,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 ();
Index: config/i386/tm-cygwin.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-cygwin.h,v
retrieving revision 1.9
diff -u -p -r1.9 tm-cygwin.h
--- tm-cygwin.h 2001/10/12 04:32:16 1.9
+++ tm-cygwin.h 2001/10/30 21:35:09
@@ -32,14 +32,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, 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);
Index: config/rs6000/nm-rs6000.h
===================================================================
RCS file: /cvs/src/src/gdb/config/rs6000/nm-rs6000.h,v
retrieving revision 1.8
diff -u -p -r1.8 nm-rs6000.h
--- nm-rs6000.h 2001/05/04 04:15:33 1.8
+++ nm-rs6000.h 2001/10/30 21:35:09
@@ -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)); \
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.41
diff -u -p -r1.41 gdbint.texinfo
--- gdbint.texinfo 2001/10/16 01:58:07 1.41
+++ gdbint.texinfo 2001/10/30 21:35:11
@@ -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
^ permalink raw reply [flat|nested] 21+ messages in thread* [RFA] Use 1024*1024 for a megabyte, not 1000000.
@ 2001-10-29 20:35 Fred Fish
0 siblings, 0 replies; 21+ messages in thread
From: Fred Fish @ 2001-10-29 20:35 UTC (permalink / raw)
To: gdb-patches; +Cc: fnf
OK, so it's a nit...
-Fred
2001-10-29 Fred Fish <fnf@redhat.com>
* somsolib.c (som_solib_add): A megabyte is 1024*1024 bytes.
* pa64solib.c (add_to_solist): Ditto.
Index: somsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/somsolib.c,v
retrieving revision 1.15
diff -u -p -r1.15 somsolib.c
--- somsolib.c 2001/10/30 04:05:34 1.15
+++ somsolib.c 2001/10/30 04:32:49
@@ -778,7 +778,7 @@ som_solib_add (char *arg_string, int fro
som_solib_st_size_threshold_exceeded =
!from_tty &&
auto_solib_add &&
- ((st_size + som_solib_total_st_size) > (auto_solib_limit * (LONGEST) 1000000));
+ ((st_size + som_solib_total_st_size) > (auto_solib_limit * (LONGEST) (1024 * 1024)));
if (som_solib_st_size_threshold_exceeded)
{
Index: pa64solib.c
===================================================================
RCS file: /cvs/src/src/gdb/pa64solib.c,v
retrieving revision 1.12
diff -u -p -r1.12 pa64solib.c
--- pa64solib.c 2001/10/30 04:05:34 1.12
+++ pa64solib.c 2001/10/30 04:32:49
@@ -1168,7 +1168,7 @@ add_to_solist (boolean from_tty, char *d
!from_tty
&& auto_solib_add
&& ( (st_size + pa64_solib_total_st_size)
- > (auto_solib_limit * (LONGEST)1000000));
+ > (auto_solib_limit * (LONGEST) (1024 * 1024)));
if (pa64_solib_st_size_threshhold_exceeded)
{
pa64_solib_add_solib_objfile (new_so, dll_path, from_tty, 1);
^ permalink raw reply [flat|nested] 21+ messages in thread* [RFA] Change auto-solib-add to boolean, add auto-solib-limit
@ 2001-10-27 12:50 Fred Fish
2001-10-27 17:01 ` Elena Zannoni
2001-10-28 1:54 ` Eli Zaretskii
0 siblings, 2 replies; 21+ messages in thread
From: Fred Fish @ 2001-10-27 12:50 UTC (permalink / raw)
To: gdb-patches; +Cc: fnf
n the current gdb, auto-solib-add is used as both a boolean and as a
limiting size in megabytes. This patch removes this overloaded
meaning.
In the past I've submitted several versions of a patch to fix some
problems with auto-solib-add, but they have never quite been approved
in full. In response to feedback, and by specific request to remove
the overloaded meaning of the auto-solib-add variable, this patch
changes auto-solib-add into a boolean and adds a new variable, called
auto-solib-limit to hold the shlib symbol table size limit value for
those systems that support this.
Once this patch is approved and installed, I'll rework my previous
auto-solib-add patch and resubmit it.
-Fred
2001-10-27 Fred Fish <fnf@redhat.com>
* symfile.c (auto_solib_add): Update comment to note that
this variable is now just used as a boolean to control shlib
autoloading, and clarify when it is used.
* symfile.h (auto_solib_add): Ditto.
* symfile.c (auto_solib_limit): New variable that holds the
autoloading threshold instead of overloading auto_solib_add.
* symfile.h (auto_solib_limit): Ditto.
* doc/gdb.texinfo (auto-solib-add): Change docs to match
implementation change.
(auto-solib-limit): Add docs for new variable.
* irix5-nat.c (_initialize_solib): Change auto-solib-add
variable from var_zinteger to var_boolean and update help.
* osfsolib.c (_initialize_solib): Ditto.
* pa64solib.c (_initialize_pa64_solib): Ditto.
* solib.c (_initialize_solib): Ditto.
* somsolib.c (_initialize_som_solib): Ditto.
* xcoffsolib.c (_initialize_solib): Ditto.
* pa64solib.c (pa64_solib_total_st_size): Update comment to
note that the new auto_solib_limit variable is used instead
of overloading auto_solib_add variable.
(_initialize_pa64_solib): Ditto.
* somsolib.c (som_solib_total_st_size): Ditto.
(_initialize_som_solib): Ditto.
* pa64solib.c (_initialize_pa64_solib): Add new set/show
commands for auto-solib-limit variable.
* somsolib.c (_initialize_som_solib): Ditto
* pa64solib.c (add_to_solist): Check that auto_solib_add is
set and use auto_solib_limit as the threshold size instead
of auto_solib_add.
* somsolib.c (som_solib_add): Ditto, and also change warning
text about size threshold exceeded.
Index: irix5-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/irix5-nat.c,v
retrieving revision 1.14
diff -u -p -r1.14 irix5-nat.c
--- irix5-nat.c 2001/09/14 00:40:29 1.14
+++ irix5-nat.c 2001/10/27 19:32:35
@@ -1287,13 +1287,13 @@ _initialize_solib (void)
"Status of loaded shared object libraries.");
add_show_from_set
- (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
+ (add_set_cmd ("auto-solib-add", class_support, var_boolean,
(char *) &auto_solib_add,
"Set autoloading of shared library symbols.\n\
-If nonzero, symbols from all shared object libraries will be loaded\n\
-automatically when the inferior begins execution or when the dynamic linker\n\
-informs gdb that a new library has been loaded. Otherwise, symbols\n\
-must be loaded manually, using `sharedlibrary'.",
+If \"on\", symbols from all shared object libraries will be loaded\n\
+automatically when the inferior begins execution, when the dynamic linker\n\
+informs gdb that a new library has been loaded, or when attaching to the\n\
+inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
&setlist),
&showlist);
}
Index: osfsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/osfsolib.c,v
retrieving revision 1.10
diff -u -p -r1.10 osfsolib.c
--- osfsolib.c 2001/09/14 00:40:29 1.10
+++ osfsolib.c 2001/10/27 19:32:36
@@ -924,13 +924,13 @@ _initialize_solib (void)
"Status of loaded shared object libraries.");
add_show_from_set
- (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
+ (add_set_cmd ("auto-solib-add", class_support, var_boolean,
(char *) &auto_solib_add,
"Set autoloading of shared library symbols.\n\
-If nonzero, symbols from all shared object libraries will be loaded\n\
-automatically when the inferior begins execution or when the dynamic linker\n\
-informs gdb that a new library has been loaded. Otherwise, symbols\n\
-must be loaded manually, using `sharedlibrary'.",
+If \"on\", symbols from all shared object libraries will be loaded\n\
+automatically when the inferior begins execution, when the dynamic linker\n\
+informs gdb that a new library has been loaded, or when attaching to the\n\
+inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
&setlist),
&showlist);
}
Index: pa64solib.c
===================================================================
RCS file: /cvs/src/src/gdb/pa64solib.c,v
retrieving revision 1.11
diff -u -p -r1.11 pa64solib.c
--- pa64solib.c 2001/03/06 08:21:11 1.11
+++ pa64solib.c 2001/10/27 19:32:37
@@ -89,20 +89,20 @@ static struct so_list *so_list_head;
shared objects on the so_list_head list. (When we say size, here
we mean of the information before it is brought into memory and
potentially expanded by GDB.) When adding a new shlib, this value
- is compared against the threshold size, held by auto_solib_add
- (in megabytes). If adding symbols for the new shlib would cause
- the total size to exceed the threshold, then the new shlib's symbols
- are not loaded. */
+ is compared against a threshold size, held by auto_solib_limit (in
+ megabytes). If adding symbols for the new shlib would cause the
+ total size to exceed the threshold, then the new shlib's symbols
+ are not loaded. */
static LONGEST pa64_solib_total_st_size;
/* When the threshold is reached for any shlib, we refuse to add
symbols for subsequent shlibs, even if those shlibs' symbols would
- be small enough to fit under the threshold. (Although this may
+ be small enough to fit under the threshold. Although this may
result in one, early large shlib preventing the loading of later,
- smalller shlibs' symbols, it allows us to issue one informational
+ smaller shlibs' symbols, it allows us to issue one informational
message. The alternative, to issue a message for each shlib whose
symbols aren't loaded, could be a big annoyance where the threshold
- is exceeded due to a very large number of shlibs.) */
+ is exceeded due to a very large number of shlibs. */
static int pa64_solib_st_size_threshold_exceeded;
/* When adding fields, be sure to clear them in _initialize_pa64_solib. */
@@ -368,7 +368,7 @@ pa64_solib_load_symbols (struct so_list
/* Add symbols from shared libraries into the symtab list, unless the
- size threshold (specified by auto_solib_add, in megabytes) would
+ size threshold specified by auto_solib_limit (in megabytes) would
be exceeded. */
void
@@ -886,28 +886,37 @@ _initialize_pa64_solib (void)
"Load shared object library symbols for files matching REGEXP.");
add_info ("sharedlibrary", pa64_sharedlibrary_info_command,
"Status of loaded shared object libraries.");
+
add_show_from_set
- (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
+ (add_set_cmd ("auto-solib-add", class_support, var_boolean,
(char *) &auto_solib_add,
- "Set autoloading size threshold (in megabytes) of shared library symbols.\n\
-If nonzero, symbols from all shared object libraries will be loaded\n\
-automatically when the inferior begins execution or when the dynamic linker\n\
-informs gdb that a new library has been loaded, until the symbol table\n\
-of the program and libraries exceeds this threshold.\n\
-Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
+ "Set autoloading of shared library symbols.\n\
+If \"on\", symbols from all shared object libraries will be loaded\n\
+automatically when the inferior begins execution, when the dynamic linker\n\
+informs gdb that a new library has been loaded, or when attaching to the\n\
+inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
+ &setlist),
+ &showlist);
+
+ add_show_from_set
+ (add_set_cmd ("auto-solib-limit", class_support, var_zinteger,
+ (char *) &auto_solib_limit,
+ "Set threshold (in Mb) for autoloading shared library symbols.\n\
+When shared library autoloading is enabled, new libraries will be loaded\n\
+only until the total size of shared library symbols exceeds this\n\
+threshold in megabytes. Is ignored when 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 */
+ /* ??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_limit 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_limit = 100; /* Megabytes */
pa64_solib_restart ();
}
@@ -1157,8 +1166,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
+ && auto_solib_add
&& ( (st_size + pa64_solib_total_st_size)
- > (auto_solib_add * (LONGEST)1000000));
+ > (auto_solib_limit * (LONGEST)1000000));
if (pa64_solib_st_size_threshhold_exceeded)
{
pa64_solib_add_solib_objfile (new_so, dll_path, from_tty, 1);
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.43
diff -u -p -r1.43 solib.c
--- solib.c 2001/09/14 00:40:29 1.43
+++ solib.c 2001/10/27 19:32:38
@@ -841,13 +841,13 @@ _initialize_solib (void)
"Unload all shared object library symbols.");
add_show_from_set
- (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
+ (add_set_cmd ("auto-solib-add", class_support, var_boolean,
(char *) &auto_solib_add,
"Set autoloading of shared library symbols.\n\
-If nonzero, symbols from all shared object libraries will be loaded\n\
-automatically when the inferior begins execution or when the dynamic linker\n\
-informs gdb that a new library has been loaded. Otherwise, symbols\n\
-must be loaded manually, using `sharedlibrary'.",
+If \"on\", symbols from all shared object libraries will be loaded\n\
+automatically when the inferior begins execution, when the dynamic linker\n\
+informs gdb that a new library has been loaded, or when attaching to the\n\
+inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
&setlist),
&showlist);
Index: somsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/somsolib.c,v
retrieving revision 1.14
diff -u -p -r1.14 somsolib.c
--- somsolib.c 2001/10/24 01:19:12 1.14
+++ somsolib.c 2001/10/27 19:32:40
@@ -161,11 +161,10 @@ static struct so_list *so_list_head;
shared objects on the so_list_head list. (When we say size, here
we mean of the information before it is brought into memory and
potentially expanded by GDB.) When adding a new shlib, this value
- is compared against the threshold size, held by auto_solib_add
+ is compared against the threshold size, held by auto_solib_limit
(in megabytes). If adding symbols for the new shlib would cause
- the total size to exceed the threshold, then the new shlib's symbols
- are not loaded.
- */
+ the total size to exceed the threshold, then the new shlib's
+ symbols are not loaded. */
static LONGEST som_solib_total_st_size;
/* When the threshold is reached for any shlib, we refuse to add
@@ -403,7 +402,7 @@ som_solib_load_symbols (struct so_list *
/* Add symbols from shared libraries into the symtab list, unless the
- size threshold (specified by auto_solib_add, in megabytes) would
+ size threshold specified by auto_solib_limit (in megabytes) would
be exceeded. */
void
@@ -778,12 +777,13 @@ 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));
+ auto_solib_add &&
+ ((st_size + som_solib_total_st_size) > (auto_solib_limit * (LONGEST) 1000000));
if (som_solib_st_size_threshold_exceeded)
{
if (!threshold_warning_given)
- warning ("Symbols for some libraries have not been loaded, because\ndoing so would exceed the size threshold specified by auto-solib-add.\nTo manually load symbols, use the 'sharedlibrary' command.\nTo raise the threshold, set auto-solib-add to a larger value and rerun\nthe program.\n");
+ warning ("Symbols for some libraries have not been loaded, because\ndoing so would exceed the size threshold specified by auto-solib-limit.\nTo manually load symbols, use the 'sharedlibrary' command.\nTo raise the threshold, set auto-solib-limit to a larger value and rerun\nthe program.\n");
threshold_warning_given = 1;
/* We'll still make note of this shlib, even if we don't
@@ -1571,28 +1571,37 @@ _initialize_som_solib (void)
"Load shared object library symbols for files matching REGEXP.");
add_info ("sharedlibrary", som_sharedlibrary_info_command,
"Status of loaded shared object libraries.");
+
add_show_from_set
- (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
+ (add_set_cmd ("auto-solib-add", class_support, var_boolean,
(char *) &auto_solib_add,
- "Set autoloading size threshold (in megabytes) of shared library symbols.\n\
-If nonzero, symbols from all shared object libraries will be loaded\n\
-automatically when the inferior begins execution or when the dynamic linker\n\
-informs gdb that a new library has been loaded, until the symbol table\n\
-of the program and libraries exceeds this threshold.\n\
-Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
+ "Set autoloading of shared library symbols.\n\
+If \"on\", symbols from all shared object libraries will be loaded\n\
+automatically when the inferior begins execution, when the dynamic linker\n\
+informs gdb that a new library has been loaded, or when attaching to the\n\
+inferior. 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 */
+ add_show_from_set
+ (add_set_cmd ("auto-solib-limit", class_support, var_zinteger,
+ (char *) &auto_solib_limit,
+ "Set threshold (in Mb) for autoloading shared library symbols.\n\
+When shared library autoloading is enabled, new libraries will be loaded\n\
+only until the total size of shared library symbols exceeds this\n\
+threshold in megabytes. Is ignored when 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_limit 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_limit = 100; /* Megabytes */
som_solib_restart ();
}
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.40
diff -u -p -r1.40 symfile.c
--- symfile.c 2001/10/24 17:13:12 1.40
+++ symfile.c 2001/10/27 19:32:42
@@ -177,27 +177,27 @@ 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.
-
- 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
+/* If non-zero, 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.
-
- 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."
- */
+ report all the functions that are actually present. */
int auto_solib_add = 1;
+
+/* For systems that support it, a threshold size in megabytes. If
+ automatically adding a new library's symbol table to those already
+ known to the debugger would cause the total shared library symbol
+ size to exceed this threshhold, then the shlib's symbols are not
+ added. The threshold is ignored if the user explicitly asks for a
+ shlib to be added, such as when using the "sharedlibrary"
+ command. */
+
+int auto_solib_limit;
\f
/* 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.9
diff -u -p -r1.9 symfile.h
--- symfile.h 2001/03/06 08:21:17 1.9
+++ symfile.h 2001/10/27 19:32:43
@@ -218,18 +218,27 @@ extern char *obconcat (struct obstack *o
/* Variables */
-/* whether to auto load solibs at startup time: 0/1.
+/* If non-zero, 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, 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.
+extern int auto_solib_add;
- On other platforms, > 0 means, "always auto load".
- */
+/* For systems that support it, a threshold size in megabytes. If
+ automatically adding a new library's symbol table to those already
+ known to the debugger would cause the total shared library symbol
+ size to exceed this threshhold, then the shlib's symbols are not
+ added. The threshold is ignored if the user explicitly asks for a
+ shlib to be added, such as when using the "sharedlibrary"
+ command. */
-extern int auto_solib_add;
+extern int auto_solib_limit;
/* From symfile.c */
Index: xcoffsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/xcoffsolib.c,v
retrieving revision 1.10
diff -u -p -r1.10 xcoffsolib.c
--- xcoffsolib.c 2001/07/19 04:58:17 1.10
+++ xcoffsolib.c 2001/10/27 19:32:43
@@ -184,13 +184,13 @@ _initialize_solib (void)
"Status of loaded shared object libraries");
add_show_from_set
- (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
+ (add_set_cmd ("auto-solib-add", class_support, var_boolean,
(char *) &auto_solib_add,
"Set autoloading of shared library symbols.\n\
-If nonzero, symbols from all shared object libraries will be loaded\n\
-automatically when the inferior begins execution or when the dynamic linker\n\
-informs gdb that a new library has been loaded. Otherwise, symbols\n\
-must be loaded manually, using `sharedlibrary'.",
+If \"on\", symbols from all shared object libraries will be loaded\n\
+automatically when the inferior begins execution, when the dynamic linker\n\
+informs gdb that a new library has been loaded, or when attaching to the\n\
+inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
&setlist),
&showlist);
}
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.51
diff -u -p -r1.51 gdb.texinfo
--- gdb.texinfo 2001/09/12 19:49:52 1.51
+++ gdb.texinfo 2001/10/27 19:32:59
@@ -8965,7 +8965,33 @@ automatically loads the symbols at the t
@c FIXME...symbols---eg in a break cmd---assuming they are from a shared
@c FIXME...lib; check this from time to time when updating manual
+There are times however when you may wish to not automatically load
+symbol definitions from shared libraries, such as when they are
+particularly large or there are many of them.
+
+To control the automatic loading of shared library symbols, use the
+commands:
+
@table @code
+@kindex set auto-solib-add
+@item set auto-solib-add @var{mode}
+Set the shared library symbol autoloading mode. If it is @code{on},
+symbols from all shared object libraries will be loaded automatically
+when the inferior begins execution, you attach to an independently
+started inferior, or when the dynamic linker informs @value{GDBN} that a
+new library has been loaded. Otherwise if it is @code{off}, symbols
+must be loaded manually, using the @code{sharedlibrary} command. The
+default value is @code{on}.
+
+@kindex show auto-solib-add
+@item show auto-solib-add
+Display the current autoloading mode.
+@end table
+
+To explicitly load shared library symbols use the @code{sharedlibrary}
+command:
+
+@table @code
@kindex info sharedlibrary
@kindex info share
@item info share
@@ -8984,9 +9010,12 @@ required by your program for a core file
loaded.
@end table
-On HP-UX systems, @value{GDBN} detects the loading of a shared library
-and automatically reads in symbols from the newly loaded library, up to
-a threshold that is initially set but that you can modify if you wish.
+On some systems, such as HP-UX systems, @value{GDBN} supports
+autoloading shared library symbols until a limiting threshold size is
+reached. This provides the benefit of allowing autoloading to remain on
+by default while avoiding attempting to autoload excessively large
+shared libraries, up to a threshold that is initially set but that you
+can modify if you wish.
Beyond that threshold, symbols from shared libraries must be explicitly
loaded. To load these symbols, use the command @code{sharedlibrary
@@ -8996,18 +9025,17 @@ automatically by @value{GDBN} and need n
To display or set the threshold, use the commands:
@table @code
-@kindex set auto-solib-add
-@item set auto-solib-add @var{threshold}
+@kindex set auto-solib-limit
+@item set auto-solib-limit @var{threshold}
Set the autoloading size threshold, in megabytes. If @var{threshold} is
-nonzero, symbols from all shared object libraries will be loaded
-automatically when the inferior begins execution or when the dynamic
-linker informs @value{GDBN} that a new library has been loaded, until
-the symbol table of the program and libraries exceeds this threshold.
-Otherwise, symbols must be loaded manually, using the
-@code{sharedlibrary} command. The default threshold is 100 megabytes.
+nonzero and shared library autoloading is enabled, symbols from all
+shared object libraries will be loaded until the total size of the
+loaded shared library symbols exceeds this threshold. Otherwise,
+symbols must be loaded manually, using the @code{sharedlibrary} command.
+The default threshold is 100 megabytes.
-@kindex show auto-solib-add
-@item show auto-solib-add
+@kindex show auto-solib-limit
+@item show auto-solib-limit
Display the current autoloading size threshold, in megabytes.
@end table
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [RFA] Change auto-solib-add to boolean, add auto-solib-limit
2001-10-27 12:50 [RFA] Change auto-solib-add to boolean, add auto-solib-limit Fred Fish
@ 2001-10-27 17:01 ` Elena Zannoni
2001-10-28 1:54 ` Eli Zaretskii
1 sibling, 0 replies; 21+ messages in thread
From: Elena Zannoni @ 2001-10-27 17:01 UTC (permalink / raw)
To: fnf; +Cc: gdb-patches
Symfile.c and .h changes are Ok.
Thanks, Fred.
Elena
Fred Fish writes:
> n the current gdb, auto-solib-add is used as both a boolean and as a
> limiting size in megabytes. This patch removes this overloaded
> meaning.
>
> In the past I've submitted several versions of a patch to fix some
> problems with auto-solib-add, but they have never quite been approved
> in full. In response to feedback, and by specific request to remove
> the overloaded meaning of the auto-solib-add variable, this patch
> changes auto-solib-add into a boolean and adds a new variable, called
> auto-solib-limit to hold the shlib symbol table size limit value for
> those systems that support this.
>
> Once this patch is approved and installed, I'll rework my previous
> auto-solib-add patch and resubmit it.
>
> -Fred
>
> 2001-10-27 Fred Fish <fnf@redhat.com>
>
> * symfile.c (auto_solib_add): Update comment to note that
> this variable is now just used as a boolean to control shlib
> autoloading, and clarify when it is used.
> * symfile.h (auto_solib_add): Ditto.
>
> * symfile.c (auto_solib_limit): New variable that holds the
> autoloading threshold instead of overloading auto_solib_add.
> * symfile.h (auto_solib_limit): Ditto.
>
> * doc/gdb.texinfo (auto-solib-add): Change docs to match
> implementation change.
> (auto-solib-limit): Add docs for new variable.
>
> * irix5-nat.c (_initialize_solib): Change auto-solib-add
> variable from var_zinteger to var_boolean and update help.
> * osfsolib.c (_initialize_solib): Ditto.
> * pa64solib.c (_initialize_pa64_solib): Ditto.
> * solib.c (_initialize_solib): Ditto.
> * somsolib.c (_initialize_som_solib): Ditto.
> * xcoffsolib.c (_initialize_solib): Ditto.
>
> * pa64solib.c (pa64_solib_total_st_size): Update comment to
> note that the new auto_solib_limit variable is used instead
> of overloading auto_solib_add variable.
> (_initialize_pa64_solib): Ditto.
> * somsolib.c (som_solib_total_st_size): Ditto.
> (_initialize_som_solib): Ditto.
>
> * pa64solib.c (_initialize_pa64_solib): Add new set/show
> commands for auto-solib-limit variable.
> * somsolib.c (_initialize_som_solib): Ditto
>
> * pa64solib.c (add_to_solist): Check that auto_solib_add is
> set and use auto_solib_limit as the threshold size instead
> of auto_solib_add.
> * somsolib.c (som_solib_add): Ditto, and also change warning
> text about size threshold exceeded.
>
>
> Index: irix5-nat.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/irix5-nat.c,v
> retrieving revision 1.14
> diff -u -p -r1.14 irix5-nat.c
> --- irix5-nat.c 2001/09/14 00:40:29 1.14
> +++ irix5-nat.c 2001/10/27 19:32:35
> @@ -1287,13 +1287,13 @@ _initialize_solib (void)
> "Status of loaded shared object libraries.");
>
> add_show_from_set
> - (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
> + (add_set_cmd ("auto-solib-add", class_support, var_boolean,
> (char *) &auto_solib_add,
> "Set autoloading of shared library symbols.\n\
> -If nonzero, symbols from all shared object libraries will be loaded\n\
> -automatically when the inferior begins execution or when the dynamic linker\n\
> -informs gdb that a new library has been loaded. Otherwise, symbols\n\
> -must be loaded manually, using `sharedlibrary'.",
> +If \"on\", symbols from all shared object libraries will be loaded\n\
> +automatically when the inferior begins execution, when the dynamic linker\n\
> +informs gdb that a new library has been loaded, or when attaching to the\n\
> +inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
> &setlist),
> &showlist);
> }
> Index: osfsolib.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/osfsolib.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 osfsolib.c
> --- osfsolib.c 2001/09/14 00:40:29 1.10
> +++ osfsolib.c 2001/10/27 19:32:36
> @@ -924,13 +924,13 @@ _initialize_solib (void)
> "Status of loaded shared object libraries.");
>
> add_show_from_set
> - (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
> + (add_set_cmd ("auto-solib-add", class_support, var_boolean,
> (char *) &auto_solib_add,
> "Set autoloading of shared library symbols.\n\
> -If nonzero, symbols from all shared object libraries will be loaded\n\
> -automatically when the inferior begins execution or when the dynamic linker\n\
> -informs gdb that a new library has been loaded. Otherwise, symbols\n\
> -must be loaded manually, using `sharedlibrary'.",
> +If \"on\", symbols from all shared object libraries will be loaded\n\
> +automatically when the inferior begins execution, when the dynamic linker\n\
> +informs gdb that a new library has been loaded, or when attaching to the\n\
> +inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
> &setlist),
> &showlist);
> }
> Index: pa64solib.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/pa64solib.c,v
> retrieving revision 1.11
> diff -u -p -r1.11 pa64solib.c
> --- pa64solib.c 2001/03/06 08:21:11 1.11
> +++ pa64solib.c 2001/10/27 19:32:37
> @@ -89,20 +89,20 @@ static struct so_list *so_list_head;
> shared objects on the so_list_head list. (When we say size, here
> we mean of the information before it is brought into memory and
> potentially expanded by GDB.) When adding a new shlib, this value
> - is compared against the threshold size, held by auto_solib_add
> - (in megabytes). If adding symbols for the new shlib would cause
> - the total size to exceed the threshold, then the new shlib's symbols
> - are not loaded. */
> + is compared against a threshold size, held by auto_solib_limit (in
> + megabytes). If adding symbols for the new shlib would cause the
> + total size to exceed the threshold, then the new shlib's symbols
> + are not loaded. */
> static LONGEST pa64_solib_total_st_size;
>
> /* When the threshold is reached for any shlib, we refuse to add
> symbols for subsequent shlibs, even if those shlibs' symbols would
> - be small enough to fit under the threshold. (Although this may
> + be small enough to fit under the threshold. Although this may
> result in one, early large shlib preventing the loading of later,
> - smalller shlibs' symbols, it allows us to issue one informational
> + smaller shlibs' symbols, it allows us to issue one informational
> message. The alternative, to issue a message for each shlib whose
> symbols aren't loaded, could be a big annoyance where the threshold
> - is exceeded due to a very large number of shlibs.) */
> + is exceeded due to a very large number of shlibs. */
> static int pa64_solib_st_size_threshold_exceeded;
>
> /* When adding fields, be sure to clear them in _initialize_pa64_solib. */
> @@ -368,7 +368,7 @@ pa64_solib_load_symbols (struct so_list
>
>
> /* Add symbols from shared libraries into the symtab list, unless the
> - size threshold (specified by auto_solib_add, in megabytes) would
> + size threshold specified by auto_solib_limit (in megabytes) would
> be exceeded. */
>
> void
> @@ -886,28 +886,37 @@ _initialize_pa64_solib (void)
> "Load shared object library symbols for files matching REGEXP.");
> add_info ("sharedlibrary", pa64_sharedlibrary_info_command,
> "Status of loaded shared object libraries.");
> +
> add_show_from_set
> - (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
> + (add_set_cmd ("auto-solib-add", class_support, var_boolean,
> (char *) &auto_solib_add,
> - "Set autoloading size threshold (in megabytes) of shared library symbols.\n\
> -If nonzero, symbols from all shared object libraries will be loaded\n\
> -automatically when the inferior begins execution or when the dynamic linker\n\
> -informs gdb that a new library has been loaded, until the symbol table\n\
> -of the program and libraries exceeds this threshold.\n\
> -Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
> + "Set autoloading of shared library symbols.\n\
> +If \"on\", symbols from all shared object libraries will be loaded\n\
> +automatically when the inferior begins execution, when the dynamic linker\n\
> +informs gdb that a new library has been loaded, or when attaching to the\n\
> +inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
> + &setlist),
> + &showlist);
> +
> + add_show_from_set
> + (add_set_cmd ("auto-solib-limit", class_support, var_zinteger,
> + (char *) &auto_solib_limit,
> + "Set threshold (in Mb) for autoloading shared library symbols.\n\
> +When shared library autoloading is enabled, new libraries will be loaded\n\
> +only until the total size of shared library symbols exceeds this\n\
> +threshold in megabytes. Is ignored when 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 */
> + /* ??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_limit 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_limit = 100; /* Megabytes */
>
> pa64_solib_restart ();
> }
> @@ -1157,8 +1166,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
> + && auto_solib_add
> && ( (st_size + pa64_solib_total_st_size)
> - > (auto_solib_add * (LONGEST)1000000));
> + > (auto_solib_limit * (LONGEST)1000000));
> if (pa64_solib_st_size_threshhold_exceeded)
> {
> pa64_solib_add_solib_objfile (new_so, dll_path, from_tty, 1);
> Index: solib.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/solib.c,v
> retrieving revision 1.43
> diff -u -p -r1.43 solib.c
> --- solib.c 2001/09/14 00:40:29 1.43
> +++ solib.c 2001/10/27 19:32:38
> @@ -841,13 +841,13 @@ _initialize_solib (void)
> "Unload all shared object library symbols.");
>
> add_show_from_set
> - (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
> + (add_set_cmd ("auto-solib-add", class_support, var_boolean,
> (char *) &auto_solib_add,
> "Set autoloading of shared library symbols.\n\
> -If nonzero, symbols from all shared object libraries will be loaded\n\
> -automatically when the inferior begins execution or when the dynamic linker\n\
> -informs gdb that a new library has been loaded. Otherwise, symbols\n\
> -must be loaded manually, using `sharedlibrary'.",
> +If \"on\", symbols from all shared object libraries will be loaded\n\
> +automatically when the inferior begins execution, when the dynamic linker\n\
> +informs gdb that a new library has been loaded, or when attaching to the\n\
> +inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
> &setlist),
> &showlist);
>
> Index: somsolib.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/somsolib.c,v
> retrieving revision 1.14
> diff -u -p -r1.14 somsolib.c
> --- somsolib.c 2001/10/24 01:19:12 1.14
> +++ somsolib.c 2001/10/27 19:32:40
> @@ -161,11 +161,10 @@ static struct so_list *so_list_head;
> shared objects on the so_list_head list. (When we say size, here
> we mean of the information before it is brought into memory and
> potentially expanded by GDB.) When adding a new shlib, this value
> - is compared against the threshold size, held by auto_solib_add
> + is compared against the threshold size, held by auto_solib_limit
> (in megabytes). If adding symbols for the new shlib would cause
> - the total size to exceed the threshold, then the new shlib's symbols
> - are not loaded.
> - */
> + the total size to exceed the threshold, then the new shlib's
> + symbols are not loaded. */
> static LONGEST som_solib_total_st_size;
>
> /* When the threshold is reached for any shlib, we refuse to add
> @@ -403,7 +402,7 @@ som_solib_load_symbols (struct so_list *
>
>
> /* Add symbols from shared libraries into the symtab list, unless the
> - size threshold (specified by auto_solib_add, in megabytes) would
> + size threshold specified by auto_solib_limit (in megabytes) would
> be exceeded. */
>
> void
> @@ -778,12 +777,13 @@ 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));
> + auto_solib_add &&
> + ((st_size + som_solib_total_st_size) > (auto_solib_limit * (LONGEST) 1000000));
>
> if (som_solib_st_size_threshold_exceeded)
> {
> if (!threshold_warning_given)
> - warning ("Symbols for some libraries have not been loaded, because\ndoing so would exceed the size threshold specified by auto-solib-add.\nTo manually load symbols, use the 'sharedlibrary' command.\nTo raise the threshold, set auto-solib-add to a larger value and rerun\nthe program.\n");
> + warning ("Symbols for some libraries have not been loaded, because\ndoing so would exceed the size threshold specified by auto-solib-limit.\nTo manually load symbols, use the 'sharedlibrary' command.\nTo raise the threshold, set auto-solib-limit to a larger value and rerun\nthe program.\n");
> threshold_warning_given = 1;
>
> /* We'll still make note of this shlib, even if we don't
> @@ -1571,28 +1571,37 @@ _initialize_som_solib (void)
> "Load shared object library symbols for files matching REGEXP.");
> add_info ("sharedlibrary", som_sharedlibrary_info_command,
> "Status of loaded shared object libraries.");
> +
> add_show_from_set
> - (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
> + (add_set_cmd ("auto-solib-add", class_support, var_boolean,
> (char *) &auto_solib_add,
> - "Set autoloading size threshold (in megabytes) of shared library symbols.\n\
> -If nonzero, symbols from all shared object libraries will be loaded\n\
> -automatically when the inferior begins execution or when the dynamic linker\n\
> -informs gdb that a new library has been loaded, until the symbol table\n\
> -of the program and libraries exceeds this threshold.\n\
> -Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
> + "Set autoloading of shared library symbols.\n\
> +If \"on\", symbols from all shared object libraries will be loaded\n\
> +automatically when the inferior begins execution, when the dynamic linker\n\
> +informs gdb that a new library has been loaded, or when attaching to the\n\
> +inferior. 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 */
> + add_show_from_set
> + (add_set_cmd ("auto-solib-limit", class_support, var_zinteger,
> + (char *) &auto_solib_limit,
> + "Set threshold (in Mb) for autoloading shared library symbols.\n\
> +When shared library autoloading is enabled, new libraries will be loaded\n\
> +only until the total size of shared library symbols exceeds this\n\
> +threshold in megabytes. Is ignored when 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_limit 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_limit = 100; /* Megabytes */
>
> som_solib_restart ();
> }
> Index: symfile.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/symfile.c,v
> retrieving revision 1.40
> diff -u -p -r1.40 symfile.c
> --- symfile.c 2001/10/24 17:13:12 1.40
> +++ symfile.c 2001/10/27 19:32:42
> @@ -177,27 +177,27 @@ 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.
> -
> - 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
> +/* If non-zero, 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.
> -
> - 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."
> - */
> + report all the functions that are actually present. */
>
> int auto_solib_add = 1;
> +
> +/* For systems that support it, a threshold size in megabytes. If
> + automatically adding a new library's symbol table to those already
> + known to the debugger would cause the total shared library symbol
> + size to exceed this threshhold, then the shlib's symbols are not
> + added. The threshold is ignored if the user explicitly asks for a
> + shlib to be added, such as when using the "sharedlibrary"
> + command. */
> +
> +int auto_solib_limit;
> \f
>
> /* 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.9
> diff -u -p -r1.9 symfile.h
> --- symfile.h 2001/03/06 08:21:17 1.9
> +++ symfile.h 2001/10/27 19:32:43
> @@ -218,18 +218,27 @@ extern char *obconcat (struct obstack *o
>
> /* Variables */
>
> -/* whether to auto load solibs at startup time: 0/1.
> +/* If non-zero, 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, 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.
> +extern int auto_solib_add;
>
> - On other platforms, > 0 means, "always auto load".
> - */
> +/* For systems that support it, a threshold size in megabytes. If
> + automatically adding a new library's symbol table to those already
> + known to the debugger would cause the total shared library symbol
> + size to exceed this threshhold, then the shlib's symbols are not
> + added. The threshold is ignored if the user explicitly asks for a
> + shlib to be added, such as when using the "sharedlibrary"
> + command. */
>
> -extern int auto_solib_add;
> +extern int auto_solib_limit;
>
> /* From symfile.c */
>
> Index: xcoffsolib.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/xcoffsolib.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 xcoffsolib.c
> --- xcoffsolib.c 2001/07/19 04:58:17 1.10
> +++ xcoffsolib.c 2001/10/27 19:32:43
> @@ -184,13 +184,13 @@ _initialize_solib (void)
> "Status of loaded shared object libraries");
>
> add_show_from_set
> - (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
> + (add_set_cmd ("auto-solib-add", class_support, var_boolean,
> (char *) &auto_solib_add,
> "Set autoloading of shared library symbols.\n\
> -If nonzero, symbols from all shared object libraries will be loaded\n\
> -automatically when the inferior begins execution or when the dynamic linker\n\
> -informs gdb that a new library has been loaded. Otherwise, symbols\n\
> -must be loaded manually, using `sharedlibrary'.",
> +If \"on\", symbols from all shared object libraries will be loaded\n\
> +automatically when the inferior begins execution, when the dynamic linker\n\
> +informs gdb that a new library has been loaded, or when attaching to the\n\
> +inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
> &setlist),
> &showlist);
> }
> Index: doc/gdb.texinfo
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
> retrieving revision 1.51
> diff -u -p -r1.51 gdb.texinfo
> --- gdb.texinfo 2001/09/12 19:49:52 1.51
> +++ gdb.texinfo 2001/10/27 19:32:59
> @@ -8965,7 +8965,33 @@ automatically loads the symbols at the t
> @c FIXME...symbols---eg in a break cmd---assuming they are from a shared
> @c FIXME...lib; check this from time to time when updating manual
>
> +There are times however when you may wish to not automatically load
> +symbol definitions from shared libraries, such as when they are
> +particularly large or there are many of them.
> +
> +To control the automatic loading of shared library symbols, use the
> +commands:
> +
> @table @code
> +@kindex set auto-solib-add
> +@item set auto-solib-add @var{mode}
> +Set the shared library symbol autoloading mode. If it is @code{on},
> +symbols from all shared object libraries will be loaded automatically
> +when the inferior begins execution, you attach to an independently
> +started inferior, or when the dynamic linker informs @value{GDBN} that a
> +new library has been loaded. Otherwise if it is @code{off}, symbols
> +must be loaded manually, using the @code{sharedlibrary} command. The
> +default value is @code{on}.
> +
> +@kindex show auto-solib-add
> +@item show auto-solib-add
> +Display the current autoloading mode.
> +@end table
> +
> +To explicitly load shared library symbols use the @code{sharedlibrary}
> +command:
> +
> +@table @code
> @kindex info sharedlibrary
> @kindex info share
> @item info share
> @@ -8984,9 +9010,12 @@ required by your program for a core file
> loaded.
> @end table
>
> -On HP-UX systems, @value{GDBN} detects the loading of a shared library
> -and automatically reads in symbols from the newly loaded library, up to
> -a threshold that is initially set but that you can modify if you wish.
> +On some systems, such as HP-UX systems, @value{GDBN} supports
> +autoloading shared library symbols until a limiting threshold size is
> +reached. This provides the benefit of allowing autoloading to remain on
> +by default while avoiding attempting to autoload excessively large
> +shared libraries, up to a threshold that is initially set but that you
> +can modify if you wish.
>
> Beyond that threshold, symbols from shared libraries must be explicitly
> loaded. To load these symbols, use the command @code{sharedlibrary
> @@ -8996,18 +9025,17 @@ automatically by @value{GDBN} and need n
> To display or set the threshold, use the commands:
>
> @table @code
> -@kindex set auto-solib-add
> -@item set auto-solib-add @var{threshold}
> +@kindex set auto-solib-limit
> +@item set auto-solib-limit @var{threshold}
> Set the autoloading size threshold, in megabytes. If @var{threshold} is
> -nonzero, symbols from all shared object libraries will be loaded
> -automatically when the inferior begins execution or when the dynamic
> -linker informs @value{GDBN} that a new library has been loaded, until
> -the symbol table of the program and libraries exceeds this threshold.
> -Otherwise, symbols must be loaded manually, using the
> -@code{sharedlibrary} command. The default threshold is 100 megabytes.
> +nonzero and shared library autoloading is enabled, symbols from all
> +shared object libraries will be loaded until the total size of the
> +loaded shared library symbols exceeds this threshold. Otherwise,
> +symbols must be loaded manually, using the @code{sharedlibrary} command.
> +The default threshold is 100 megabytes.
>
> -@kindex show auto-solib-add
> -@item show auto-solib-add
> +@kindex show auto-solib-limit
> +@item show auto-solib-limit
> Display the current autoloading size threshold, in megabytes.
> @end table
>
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [RFA] Change auto-solib-add to boolean, add auto-solib-limit
2001-10-27 12:50 [RFA] Change auto-solib-add to boolean, add auto-solib-limit Fred Fish
2001-10-27 17:01 ` Elena Zannoni
@ 2001-10-28 1:54 ` Eli Zaretskii
1 sibling, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2001-10-28 1:54 UTC (permalink / raw)
To: fnf; +Cc: gdb-patches, fnf
> From: Fred Fish <fnf@www.ninemoons.com>
> Date: Sat, 27 Oct 2001 12:48:21 -0700 (MST)
>
> In the current gdb, auto-solib-add is used as both a boolean and as a
> limiting size in megabytes. This patch removes this overloaded
> meaning.
The patches to gdb.texinfo are approved, with the following comments:
> +There are times however when you may wish to not automatically load
I think we need commas on both sides of "however".
> +@kindex set auto-solib-add
> +@item set auto-solib-add @var{mode}
> +Set the shared library symbol autoloading mode. If it is @code{on},
> +symbols from all shared object libraries will be loaded automatically
I think this sentence will be much clearer if you begin it like this:
If @var{mode} is @code{on},
> +new library has been loaded. Otherwise if it is @code{off}, symbols
Same here: Instead of "Otherwise if it is @code{off}", let's say "If
@var{mode} is @code{off}".
> +To explicitly load shared library symbols use the @code{sharedlibrary}
> +command:
This needs a comma after "symbols".
> +reached. This provides the benefit of allowing autoloading to remain on
> +by default while avoiding attempting to autoload excessively large
> +shared libraries, up to a threshold that is initially set but that you
> +can modify if you wish.
This sentence is in a dire need of commas ;-)
Also, "while avoiding attempting to autoload" sounds awkwardly. How
about "but avoids autoloading" instead?
> +@item set auto-solib-limit @var{threshold}
> Set the autoloading size threshold, in megabytes.
This leaves me wondering: can the value of threshold be a fraction,
like 0.5? I think this should be stated in the docs. (Yes, I know
that it was so before your changes.)
Thanks!
^ permalink raw reply [flat|nested] 21+ messages in thread
* RFC: Avoid calling XXX_skip_prologue for assembly code
@ 2001-10-05 12:55 Fred Fish
2001-10-11 13:13 ` Jim Blandy
` (3 more replies)
0 siblings, 4 replies; 21+ messages in thread
From: Fred Fish @ 2001-10-05 12:55 UTC (permalink / raw)
To: gdb-patches; +Cc: fnf
Does anyone have any issues with the attached patch?
There is little point in attempting to skip over prologues if we
already know for a fact that the source language is assembly.
In fact, attempting to do so may actually be incorrect if the user has
taken the output of the compiler, used that as the basis for his code,
and hand optimized it in some way to produce an assembly version.
There could still be prologue code in the hand crafted version.
Another way to handle this issue would be to have each of the
"XXX_skip_prologue" functions in the various XXX-tdep.c files do their
own checking first to see if the language is assembly, but they don't
have easy access to that info, and each of them would have to do
something similar to this patch anyway, so it seems more logical to
just do the test in one place.
-Fred
==================================================================
2001-10-05 Fred Fish <fnf@cygnus.com>
* symtab.c (find_function_start_sal): Do not attempt to skip over
prologues for assembly functions.
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.42
diff -u -p -r1.42 symtab.c
--- symtab.c 2001/07/07 17:19:50 1.42
+++ symtab.c 2001/10/05 19:42:05
@@ -2031,7 +2031,7 @@ find_function_start_sal (struct symbol *
pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
fixup_symbol_section (sym, NULL);
- if (funfirstline)
+ if (funfirstline && SYMBOL_LANGUAGE(sym) != language_asm)
{ /* skip "first line" of function (which is actually its prologue) */
asection *section = SYMBOL_BFD_SECTION (sym);
/* If function is in an unmapped overlay, use its unmapped LMA
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: RFC: Avoid calling XXX_skip_prologue for assembly code
2001-10-05 12:55 RFC: Avoid calling XXX_skip_prologue for assembly code Fred Fish
@ 2001-10-11 13:13 ` Jim Blandy
2001-10-11 13:37 ` Andrew Cagney
2001-10-11 13:22 ` Jim Blandy
` (2 subsequent siblings)
3 siblings, 1 reply; 21+ messages in thread
From: Jim Blandy @ 2001-10-11 13:13 UTC (permalink / raw)
To: fnf; +Cc: gdb-patches
Fred Fish <fnf@www.ninemoons.com> writes:
> Does anyone have any issues with the attached patch?
>
> There is little point in attempting to skip over prologues if we
> already know for a fact that the source language is assembly.
>
> In fact, attempting to do so may actually be incorrect if the user has
> taken the output of the compiler, used that as the basis for his code,
> and hand optimized it in some way to produce an assembly version.
> There could still be prologue code in the hand crafted version.
>
> Another way to handle this issue would be to have each of the
> "XXX_skip_prologue" functions in the various XXX-tdep.c files do their
> own checking first to see if the language is assembly, but they don't
> have easy access to that info, and each of them would have to do
> something similar to this patch anyway, so it seems more logical to
> just do the test in one place.
This seems like a good idea, but I'm told that Red Hat has an
(as-of-yet unreleased) port which actually analyzes prologues for
assembly-language functions. I assume there's some sort of underlying
ABI that justifies this.
>
> -Fred
>
> ==================================================================
>
> 2001-10-05 Fred Fish <fnf@cygnus.com>
>
> * symtab.c (find_function_start_sal): Do not attempt to skip over
> prologues for assembly functions.
>
> Index: symtab.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/symtab.c,v
> retrieving revision 1.42
> diff -u -p -r1.42 symtab.c
> --- symtab.c 2001/07/07 17:19:50 1.42
> +++ symtab.c 2001/10/05 19:42:05
> @@ -2031,7 +2031,7 @@ find_function_start_sal (struct symbol *
>
> pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
> fixup_symbol_section (sym, NULL);
> - if (funfirstline)
> + if (funfirstline && SYMBOL_LANGUAGE(sym) != language_asm)
> { /* skip "first line" of function (which is actually its prologue) */
> asection *section = SYMBOL_BFD_SECTION (sym);
> /* If function is in an unmapped overlay, use its unmapped LMA
>
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: RFC: Avoid calling XXX_skip_prologue for assembly code
2001-10-11 13:13 ` Jim Blandy
@ 2001-10-11 13:37 ` Andrew Cagney
0 siblings, 0 replies; 21+ messages in thread
From: Andrew Cagney @ 2001-10-11 13:37 UTC (permalink / raw)
To: Jim Blandy, fnf; +Cc: gdb-patches
> "XXX_skip_prologue" functions in the various XXX-tdep.c files do their
>> own checking first to see if the language is assembly, but they don't
>> have easy access to that info, and each of them would have to do
>> something similar to this patch anyway, so it seems more logical to
>> just do the test in one place.
>
>
> This seems like a good idea, but I'm told that Red Hat has an
> (as-of-yet unreleased) port which actually analyzes prologues for
> assembly-language functions. I assume there's some sort of underlying
> ABI that justifies this.
(I'm not sure what is mean by underlying ABI, but anyway.) This is a
hard problem.
gdb/testsuite/gdb.asm/ contains GDB's sole assembler test (sigh). It
works on the assumption that the target is going to treat ``break main''
and ``break *main'' separatly. The latter stepping into the function to
the point were the stack frame is valid. This suggests that the
behavour is pretty entrenched. The d10v has the necessary framework for
the test. A patch for the h8[35]00 was also submitted but got lost in
the paper work.
Anyway, I suspect (is this true?) that this patch would make ``break
vfprintf'' and ``break *vfprintf'' identical. That in turn could mean
that a backtrace from a debug info free file such as libc.a:vfprintf()
might not work.
Andrew
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: RFC: Avoid calling XXX_skip_prologue for assembly code
2001-10-05 12:55 RFC: Avoid calling XXX_skip_prologue for assembly code Fred Fish
2001-10-11 13:13 ` Jim Blandy
@ 2001-10-11 13:22 ` Jim Blandy
2001-10-11 14:17 ` Jim Blandy
[not found] ` <fnf@www.ninemoons.com>
3 siblings, 0 replies; 21+ messages in thread
From: Jim Blandy @ 2001-10-11 13:22 UTC (permalink / raw)
To: fnf; +Cc: gdb-patches
[I sent that last reply sooner than I intended.]
Fred Fish <fnf@www.ninemoons.com> writes:
> There is little point in attempting to skip over prologues if we
> already know for a fact that the source language is assembly.
>
> In fact, attempting to do so may actually be incorrect if the user has
> taken the output of the compiler, used that as the basis for his code,
> and hand optimized it in some way to produce an assembly version.
> There could still be prologue code in the hand crafted version.
>
> Another way to handle this issue would be to have each of the
> "XXX_skip_prologue" functions in the various XXX-tdep.c files do their
> own checking first to see if the language is assembly, but they don't
> have easy access to that info, and each of them would have to do
> something similar to this patch anyway, so it seems more logical to
> just do the test in one place.
Andrew Cagney pointed out to me that gdb.asm/asm-source.exp actually
does try to get a backtrace from an assembly language function, and
expects to see the right function names. For that to work, we need to
skip prologues. But that test may be resting on some questionable
assumptions.
You're right, of course, that GDB really has no basis on which to make
assumptions about how an assembly language function lays out its
frame, or even that a symbol represents a function's entry point. But
given how common it is to mix C and assembly language, it's also not
entirely unreasonable to ask for a backtrace.
I tend to feel that, if someone wants to see a backtrace out of a
hand-coded assembly function, they can set their breakpoint at the
right place themselves; GDB simply hasn't enough information to do it
for them.
I'm ready to approve this patch, but I think Michael Snyder might be
able to help me think about this more clearly, so I'm waiting for a
call from him.
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: RFC: Avoid calling XXX_skip_prologue for assembly code
2001-10-05 12:55 RFC: Avoid calling XXX_skip_prologue for assembly code Fred Fish
2001-10-11 13:13 ` Jim Blandy
2001-10-11 13:22 ` Jim Blandy
@ 2001-10-11 14:17 ` Jim Blandy
2001-10-11 15:40 ` Andrew Cagney
2002-04-11 16:30 ` Fred Fish
[not found] ` <fnf@www.ninemoons.com>
3 siblings, 2 replies; 21+ messages in thread
From: Jim Blandy @ 2001-10-11 14:17 UTC (permalink / raw)
To: fnf; +Cc: gdb-patches
Fred Fish <fnf@www.ninemoons.com> writes:
> There is little point in attempting to skip over prologues if we
> already know for a fact that the source language is assembly.
>
> In fact, attempting to do so may actually be incorrect if the user has
> taken the output of the compiler, used that as the basis for his code,
> and hand optimized it in some way to produce an assembly version.
> There could still be prologue code in the hand crafted version.
Would you be willing to try gdb.asm/asm-source.exp against a D10V sim
with this change? I'm pretty sure your change is going to break that
test. If so, you could fix the failure by changing the test to set
the breakpoint after the `enter' sequences.
If you can take care of that, and add a comment indicating why
assembly language is a special case, then I approve of this change.
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: RFC: Avoid calling XXX_skip_prologue for assembly code
2001-10-11 14:17 ` Jim Blandy
@ 2001-10-11 15:40 ` Andrew Cagney
2001-10-11 19:23 ` Fred Fish
2002-04-11 16:30 ` Fred Fish
1 sibling, 1 reply; 21+ messages in thread
From: Andrew Cagney @ 2001-10-11 15:40 UTC (permalink / raw)
To: Jim Blandy; +Cc: fnf, gdb-patches
> Fred Fish <fnf@www.ninemoons.com> writes:
>
>> There is little point in attempting to skip over prologues if we
>> already know for a fact that the source language is assembly.
>>
>> In fact, attempting to do so may actually be incorrect if the user has
>> taken the output of the compiler, used that as the basis for his code,
>> and hand optimized it in some way to produce an assembly version.
>> There could still be prologue code in the hand crafted version.
>
>
> Would you be willing to try gdb.asm/asm-source.exp against a D10V sim
> with this change? I'm pretty sure your change is going to break that
> test. If so, you could fix the failure by changing the test to set
> the breakpoint after the `enter' sequences.
>
> If you can take care of that, and add a comment indicating why
> assembly language is a special case, then I approve of this change.
Can someone confirm/deny this from me:
> Anyway, I suspect (is this true?) that this patch would make ``break vfprintf'' and ``break *vfprintf'' identical. That in turn could mean that a backtrace from a debug info free file such as libc.a:vfprintf() might not work.
To put it another way, it would mean that for files with no debug info
``break *foo'' and ``break foo'' would have the same affect.
(As they say it is all comming back to me) I think this gets dragged out
and debated regularly. If the two forms are made identical the ability
to selectivly choose the breakpoint behavour is removed.
Does anyone know the motivation behind the patch?
Andrew
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: RFC: Avoid calling XXX_skip_prologue for assembly code
2001-10-11 15:40 ` Andrew Cagney
@ 2001-10-11 19:23 ` Fred Fish
0 siblings, 0 replies; 21+ messages in thread
From: Fred Fish @ 2001-10-11 19:23 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Jim Blandy, fnf, gdb-patches
> Does anyone know the motivation behind the patch?
I ran into a target for which the skip_prologue code did not behave
correctly for assembly language functions. The details are hazy now
but as I recall the skip prologue function always returned PC+2 in
such cases, instead of just returning PC. In looking at some of the
other XXX_skip_prologue functions it appeared to me that they would
have the same problems under similar conditions. Ideally we would
just fix all the skip_prologue functions to do the right thing, but then
I began to question why we were even calling skip_prologue anyway on
functions that were already known to have been written in assembly
language.
-Fred
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: RFC: Avoid calling XXX_skip_prologue for assembly code
2001-10-11 14:17 ` Jim Blandy
2001-10-11 15:40 ` Andrew Cagney
@ 2002-04-11 16:30 ` Fred Fish
2002-04-12 8:34 ` Fernando Nasser
1 sibling, 1 reply; 21+ messages in thread
From: Fred Fish @ 2002-04-11 16:30 UTC (permalink / raw)
To: jimb; +Cc: fnf, gdb-patches
(Note: I'm revisiting an old patch submitted in Oct 2001)
> Would you be willing to try gdb.asm/asm-source.exp against a D10V sim
> with this change? I'm pretty sure your change is going to break that
> test. If so, you could fix the failure by changing the test to set
> the breakpoint after the `enter' sequences.
I just built a D10V toolchain with a recent gdb, and ran the full
testsuite with and without this change. There was no difference in
the testsuite results. All of the asm-source.exp tests passed both
with and without this patch installed.
OK to check in this patch?
-Fred
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: RFC: Avoid calling XXX_skip_prologue for assembly code
2002-04-11 16:30 ` Fred Fish
@ 2002-04-12 8:34 ` Fernando Nasser
2002-04-12 9:41 ` Fred Fish
0 siblings, 1 reply; 21+ messages in thread
From: Fernando Nasser @ 2002-04-12 8:34 UTC (permalink / raw)
To: fnf; +Cc: jimb, fnf, gdb-patches, Andrew Cagney, Michael Snyder
Fred,
May I suggest the creation of a set/show command to allow this
to be deactivated?
set assembly-skip-prolog
I don't mind if the default is off, I can put it in my .gdbinit file.
But disallowing it in a hardwired way will punish anyone who followed
the linkage conventions to be able to use backtrace.
I strongly object to this patch unless accompanied by a set/show
command. (But I am not the maintainer.)
Regards,
Fernando
Fred Fish wrote:
>
> (Note: I'm revisiting an old patch submitted in Oct 2001)
>
> > Would you be willing to try gdb.asm/asm-source.exp against a D10V sim
> > with this change? I'm pretty sure your change is going to break that
> > test. If so, you could fix the failure by changing the test to set
> > the breakpoint after the `enter' sequences.
>
> I just built a D10V toolchain with a recent gdb, and ran the full
> testsuite with and without this change. There was no difference in
> the testsuite results. All of the asm-source.exp tests passed both
> with and without this patch installed.
>
> OK to check in this patch?
>
> -Fred
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: RFC: Avoid calling XXX_skip_prologue for assembly code
2002-04-12 8:34 ` Fernando Nasser
@ 2002-04-12 9:41 ` Fred Fish
2002-04-12 9:47 ` Fernando Nasser
0 siblings, 1 reply; 21+ messages in thread
From: Fred Fish @ 2002-04-12 9:41 UTC (permalink / raw)
To: Fernando Nasser
Cc: fnf, jimb, fnf, gdb-patches, Andrew Cagney, Michael Snyder
> I strongly object to this patch unless accompanied by a set/show
> command. (But I am not the maintainer.)
There seems to be enough issues with this patch that perhaps I should
just withdraw it. The alternate solution is to fix the skip_prologue
functions that don't do the right thing with assembly language
prologues that don't follow normal conventions. The original
motivation for this patch was an architecture where skip_prologue
always returned PC+2 regardless of what it found.
-Fred
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: RFC: Avoid calling XXX_skip_prologue for assembly code
2002-04-12 9:41 ` Fred Fish
@ 2002-04-12 9:47 ` Fernando Nasser
0 siblings, 0 replies; 21+ messages in thread
From: Fernando Nasser @ 2002-04-12 9:47 UTC (permalink / raw)
To: fnf; +Cc: jimb, fnf, gdb-patches, Andrew Cagney, Michael Snyder
Fred Fish wrote:
>
> > I strongly object to this patch unless accompanied by a set/show
> > command. (But I am not the maintainer.)
>
> There seems to be enough issues with this patch that perhaps I should
> just withdraw it. The alternate solution is to fix the skip_prologue
> functions that don't do the right thing with assembly language
> prologues that don't follow normal conventions. The original
> motivation for this patch was an architecture where skip_prologue
> always returned PC+2 regardless of what it found.
>
It should not be too difficult to add a set/show variable.
But if you can't spare the time, and if people agree with this
solution, you could just enter your patch in the bug database
and say it is pending the creation of the switch. Eventually
someone will get at the bug entry and do it.
Regards,
Fernando
P.S.: Note that I agree with the patch, if controlled by a behavior
variable. My objection is just against hardwiring it.
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <fnf@www.ninemoons.com>]
* Re: RFC: Avoid calling XXX_skip_prologue for assembly code
[not found] ` <fnf@www.ninemoons.com>
@ 2001-10-05 13:58 ` Kevin Buettner
2001-10-27 16:38 ` [RFA] Change auto-solib-add to boolean, add auto-solib-limit Kevin Buettner
` (2 subsequent siblings)
3 siblings, 0 replies; 21+ messages in thread
From: Kevin Buettner @ 2001-10-05 13:58 UTC (permalink / raw)
To: fnf, gdb-patches
On Oct 5, 12:54pm, Fred Fish wrote:
> Does anyone have any issues with the attached patch?
>
> There is little point in attempting to skip over prologues if we
> already know for a fact that the source language is assembly.
>
> In fact, attempting to do so may actually be incorrect if the user has
> taken the output of the compiler, used that as the basis for his code,
> and hand optimized it in some way to produce an assembly version.
> There could still be prologue code in the hand crafted version.
[...]
> * symtab.c (find_function_start_sal): Do not attempt to skip over
> prologues for assembly functions.
The patch looks good to me. (Please note that I'm not the maintainer
though.)
Kevin
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [RFA] Change auto-solib-add to boolean, add auto-solib-limit
[not found] ` <fnf@www.ninemoons.com>
2001-10-05 13:58 ` Kevin Buettner
@ 2001-10-27 16:38 ` Kevin Buettner
2001-10-29 22:14 ` [RFA] Use 1024*1024 for a megabyte, not 1000000 Kevin Buettner
2001-10-30 17:22 ` [RFA] Fix a couple of auto-solib-add problems Kevin Buettner
3 siblings, 0 replies; 21+ messages in thread
From: Kevin Buettner @ 2001-10-27 16:38 UTC (permalink / raw)
To: fnf, gdb-patches
On Oct 27, 12:48pm, Fred Fish wrote:
> In the past I've submitted several versions of a patch to fix some
> problems with auto-solib-add, but they have never quite been approved
> in full. In response to feedback, and by specific request to remove
> the overloaded meaning of the auto-solib-add variable, this patch
> changes auto-solib-add into a boolean and adds a new variable, called
> auto-solib-limit to hold the shlib symbol table size limit value for
> those systems that support this.
The solib portions of this patch are approved.
I noticed that you changed osfsolib.c. There is nothing wrong with
this except that it isn't used anymore. (The functionality in this
file has been moved to solib-osf.c and is used in conjunction with
solib.c.) After you commit this patch, I'll mark osfsolib.c as
obsolete.
Thanks,
Kevin
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [RFA] Use 1024*1024 for a megabyte, not 1000000.
[not found] ` <fnf@www.ninemoons.com>
2001-10-05 13:58 ` Kevin Buettner
2001-10-27 16:38 ` [RFA] Change auto-solib-add to boolean, add auto-solib-limit Kevin Buettner
@ 2001-10-29 22:14 ` Kevin Buettner
2001-10-30 17:22 ` [RFA] Fix a couple of auto-solib-add problems Kevin Buettner
3 siblings, 0 replies; 21+ messages in thread
From: Kevin Buettner @ 2001-10-29 22:14 UTC (permalink / raw)
To: fnf, gdb-patches
On Oct 29, 9:34pm, Fred Fish wrote:
> OK, so it's a nit...
>
> -Fred
>
> 2001-10-29 Fred Fish <fnf@redhat.com>
>
> * somsolib.c (som_solib_add): A megabyte is 1024*1024 bytes.
> * pa64solib.c (add_to_solist): Ditto.
Fine by me.
Kevin
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [RFA] Fix a couple of auto-solib-add problems
[not found] ` <fnf@www.ninemoons.com>
` (2 preceding siblings ...)
2001-10-29 22:14 ` [RFA] Use 1024*1024 for a megabyte, not 1000000 Kevin Buettner
@ 2001-10-30 17:22 ` Kevin Buettner
3 siblings, 0 replies; 21+ messages in thread
From: Kevin Buettner @ 2001-10-30 17:22 UTC (permalink / raw)
To: fnf, gdb-patches
On Oct 30, 4:32pm, Fred Fish wrote:
> gdb/ChangeLog entry:
>
> 2001-10-30 Fred Fish <fnf@redhat.com>
>
> * 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): Adjust prototype for new readsyms 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): 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.
>
> gdb/doc/ChangeLog entry:
>
> 2001-10-30 Fred Fish <fnf@redhat.com>
>
> * gdbint.texinfo (SOLIB_ADD): Document additional new
> "readsyms" arg.
Fred,
Nice work. I really appreciate the descriptive text prior to the
patch which explains both the problems that your patch is solving as
well as your implementation strategy for solving the problems.
These patches are approved to the extent that I'm able to give
approval.
I think I can approve your changes to these files outright:
solib-osf.c
solib-sunos.c
solib-svr4.c
solib.c
solib.h
config/rs6000/nm-rs6000.h
The following files have "solib" in their names, but I don't feel like
I really maintain them. (If I ever do maintenance on them, it'll be
to move their functionality over to a solib-*.c version that I will
maintain.) Nevertheless, I don't think I'm stepping on anyone's toes
by granting approval for changes to these files:
coff-solib.c
coff-solib.h
osfsolib.c (this one'll be marked obsolete soon)
pa64solib.c
pa64solib.h
somsolib.c
somsolib.h
xcoffsolib.c
The files below are someone else's responsibility. However, I think
that we can consider changes to these files to be obvious consequences
from the changes that I can give approval for. Nevertheless, I think
it'd be good to wait two or three days for folks to look these changes
over and raise an objection if they have problems with something that
you did. After that, provided there are no objections, feel free to
commit everything except for the documentation patch.
config/i386/tm-cygwin.h
corelow.c
fork-child.c
infcmd.c
infrun.c
irix5-nat.c
sol-thread.c
win32-nat.c
As for the documentation patch, i.e, the changes to
gdbint.texinfo,
Eli Zaretskii will need to approve this change.
Thanks again,
Kevin
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2002-04-12 16:47 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-30 15:35 [RFA] Fix a couple of auto-solib-add problems Fred Fish
2001-10-31 4:02 ` Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2001-10-29 20:35 [RFA] Use 1024*1024 for a megabyte, not 1000000 Fred Fish
2001-10-27 12:50 [RFA] Change auto-solib-add to boolean, add auto-solib-limit Fred Fish
2001-10-27 17:01 ` Elena Zannoni
2001-10-28 1:54 ` Eli Zaretskii
2001-10-05 12:55 RFC: Avoid calling XXX_skip_prologue for assembly code Fred Fish
2001-10-11 13:13 ` Jim Blandy
2001-10-11 13:37 ` Andrew Cagney
2001-10-11 13:22 ` Jim Blandy
2001-10-11 14:17 ` Jim Blandy
2001-10-11 15:40 ` Andrew Cagney
2001-10-11 19:23 ` Fred Fish
2002-04-11 16:30 ` Fred Fish
2002-04-12 8:34 ` Fernando Nasser
2002-04-12 9:41 ` Fred Fish
2002-04-12 9:47 ` Fernando Nasser
[not found] ` <fnf@www.ninemoons.com>
2001-10-05 13:58 ` Kevin Buettner
2001-10-27 16:38 ` [RFA] Change auto-solib-add to boolean, add auto-solib-limit Kevin Buettner
2001-10-29 22:14 ` [RFA] Use 1024*1024 for a megabyte, not 1000000 Kevin Buettner
2001-10-30 17:22 ` [RFA] Fix a couple of auto-solib-add problems Kevin Buettner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox