* [RFA] set print symbol-loading on|off
@ 2008-07-10 20:37 Doug Evans
2008-07-10 21:42 ` Stan Shebs
2008-07-19 22:38 ` Eli Zaretskii
0 siblings, 2 replies; 5+ messages in thread
From: Doug Evans @ 2008-07-10 20:37 UTC (permalink / raw)
To: gdb-patches
Along the lines of "set print thread-events on|off",
this option lets one turn off symbol loading messages.
If the app has *lots* of shared libraries, these messages
can be more noise than signal.
2008-07-10 Doug Evans <dje@google.com>
Add "set print symbol-loading on|off".
* NEWS: Document new option.
* symfile.h (print_symbol_loading): Declare.
* symfile.c (print_symbol_loading): New global.
(symbol_file_add_with_addrs_or_offsets): Only print "Reading symbols
from ..." if print_symbol_loading.
(_initialize_symfile): Add set/show print symbol-loading.
* solib.c (solib_read_symbols): Only print "Loaded symbols for ..."
if print_symbol_loading.
* doc/gdb.texinfo: Document "set print symbol-loading on|off".
Index: NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.280
diff -u -p -u -p -r1.280 NEWS
--- NEWS 10 Jul 2008 16:44:47 -0000 1.280
+++ NEWS 10 Jul 2008 20:16:31 -0000
@@ -68,6 +68,10 @@ find [/size-char] [/max-count] start-add
val1 [, val2, ...]
Search memory for a sequence of bytes.
+set print symbol-loading
+show print symbol-loading
+ Control printing of symbol loading messages.
+
set debug timestamp
show debug timestamp
Display timestamps with GDB debugging output.
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.102
diff -u -p -u -p -r1.102 solib.c
--- solib.c 19 May 2008 15:49:14 -0000 1.102
+++ solib.c 10 Jul 2008 20:16:31 -0000
@@ -448,7 +448,7 @@ solib_read_symbols (struct so_list *so,
"Error while reading shared library symbols:\n",
RETURN_MASK_ALL))
{
- if (from_tty)
+ if (from_tty && print_symbol_loading)
printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name);
so->symbols_loaded = 1;
return 1;
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.206
diff -u -p -u -p -r1.206 symfile.c
--- symfile.c 9 Jul 2008 11:16:49 -0000 1.206
+++ symfile.c 10 Jul 2008 20:16:31 -0000
@@ -171,6 +171,12 @@ Dynamic symbol table reloading multiple
value);
}
+/* If non-zero, gdb will notify the user when it is loading symbols
+ from a file. This is almost always what users will want to have happen;
+ but for programs with lots of dynamically linked libraries, the output
+ can be more noise than signal. */
+
+int print_symbol_loading = 1;
/* If non-zero, shared library symbols will be added automatically
when the inferior is created, new libraries are loaded, or when
@@ -1046,9 +1052,12 @@ symbol_file_add_with_addrs_or_offsets (b
deprecated_pre_add_symbol_hook (name);
else
{
- printf_unfiltered (_("Reading symbols from %s..."), name);
- wrap_here ("");
- gdb_flush (gdb_stdout);
+ if (print_symbol_loading)
+ {
+ printf_unfiltered (_("Reading symbols from %s..."), name);
+ wrap_here ("");
+ gdb_flush (gdb_stdout);
+ }
}
}
syms_from_objfile (objfile, addrs, offsets, num_offsets,
@@ -1061,7 +1070,7 @@ symbol_file_add_with_addrs_or_offsets (b
if ((flags & OBJF_READNOW) || readnow_symbol_files)
{
- if (from_tty || info_verbose)
+ if ((from_tty || info_verbose) && print_symbol_loading)
{
printf_unfiltered (_("expanding to full symbols..."));
wrap_here ("");
@@ -1103,7 +1112,8 @@ symbol_file_add_with_addrs_or_offsets (b
xfree (debugfile);
}
- if (!have_partial_symbols () && !have_full_symbols ())
+ if (!have_partial_symbols () && !have_full_symbols ()
+ && print_symbol_loading)
{
wrap_here ("");
printf_filtered (_("(no debugging symbols found)"));
@@ -1120,7 +1130,8 @@ symbol_file_add_with_addrs_or_offsets (b
deprecated_post_add_symbol_hook ();
else
{
- printf_unfiltered (_("done.\n"));
+ if (print_symbol_loading)
+ printf_unfiltered (_("done.\n"));
}
}
@@ -4219,4 +4230,12 @@ the global debug-file directory prepende
NULL,
show_debug_file_directory,
&setlist, &showlist);
+
+ add_setshow_boolean_cmd ("symbol-loading", no_class,
+ &print_symbol_loading, _("\
+Set printing of symbol loading messages."), _("\
+Show printing of symbol loading messages."), NULL,
+ NULL,
+ NULL,
+ &setprintlist, &showprintlist);
}
Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.46
diff -u -p -u -p -r1.46 symfile.h
--- symfile.h 3 Feb 2008 22:13:29 -0000 1.46
+++ symfile.h 10 Jul 2008 20:16:31 -0000
@@ -267,6 +267,13 @@ extern char *obconcat (struct obstack *o
/* Variables */
+/* If non-zero, gdb will notify the user when it is loading symbols
+ from a file. This is almost always what users will want to have happen;
+ but for programs with lots of dynamically linked libraries, the output
+ can be more noise than signal. */
+
+extern int print_symbol_loading;
+
/* 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
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.507
diff -u -p -u -p -r1.507 gdb.texinfo
--- doc/gdb.texinfo 10 Jul 2008 09:30:59 -0000 1.507
+++ doc/gdb.texinfo 10 Jul 2008 20:16:34 -0000
@@ -11533,6 +11533,22 @@ is printed as follows:
@item show opaque-type-resolution
Show whether opaque types are resolved or not.
+@kindex set print symbol-loading
+@cindex print messages when symbols are loaded
+@item set print symbol-loading
+@itemx set print symbol-loading on
+@itemx set print symbol-loading off
+The @code{set print symbol-loading} command allows you to enable or
+disable printing of messages when @value{GDBN} loads symbols.
+By default, these messages will be printed, and normally this is what
+you want. Disabling these messages is useful when debugging applications
+with lots of shared libraries where the quantity of output can be more
+annoying than useful.
+
+@kindex show print symbol-loading
+@item show print symbol-loading
+Show whether messages will be printed when @value{GDBN} loads symbols.
+
@kindex maint print symbols
@cindex symbol dump
@kindex maint print psymbols
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] set print symbol-loading on|off
2008-07-10 20:37 [RFA] set print symbol-loading on|off Doug Evans
@ 2008-07-10 21:42 ` Stan Shebs
2008-07-19 22:38 ` Eli Zaretskii
1 sibling, 0 replies; 5+ messages in thread
From: Stan Shebs @ 2008-07-10 21:42 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
Doug Evans wrote:
> Along the lines of "set print thread-events on|off",
> this option lets one turn off symbol loading messages.
> If the app has *lots* of shared libraries, these messages
> can be more noise than signal.
>
Excellent idea! Please commit.
Stan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] set print symbol-loading on|off
2008-07-10 20:37 [RFA] set print symbol-loading on|off Doug Evans
2008-07-10 21:42 ` Stan Shebs
@ 2008-07-19 22:38 ` Eli Zaretskii
2008-07-23 22:47 ` Doug Evans
[not found] ` <e394668d0807231541lf56cd50pdffbef18d0896735@mail.gmail.com>
1 sibling, 2 replies; 5+ messages in thread
From: Eli Zaretskii @ 2008-07-19 22:38 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
> Date: Thu, 10 Jul 2008 13:37:01 -0700 (PDT)
> From: dje@google.com (Doug Evans)
>
> Along the lines of "set print thread-events on|off",
> this option lets one turn off symbol loading messages.
> If the app has *lots* of shared libraries, these messages
> can be more noise than signal.
Thanks.
> --- NEWS 10 Jul 2008 16:44:47 -0000 1.280
> +++ NEWS 10 Jul 2008 20:16:31 -0000
> @@ -68,6 +68,10 @@ find [/size-char] [/max-count] start-add
> val1 [, val2, ...]
> Search memory for a sequence of bytes.
>
> +set print symbol-loading
> +show print symbol-loading
> + Control printing of symbol loading messages.
This is okay.
> - printf_unfiltered (_("Reading symbols from %s..."), name);
> - wrap_here ("");
> - gdb_flush (gdb_stdout);
> + if (print_symbol_loading)
> + {
> + printf_unfiltered (_("Reading symbols from %s..."), name);
> + wrap_here ("");
> + gdb_flush (gdb_stdout);
> + }
I'm not sure doing this in complete silence is a good idea. You've
shut up GDB, but this phase could take a long time, during which GDB
will appear to be hung. How about printing a single message, like
"Reading symbols ..."?
> + add_setshow_boolean_cmd ("symbol-loading", no_class,
> + &print_symbol_loading, _("\
> +Set printing of symbol loading messages."), _("\
> +Show printing of symbol loading messages."), NULL,
This is not enough detail. As written, this doc string doesn't really
document anything in a useful manner. Please add an explanation of
what this does, e.g. "When ON (the default), GDB will print messages
about loading symbols from shared libraries and debug info files."
> Index: doc/gdb.texinfo
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
This part is okay. Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] set print symbol-loading on|off
2008-07-19 22:38 ` Eli Zaretskii
@ 2008-07-23 22:47 ` Doug Evans
[not found] ` <e394668d0807231541lf56cd50pdffbef18d0896735@mail.gmail.com>
1 sibling, 0 replies; 5+ messages in thread
From: Doug Evans @ 2008-07-23 22:47 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
[apologies, resending 'cus gmail sent mime and the ml doesn't like mime]
On Sat, Jul 19, 2008 at 3:37 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
> > Date: Thu, 10 Jul 2008 13:37:01 -0700 (PDT)
> > From: dje@google.com (Doug Evans)
> >
> > Along the lines of "set print thread-events on|off",
> > this option lets one turn off symbol loading messages.
> > If the app has *lots* of shared libraries, these messages
> > can be more noise than signal.
>
> Thanks.
>
> > --- NEWS 10 Jul 2008 16:44:47 -0000 1.280
> > +++ NEWS 10 Jul 2008 20:16:31 -0000
> > @@ -68,6 +68,10 @@ find [/size-char] [/max-count] start-add
> > val1 [, val2, ...]
> > Search memory for a sequence of bytes.
> >
> > +set print symbol-loading
> > +show print symbol-loading
> > + Control printing of symbol loading messages.
>
> This is okay.
>
> > - printf_unfiltered (_("Reading symbols from %s..."), name);
> > - wrap_here ("");
> > - gdb_flush (gdb_stdout);
> > + if (print_symbol_loading)
> > + {
> > + printf_unfiltered (_("Reading symbols from %s..."), name);
> > + wrap_here ("");
> > + gdb_flush (gdb_stdout);
> > + }
>
> I'm not sure doing this in complete silence is a good idea. You've
> shut up GDB, but this phase could take a long time, during which GDB
> will appear to be hung. How about printing a single message, like
> "Reading symbols ..."?
Any ideas where such a message should be printed? I'm guessing you'd
want it printed in all the user-commands that might call this
lowish-level routine, but that's just a guess.
>
> > + add_setshow_boolean_cmd ("symbol-loading", no_class,
> > + &print_symbol_loading, _("\
> > +Set printing of symbol loading messages."), _("\
> > +Show printing of symbol loading messages."), NULL,
>
> This is not enough detail. As written, this doc string doesn't really
> document anything in a useful manner. Please add an explanation of
> what this does, e.g. "When ON (the default), GDB will print messages
> about loading symbols from shared libraries and debug info files."
Monkey-see monkey-do hacking from the "set print thread-events" patch.
Any suggestions if/how that needs to be enhanced as well?
thread.c:
add_setshow_boolean_cmd ("thread-events", no_class,
&print_thread_events, _("\
Set printing of thread events (such as thread start and exit)."), _("\
Show printing of thread events (such as thread start and exit)."), NULL,
NULL,
show_print_thread_events,
&setprintlist, &showprintlist);
>
> > Index: doc/gdb.texinfo
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
>
> This part is okay. Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] set print symbol-loading on|off
[not found] ` <e394668d0807231541lf56cd50pdffbef18d0896735@mail.gmail.com>
@ 2008-07-24 11:21 ` Eli Zaretskii
0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2008-07-24 11:21 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
> Date: Wed, 23 Jul 2008 15:41:08 -0700
> From: "Doug Evans" <dje@google.com>
> Cc: gdb-patches@sourceware.org
>
> > > - printf_unfiltered (_("Reading symbols from %s..."), name);
> > > - wrap_here ("");
> > > - gdb_flush (gdb_stdout);
> > > + if (print_symbol_loading)
> > > + {
> > > + printf_unfiltered (_("Reading symbols from %s..."), name);
> > > + wrap_here ("");
> > > + gdb_flush (gdb_stdout);
> > > + }
> >
> > I'm not sure doing this in complete silence is a good idea. You've
> > shut up GDB, but this phase could take a long time, during which GDB
> > will appear to be hung. How about printing a single message, like
> > "Reading symbols ..."?
>
> Any ideas where such a message should be printed? I'm guessing you'd want it
> printed in all the user-commands that might call this lowish-level routine,
> but that's just a guess.
Yes, that'd be a good place. Or you could it right here, with some
variable keeping track of whether this message was already printed.
> Monkey-see monkey-do hacking from the "set print thread-events" patch. Any
> suggestions if/how that needs to be enhanced as well?
It could use a similar enhancement, yes, although it does slightly
better than your original text, since it actually gives a few examples
of the events to be announced.
As for how to enhance it, I'd move the list of events to the detailed
description, and make the list exhaustive. How does that sound?
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-07-24 11:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-10 20:37 [RFA] set print symbol-loading on|off Doug Evans
2008-07-10 21:42 ` Stan Shebs
2008-07-19 22:38 ` Eli Zaretskii
2008-07-23 22:47 ` Doug Evans
[not found] ` <e394668d0807231541lf56cd50pdffbef18d0896735@mail.gmail.com>
2008-07-24 11:21 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox