* [RFA] Fix too many "no debugging symbols found" warnings.
@ 2009-05-23 23:24 Doug Evans
2009-05-25 3:20 ` Eli Zaretskii
0 siblings, 1 reply; 32+ messages in thread
From: Doug Evans @ 2009-05-23 23:24 UTC (permalink / raw)
To: gdb-patches
Hi.
I'd like to return to this patch:
http://sourceware.org/ml/gdb-patches/2008-10/msg00097.html
It's a long-ish thread. No need to reread it all if you don't want to.
[Apologies for the long-ish email too! This issue is just full of fun.]
I started appending the important snippets to save having to go
back and reread the thread, but folks mightn't want subsets of their text
cut-n-pasted here so I scratched that.
Basically the gist is that gdb will currently print a lot of noise
on the screen when one debugs applications with dozens or hundreds
of shared libs without debug info (*if* the executable itself
doesn't have debug info).
Currently that's means getting one line of "(no debugging symbols found)"
for every such shared lib, which is really annoying.
NOTE: This is unchanged from 6.8 and earlier.
It seems useful to always print the warning for executables.
This is what 6.8 does.
I'd like to preserve this even when the warning is turned off for shared-libs.
The question is how to turn it off for shared-libs without
turning it off for executables.
Some issues:
- some want the warnings for shared-libs on by default
- some want the warnings for shared-libs off by default
- I'd like to avoid major changes in observed behaviour from 6.8:
E.g. I don't want 7.0 to start printing
"no debugging symbols found in /usr/lib/system-library.so" by default).
Note that 6.8 *will* print "(no debugging symbols found)"
messages for *system libraries* (when the main executable is stripped).
The file name is absent from this warning so the user doesn't really know
that these are for system libraries too, but they are.
Normally the main executable has debug info, and because the current source
uses have_{partial,full}_symbols instead of just checking the newly
loaded file, that is sufficient to turn off these warnings for
system libraries. Blech!
We'd like to avoid adding any new option.
And I'd like to avoid ports having to specify what system libraries are.
That may be ultimately useful, but it seems excessive for the task at hand.
OTOH, "set print symbol-loading off|on" is new for 7.0, so we could
replace it with something else if that's TRTTD.
The high-order bit of what needs to be done here is to be able
to turn off the warnings for shared-libs. And since
"set print symbol-loading off|on" is new for 7.0 ...
I propose the following:
1) rename "set print symbol-loading" to "set print solib-symbol-loading"
2) always print such messages for the main executable
This way one can turn the messages off and still get the messages
for the main executable.
So far so good, except there's one catch: While we'd like to print
warnings for user libraries if they have no debug info, we don't want
to do so for system libraries, at least to the same extent that 6.8 does.
[Remember 6.8 is broken here too, it's just that users don't see it
because their main executable generally has debug info.]
To resolve this I'm leaving the use of have_{full,partial}_symbols
alone here:
@@ -1050,15 +1051,34 @@ symbol_file_add_with_addrs_or_offsets (b
xfree (debugfile);
}
- if (!have_partial_symbols () && !have_full_symbols ()
- && print_symbol_loading)
+ if ((mainline || print_solib_symbol_loading)
+ && !have_partial_symbols ()
+ && !have_full_symbols ())
I *really* wanted to fix that, but I don't see a way that is a net win
so I'm leaving it alone.
The patch sets the default of solib-symbol-loading to "on" to avoid
changes in the output from 6.8.
This patch also adds the printing of the name of the file that's missing
debug info. Seeing:
(no debugging symbols found in libfoo.so)
(no debugging symbols found in libbar.so)
[...]
(no debugging symbols found in libbaz.so)
is more useful than seeing:
(no debugging symbols found)
(no debugging symbols found)
[...]
(no debugging symbols found)
This patch also makes the obvious (IMO) change of checking the
file being loaded rather than checking all libraries via
have_{partial,full}_symbols in function reread_symbols.
This avoids the problem where have_{partial,full}_symbols will
always return true once any objfile with debug info is loaded
(and thus, for example, whether one sees the warning depends
on the order the shared libs are loaded in!).
Alas, as I say above I haven't made this change in
symbol_file_add_with_addrs_or_offsets.
Ok to check in?
2009-05-23 Doug Evans <dje@google.com>
* objfiles.h (objfile_has_partial_symbols): Declare.
(objfile_has_full_symbols): Declare.
* objfiles.c (objfile_has_partial_symbols): New function.
(have_partial_symbols): Use it.
(objfile_has_full_symbols): New function.
(have_full_symbols): Use it.
* symfile.c (print_solib_symbol_loading): Renamed from
print_symbol_loading. All uses updated.
(symbol_file_add_with_addrs_or_offsets): Always print symbol loading
messages if mainline. Include file name in "no debugging symbols
found" message.
(reread_symbols): Test file being loaded for whether it has symbols,
not all files.
* NEWS (set print solib-symbol-loading): Update.
* doc/gdb.texinfo (print solib-symbol-loading): Renamed from
`print symbol-loading'.
Index: NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.312
diff -u -p -u -p -r1.312 NEWS
--- NEWS 18 May 2009 13:25:33 -0000 1.312
+++ NEWS 23 May 2009 22:36:12 -0000
@@ -193,9 +193,10 @@ set sh calling-convention
show sh calling-convention
Control the calling convention used when calling SH target functions.
-set print symbol-loading
-show print symbol-loading
- Control printing of symbol loading messages.
+set print solib-symbol-loading
+show print solib-symbol-loading
+ Control printing of messages when loading symbols from shared object
+ libraries.
set debug timestamp
show debug timestamp
Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.83
diff -u -p -u -p -r1.83 objfiles.c
--- objfiles.c 14 May 2009 23:33:08 -0000 1.83
+++ objfiles.c 23 May 2009 22:36:12 -0000
@@ -677,6 +677,22 @@ objfile_relocate (struct objfile *objfil
breakpoint_re_set_objfile (objfile);
}
\f
+/* Return non-zero if OBJFILE has partial symbols. */
+
+int
+objfile_has_partial_symbols (struct objfile *objfile)
+{
+ return objfile->psymtabs != NULL;
+}
+
+/* Return non-zero if OBJFILE has full symbols. */
+
+int
+objfile_has_full_symbols (struct objfile *objfile)
+{
+ return objfile->symtabs != NULL;
+}
+
/* Many places in gdb want to test just to see if we have any partial
symbols available. This function returns zero if none are currently
available, nonzero otherwise. */
@@ -688,10 +704,8 @@ have_partial_symbols (void)
ALL_OBJFILES (ofp)
{
- if (ofp->psymtabs != NULL)
- {
- return 1;
- }
+ if (objfile_has_partial_symbols (ofp))
+ return 1;
}
return 0;
}
@@ -707,10 +721,8 @@ have_full_symbols (void)
ALL_OBJFILES (ofp)
{
- if (ofp->symtabs != NULL)
- {
- return 1;
- }
+ if (objfile_has_full_symbols (ofp))
+ return 1;
}
return 0;
}
Index: objfiles.h
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.h,v
retrieving revision 1.59
diff -u -p -u -p -r1.59 objfiles.h
--- objfiles.h 15 Jan 2009 16:35:22 -0000 1.59
+++ objfiles.h 23 May 2009 22:36:12 -0000
@@ -478,6 +478,10 @@ extern void free_all_objfiles (void);
extern void objfile_relocate (struct objfile *, struct section_offsets *);
+extern int objfile_has_partial_symbols (struct objfile *objfile);
+
+extern int objfile_has_full_symbols (struct objfile *objfile);
+
extern int have_partial_symbols (void);
extern int have_full_symbols (void);
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.118
diff -u -p -u -p -r1.118 solib.c
--- solib.c 22 May 2009 23:49:13 -0000 1.118
+++ solib.c 23 May 2009 22:36:12 -0000
@@ -497,7 +497,7 @@ solib_read_symbols (struct so_list *so,
"Error while reading shared library symbols:\n",
RETURN_MASK_ALL))
{
- if (from_tty && print_symbol_loading)
+ if (from_tty && print_solib_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.228
diff -u -p -u -p -r1.228 symfile.c
--- symfile.c 22 May 2009 23:49:13 -0000 1.228
+++ symfile.c 23 May 2009 22:36:12 -0000
@@ -172,11 +172,11 @@ Dynamic symbol table reloading multiple
}
/* 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;
+ from solibs. 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;
+int print_solib_symbol_loading = 1;
/* If non-zero, shared library symbols will be added automatically
when the inferior is created, new libraries are loaded, or when
@@ -990,7 +990,7 @@ symbol_file_add_with_addrs_or_offsets (b
deprecated_pre_add_symbol_hook (name);
else
{
- if (print_symbol_loading)
+ if (mainline || print_solib_symbol_loading)
{
printf_unfiltered (_("Reading symbols from %s..."), name);
wrap_here ("");
@@ -1008,7 +1008,8 @@ symbol_file_add_with_addrs_or_offsets (b
if ((flags & OBJF_READNOW) || readnow_symbol_files)
{
- if ((from_tty || info_verbose) && print_symbol_loading)
+ if ((from_tty || info_verbose)
+ && (mainline || print_solib_symbol_loading))
{
printf_unfiltered (_("expanding to full symbols..."));
wrap_here ("");
@@ -1050,15 +1051,34 @@ symbol_file_add_with_addrs_or_offsets (b
xfree (debugfile);
}
- if (!have_partial_symbols () && !have_full_symbols ()
- && print_symbol_loading)
+ /* Warn if there are no debugging symbols in OBJFILE.
+ Always warn if this is mainline.
+ Otherwise only warn if print_solib_symbol_loading.
+
+ ??? We'd like to check just OBJFILE, but there's a catch: if it is a
+ system library it's debatable whether the user wants to be told.
+ gdb 6.8 and earlier avoided this issue for two questionable reasons:
+ 1) It uses have_partial_symbols/have_full_symbols to do the test.
+ They will return true if *any* objfile has symbols, and generally
+ the main binary has symbols.
+ 2) If the main binary doesn't have symbols, the user wouldn't really
+ know s/he is being told about system libraries because gdb would only
+ print "no debugging symbols found" *without* mentioning the file name.
+ To avoid excessive behavioural changes in this area we continue to use
+ have_partial_symbols/have_full_symbols here. Sigh. */
+
+ if ((mainline || print_solib_symbol_loading)
+ && !have_partial_symbols ()
+ && !have_full_symbols ())
{
wrap_here ("");
- printf_unfiltered (_("(no debugging symbols found)"));
+ /* There's no need to print the file name if from_tty || info_verbose,
+ it's already been printed. And similarily for \n, it will be
+ printed later. */
if (from_tty || info_verbose)
- printf_unfiltered ("...");
+ printf_unfiltered (_("(no debugging symbols found)..."));
else
- printf_unfiltered ("\n");
+ printf_unfiltered (_("(no debugging symbols found in %s)\n"), name);
wrap_here ("");
}
@@ -1068,7 +1088,7 @@ symbol_file_add_with_addrs_or_offsets (b
deprecated_post_add_symbol_hook ();
else
{
- if (print_symbol_loading)
+ if (print_solib_symbol_loading)
printf_unfiltered (_("done.\n"));
}
}
@@ -2424,7 +2444,9 @@ reread_symbols (void)
zero is OK since dbxread.c also does what it needs to do if
objfile->global_psymbols.size is 0. */
(*objfile->sf->sym_read) (objfile, 0);
- if (!have_partial_symbols () && !have_full_symbols ())
+
+ if (!objfile_has_partial_symbols (objfile)
+ && !objfile_has_full_symbols (objfile))
{
wrap_here ("");
printf_unfiltered (_("(no debugging symbols found)\n"));
@@ -4175,9 +4197,9 @@ the global debug-file directory prepende
&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,
+ &print_solib_symbol_loading, _("\
+Set printing of symbol loading messages for shared object libraries."), _("\
+Show printing of symbol loading messages for shared object libraries."), NULL,
NULL,
NULL,
&setprintlist, &showprintlist);
Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.50
diff -u -p -u -p -r1.50 symfile.h
--- symfile.h 22 May 2009 23:49:14 -0000 1.50
+++ symfile.h 23 May 2009 22:36:12 -0000
@@ -269,11 +269,11 @@ 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;
+ from solibs. 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;
+extern int print_solib_symbol_loading;
/* If non-zero, shared library symbols will be added automatically
when the inferior is created, new libraries are loaded, or when
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.593
diff -u -p -u -p -r1.593 gdb.texinfo
--- doc/gdb.texinfo 15 May 2009 16:53:45 -0000 1.593
+++ doc/gdb.texinfo 23 May 2009 22:36:13 -0000
@@ -12443,21 +12443,23 @@ 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.
+@kindex set print solib-symbol-loading
+@cindex print messages when shared object library symbols are loaded
+@item set print solib-symbol-loading
+@itemx set print solib-symbol-loading on
+@itemx set print solib-symbol-loading off
+The @code{set print solib-symbol-loading} command allows you to enable or
+disable printing of messages when @value{GDBN} loads symbols from
+shared object libraries.
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 show print solib-symbol-loading
+@item show print solib-symbol-loading
+Show whether messages will be printed when @value{GDBN} loads
+shared object library symbols.
@kindex maint print symbols
@cindex symbol dump
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-05-23 23:24 [RFA] Fix too many "no debugging symbols found" warnings Doug Evans @ 2009-05-25 3:20 ` Eli Zaretskii 2009-05-25 16:07 ` Doug Evans 0 siblings, 1 reply; 32+ messages in thread From: Eli Zaretskii @ 2009-05-25 3:20 UTC (permalink / raw) To: Doug Evans; +Cc: gdb-patches > Date: Sat, 23 May 2009 16:24:14 -0700 (PDT) > From: dje@google.com (Doug Evans) > > We'd like to avoid adding any new option. > And I'd like to avoid ports having to specify what system libraries are. > That may be ultimately useful, but it seems excessive for the task at hand. > OTOH, "set print symbol-loading off|on" is new for 7.0, so we could > replace it with something else if that's TRTTD. > > The high-order bit of what needs to be done here is to be able > to turn off the warnings for shared-libs. And since > "set print symbol-loading off|on" is new for 7.0 ... > > I propose the following: > > 1) rename "set print symbol-loading" to "set print solib-symbol-loading" > 2) always print such messages for the main executable There's also a possibility to make this a tristate option instead of a simple boolean one. After all, it's quite possible that development snapshots of GDB were available on several GNU/Linux distros for some time, and so the argument of "new in GDB 7.0" is not necessarily strong enough. > --- NEWS 18 May 2009 13:25:33 -0000 1.312 > +++ NEWS 23 May 2009 22:36:12 -0000 > @@ -193,9 +193,10 @@ set sh calling-convention > show sh calling-convention > Control the calling convention used when calling SH target functions. > > -set print symbol-loading > -show print symbol-loading > - Control printing of symbol loading messages. > +set print solib-symbol-loading > +show print solib-symbol-loading > + Control printing of messages when loading symbols from shared object > + libraries. This is okay. > @@ -4175,9 +4197,9 @@ the global debug-file directory prepende > &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, > + &print_solib_symbol_loading, _("\ > +Set printing of symbol loading messages for shared object libraries."), _("\ > +Show printing of symbol loading messages for shared object libraries."), NULL, This seem to leave the option's name unaltered, unlike your explanations and unlike the docs changes. Or am I missing something? > --- doc/gdb.texinfo 15 May 2009 16:53:45 -0000 1.593 > +++ doc/gdb.texinfo 23 May 2009 22:36:13 -0000 This part is approved, assuming we agree to the code change and the removal of the previous functionality,. and also subject to a couple of comments: > +@cindex print messages when shared object library symbols are loaded This index entry is too long. Suggest to shorten it like this: @cindex announce loading symbols from shared libraries I would also add another one: @cindex shared libraries, announce loading symbols > +The @code{set print solib-symbol-loading} command allows you to enable or "This command" is shorter and doesn't lose any information, since the name of the command is clearly visible at this spot. Thanks. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-05-25 3:20 ` Eli Zaretskii @ 2009-05-25 16:07 ` Doug Evans 2009-06-04 20:34 ` Tom Tromey 0 siblings, 1 reply; 32+ messages in thread From: Doug Evans @ 2009-05-25 16:07 UTC (permalink / raw) To: Eli Zaretskii; +Cc: gdb-patches On Sun, May 24, 2009 at 8:20 PM, Eli Zaretskii <eliz@gnu.org> wrote: >> I propose the following: >> >> 1) rename "set print symbol-loading" to "set print solib-symbol-loading" >> 2) always print such messages for the main executable > > There's also a possibility to make this a tristate option instead of a > simple boolean one. After all, it's quite possible that development > snapshots of GDB were available on several GNU/Linux distros for some > time, and so the argument of "new in GDB 7.0" is not necessarily > strong enough. One thought I had was off/executable/on, [or whatever choices one prefers] but I discounted it as not being acceptable. If that's what y'all want, I'll resubmit another patch that does it that way. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-05-25 16:07 ` Doug Evans @ 2009-06-04 20:34 ` Tom Tromey 2009-06-04 21:20 ` Pedro Alves 0 siblings, 1 reply; 32+ messages in thread From: Tom Tromey @ 2009-06-04 20:34 UTC (permalink / raw) To: Doug Evans; +Cc: Eli Zaretskii, gdb-patches >>>>> "Doug" == Doug Evans <dje@google.com> writes: Eli> There's also a possibility to make this a tristate option instead of a Eli> simple boolean one. After all, it's quite possible that development Eli> snapshots of GDB were available on several GNU/Linux distros for some Eli> time, and so the argument of "new in GDB 7.0" is not necessarily Eli> strong enough. Doug> One thought I had was off/executable/on, [or whatever choices Doug> one prefers] but I discounted it as not being acceptable. If Doug> that's what y'all want, I'll resubmit another patch that does it Doug> that way. I also prefer the shorter, more generic name. Perhaps we'll want to add more values here later. The code changes look good to me. Tom ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-06-04 20:34 ` Tom Tromey @ 2009-06-04 21:20 ` Pedro Alves 2009-06-05 18:19 ` Tom Tromey 0 siblings, 1 reply; 32+ messages in thread From: Pedro Alves @ 2009-06-04 21:20 UTC (permalink / raw) To: gdb-patches, tromey; +Cc: Doug Evans, Eli Zaretskii Sorry, I meant to reply earlier. I also think that only giving the option of quieting symbol loadi g from shared libraries libraries isn't desirable. Take the below example. In this case, I'd like to have to option of not printing the hundreds of "(no debugging symbols)" found for executables (those are system executables, and I don't have symbols for most of those). (we clearly could do better with other kinds of messages below too) >cd build/gdb >make >: >touch ../../src/gdb/infrun.c >./gdb -ex "set target-async 1" -ex "set non-stop 1" -ex "set schedule-multiple 1" -ex "set detach off" -ex "set pagination off" /usr/bin/make GNU gdb (GDB) 6.8.50.20090603-cvs : (gdb) r& Starting program: /usr/bin/make (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [Thread debugging using libthread_db enabled] [New process 15726] [Thread debugging using libthread_db enabled] process 15726 is executing new program: /bin/bash (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) Program exited normally. [New process 15727] [Thread debugging using libthread_db enabled] process 15727 is executing new program: /bin/bash (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) process 15727 is executing new program: /usr/bin/make (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [Thread debugging using libthread_db enabled] [New process 15728] [Thread debugging using libthread_db enabled] process 15728 is executing new program: /bin/bash (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [New process 15729] (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [New process 15730] (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) process 15730 is executing new program: /usr/bin/make (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [Thread debugging using libthread_db enabled] [New process 15731] [Thread debugging using libthread_db enabled] process 15731 is executing new program: /bin/bash (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) process 15731 is executing new program: /usr/bin/make (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [Thread debugging using libthread_db enabled] Program exited normally. Program exited normally. Program exited normally. Program exited normally. Program exited normally. [New process 15732] [Thread debugging using libthread_db enabled] process 15732 is executing new program: /bin/bash (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) process 15732 is executing new program: /usr/bin/gcc-4.2 (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [New process 15733] process 15733 is executing new program: /usr/lib/gcc/x86_64-linux-gnu/4.2/cc1 (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) Program exited normally. [New process 15734] process 15734 is executing new program: /usr/bin/as (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) Program exited normally. Program exited normally. [New process 15735] [Thread debugging using libthread_db enabled] process 15735 is executing new program: /bin/bash (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) process 15735 is executing new program: /bin/mv (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) : : : process 16112 is executing new program: /usr/bin/make (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [Thread debugging using libthread_db enabled] [New process 16113] [Thread debugging using libthread_db enabled] process 16113 is executing new program: /bin/true (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) Program exited normally. Program exited normally. Program exited normally. Program exited normally. Program exited normally. Program exited normally. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-06-04 21:20 ` Pedro Alves @ 2009-06-05 18:19 ` Tom Tromey 2009-06-05 18:49 ` Pedro Alves 0 siblings, 1 reply; 32+ messages in thread From: Tom Tromey @ 2009-06-05 18:19 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches, Doug Evans, Eli Zaretskii >>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes: Pedro> I also think that only giving the option of quieting symbol Pedro> loadi g from shared libraries libraries isn't desirable. Take Pedro> the below example. Awesome example. Pedro> In this case, I'd like to have to option of not printing the Pedro> hundreds of "(no debugging symbols)" found for executables Pedro> (those are system executables, and I don't have symbols for Pedro> most of those). IMO, the ideal would be to share objfiles across inferiors (perhaps a big task in itself) and then issue this warning at most once per objfile. That way the user won't see 1000 warnings for /lib/libc.so. This would be in addition to whatever settings we have for letting the user control which warnings are emitted at all. WDYT? Tom ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-06-05 18:19 ` Tom Tromey @ 2009-06-05 18:49 ` Pedro Alves 2009-06-05 22:18 ` Tom Tromey 0 siblings, 1 reply; 32+ messages in thread From: Pedro Alves @ 2009-06-05 18:49 UTC (permalink / raw) To: tromey; +Cc: gdb-patches, Doug Evans, Eli Zaretskii On Friday 05 June 2009 19:17:13, Tom Tromey wrote: > IMO, the ideal would be to share objfiles across inferiors (perhaps a > big task in itself) and then issue this warning at most once per > objfile. That way the user won't see 1000 warnings for /lib/libc.so. 100% agreed, both in the ideal bit, and on the task size bit. :-) For true/always/full sharing, I'm thinking that we'd have to rework how gdb addresses symbol values (we relocate everything early; we'd have to apply relocation offsets on demand), and, we do some sorting of symbols, since sections may end up loaded at different relative offsets within the same objfile for different inferiors, in some targets. E.g., objfiles.c:objfile_relocate: ... /* Relocating different sections by different amounts may cause the symbols to be out of order. */ msymbols_sort (objfile); -- Pedro Alves ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-06-05 18:49 ` Pedro Alves @ 2009-06-05 22:18 ` Tom Tromey 2009-06-19 0:48 ` Doug Evans 0 siblings, 1 reply; 32+ messages in thread From: Tom Tromey @ 2009-06-05 22:18 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches, Doug Evans, Eli Zaretskii >>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes: Tom> IMO, the ideal would be to share objfiles across inferiors (perhaps a Tom> big task in itself) and then issue this warning at most once per Tom> objfile. That way the user won't see 1000 warnings for /lib/libc.so. Pedro> For true/always/full sharing, I'm thinking that we'd have to Pedro> rework how gdb addresses symbol values (we relocate everything Pedro> early; we'd have to apply relocation offsets on demand), and, Pedro> we do some sorting of symbols, since sections may end up loaded Pedro> at different relative offsets within the same objfile for Pedro> different inferiors, in some targets. Yeah. I was thinking of perhaps splitting objfile in two, and moving the relocated bits into a per-inferior handle, which points to the abstract objfile. But, this is just a vague thought. And, we've been talking a bit in Archer-land about some more drastic changes to the symbol tables (e.g., getting rid of psymtabs for dwarf), and this would probably interact with that as well. Tom ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-06-05 22:18 ` Tom Tromey @ 2009-06-19 0:48 ` Doug Evans 2009-06-22 17:54 ` Tom Tromey 0 siblings, 1 reply; 32+ messages in thread From: Doug Evans @ 2009-06-19 0:48 UTC (permalink / raw) To: tromey, Pedro Alves, Eli Zaretskii; +Cc: gdb-patches [-- Attachment #1: Type: text/plain, Size: 3422 bytes --] How about this? Up front questions: What's the reason for passing from_tty=0 to symbol_file_add_main from captured_main? What do folks think about having gdb print an extra line when starting up? i.e. adding: Reading symbols from /home/dje/src/hello.x64...done. Or, when no debugging symbols are found: Reading symbols from /home/dje/src/hello.x64...(no debugging symbols found) ...done. [gdb would previously print "(not debugging symbols found)"] This patch passes !batch for from_tty to symbol_file_add_main from captured_main. This is done so that the code in symbol_file_add_with_addrs_or_offsets doesn't have to test (flags & SYMFILE_MAINLINE): this is to handle the example of running make and getting lots of "no debugging symbols found" warnings [the high order bit being: if from_tty == 0, does it matter whether or not the file is the main executable when printing "no debugging symbols found"?] This partially reverts my patch of 2008-07-10 that added the option "set print symbol-loading". In its place I changed symbol-loading to symbol-loading-warnings and made it only apply when from_tty == 0. And I set the default to "off". If from_tty == 1, the request is from the user directly (more or less), and the user more likely wants to know if no debugging symbols are found. Plus if from_tty == 1, the user is already getting the text "Reading ..." so why test the "set print ..." option? Also note that if the main executable has debug info, the user will (currently) never see "no debugging symbols found" warnings for shared libs - thus any change in gdb's behaviour due to what we choose for the default value of this option only affects the case of debugging executables without debugging info. This patch removes the bogusness of whether one sees "no debugging symbols found" for shared libs depends on whether the main executable is stripped and on the order the shared libs are loaded: the patch tests the objfile being loaded rather than calling have_partial_symbols/have_full_symbols. This patch also includes the name of the file without debugging symbols in the "no debugging symbols found" message. Thoughts (especially about my first two questions) ? 2009-06-18 Doug Evans <dje@google.com> * objfiles.h (objfile_has_partial_symbols): Declare. (objfile_has_full_symbols): Declare. * objfiles.c (objfile_has_partial_symbols): New function. (have_partial_symbols): Use it. (objfile_has_full_symbols): New function. (have_full_symbols): Use it. * main.c (captured_main): Pass !batch for from_tty when calling symbol_file_add_main. * solib.c (solib_read_symbols): Back out patch of 2008-07-10. * symfile.c (print_symbol_loading_warnings): Renamed from print_symbol_loading, initialize to 0 instead of 1. (symbol_file_add_with_addrs_or_offsets): Back out patch of 2008-07-10. Print "no debugging symbols found" only if from_tty || info_verbose || print_symbol_loading_warnings, and include the file name if not already printed. (reread_symbols): Test file being loaded for whether it has symbols, not all files. (__initialize_symfile): Update name of `set print symbol-loading-warnings'. * NEWS: Update name of `set print symbol-loading-warnings'. * doc/gdb.texinfo: Update name of `set print symbol-loading-warnings'. [-- Attachment #2: gdb-090618-symfile-6.patch.txt --] [-- Type: text/plain, Size: 11641 bytes --] 2009-06-18 Doug Evans <dje@google.com> * objfiles.h (objfile_has_partial_symbols): Declare. (objfile_has_full_symbols): Declare. * objfiles.c (objfile_has_partial_symbols): New function. (have_partial_symbols): Use it. (objfile_has_full_symbols): New function. (have_full_symbols): Use it. * main.c (captured_main): Pass !batch for from_tty when calling symbol_file_add_main. * solib.c (solib_read_symbols): Back out patch of 2008-07-10. * symfile.c (print_symbol_loading_warnings): Renamed from print_symbol_loading, initialize to 0 instead of 1. (symbol_file_add_with_addrs_or_offsets): Back out patch of 2008-07-10. Print "no debugging symbols found" only if from_tty || info_verbose || print_symbol_loading_warnings, and include the file name if not already printed. (reread_symbols): Test file being loaded for whether it has symbols, not all files. (__initialize_symfile): Update name of `set print symbol-loading-warnings'. * NEWS: `set print symbol-loading' renamed to `set print symbol-loading-warnings'. * doc/gdb.texinfo: `set print symbol-loading' renamed to `set print symbol-loading-warnings'. Index: NEWS =================================================================== RCS file: /cvs/src/src/gdb/NEWS,v retrieving revision 1.313 diff -u -p -r1.313 NEWS --- NEWS 11 Jun 2009 11:57:46 -0000 1.313 +++ NEWS 18 Jun 2009 23:59:23 -0000 @@ -193,9 +193,10 @@ set sh calling-convention show sh calling-convention Control the calling convention used when calling SH target functions. -set print symbol-loading -show print symbol-loading - Control printing of symbol loading messages. +set print symbol-loading-warnings +show print symbol-loading-warnings + Control printing of warnings when auto-loading files without + debugging symbols. set debug timestamp show debug timestamp Index: main.c =================================================================== RCS file: /cvs/src/src/gdb/main.c,v retrieving revision 1.76 diff -u -p -r1.76 main.c --- main.c 27 Apr 2009 10:24:08 -0000 1.76 +++ main.c 18 Jun 2009 23:59:23 -0000 @@ -801,14 +801,14 @@ Excess command line arguments ignored. ( open it, better only print one error message. catch_command_errors returns non-zero on success! */ if (catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL)) - catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL); + catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL); } else { if (execarg != NULL) catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL); if (symarg != NULL) - catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL); + catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL); } if (corearg && pidarg) Index: objfiles.c =================================================================== RCS file: /cvs/src/src/gdb/objfiles.c,v retrieving revision 1.83 diff -u -p -r1.83 objfiles.c --- objfiles.c 14 May 2009 23:33:08 -0000 1.83 +++ objfiles.c 18 Jun 2009 23:59:24 -0000 @@ -677,6 +677,22 @@ objfile_relocate (struct objfile *objfil breakpoint_re_set_objfile (objfile); } \f +/* Return non-zero if OBJFILE has partial symbols. */ + +int +objfile_has_partial_symbols (struct objfile *objfile) +{ + return objfile->psymtabs != NULL; +} + +/* Return non-zero if OBJFILE has full symbols. */ + +int +objfile_has_full_symbols (struct objfile *objfile) +{ + return objfile->symtabs != NULL; +} + /* Many places in gdb want to test just to see if we have any partial symbols available. This function returns zero if none are currently available, nonzero otherwise. */ @@ -688,10 +704,8 @@ have_partial_symbols (void) ALL_OBJFILES (ofp) { - if (ofp->psymtabs != NULL) - { - return 1; - } + if (objfile_has_partial_symbols (ofp)) + return 1; } return 0; } @@ -707,10 +721,8 @@ have_full_symbols (void) ALL_OBJFILES (ofp) { - if (ofp->symtabs != NULL) - { - return 1; - } + if (objfile_has_full_symbols (ofp)) + return 1; } return 0; } Index: objfiles.h =================================================================== RCS file: /cvs/src/src/gdb/objfiles.h,v retrieving revision 1.59 diff -u -p -r1.59 objfiles.h --- objfiles.h 15 Jan 2009 16:35:22 -0000 1.59 +++ objfiles.h 18 Jun 2009 23:59:24 -0000 @@ -478,6 +478,10 @@ extern void free_all_objfiles (void); extern void objfile_relocate (struct objfile *, struct section_offsets *); +extern int objfile_has_partial_symbols (struct objfile *objfile); + +extern int objfile_has_full_symbols (struct objfile *objfile); + extern int have_partial_symbols (void); extern int have_full_symbols (void); Index: solib.c =================================================================== RCS file: /cvs/src/src/gdb/solib.c,v retrieving revision 1.120 diff -u -p -r1.120 solib.c --- solib.c 16 Jun 2009 18:49:25 -0000 1.120 +++ solib.c 18 Jun 2009 23:59:24 -0000 @@ -502,7 +502,7 @@ solib_read_symbols (struct so_list *so, "Error while reading shared library symbols:\n"); return 0; } - if (from_tty && print_symbol_loading) + if (from_tty) 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.232 diff -u -p -r1.232 symfile.c --- symfile.c 17 Jun 2009 18:34:34 -0000 1.232 +++ symfile.c 18 Jun 2009 23:59:24 -0000 @@ -169,12 +169,10 @@ 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. */ +/* If non-zero, gdb will warn the user when it is auto-loading symbols + from files that don't have symbols. */ -int print_symbol_loading = 1; +static int print_symbol_loading_warnings = 0; /* If non-zero, shared library symbols will be added automatically when the inferior is created, new libraries are loaded, or when @@ -987,12 +986,9 @@ symbol_file_add_with_addrs_or_offsets (b deprecated_pre_add_symbol_hook (name); else { - if (print_symbol_loading) - { - printf_unfiltered (_("Reading symbols from %s..."), name); - wrap_here (""); - gdb_flush (gdb_stdout); - } + printf_unfiltered (_("Reading symbols from %s..."), name); + wrap_here (""); + gdb_flush (gdb_stdout); } } syms_from_objfile (objfile, addrs, offsets, num_offsets, @@ -1005,7 +1001,7 @@ symbol_file_add_with_addrs_or_offsets (b if ((flags & OBJF_READNOW) || readnow_symbol_files) { - if ((from_tty || info_verbose) && print_symbol_loading) + if (from_tty || info_verbose) { printf_unfiltered (_("expanding to full symbols...")); wrap_here (""); @@ -1047,15 +1043,21 @@ symbol_file_add_with_addrs_or_offsets (b xfree (debugfile); } - if (!have_partial_symbols () && !have_full_symbols () - && print_symbol_loading) + /* Warn if there are no debugging symbols in OBJFILE. + Always warn if the request is from the command line, or verbose is on. + Otherwise, only warn if the user explicitly requests it: when + debugging applications that used many shared libraries (e.g. 100s), + this is more noise than signal. */ + + if ((from_tty || info_verbose || print_symbol_loading_warnings) + && !objfile_has_partial_symbols (objfile) + && !objfile_has_full_symbols (objfile)) { wrap_here (""); - printf_unfiltered (_("(no debugging symbols found)")); if (from_tty || info_verbose) - printf_unfiltered ("..."); + printf_unfiltered ("(no debugging symbols found) ..."); else - printf_unfiltered ("\n"); + printf_unfiltered ("(no debugging symbols found in %s)\n", name); wrap_here (""); } @@ -1064,10 +1066,7 @@ symbol_file_add_with_addrs_or_offsets (b if (deprecated_post_add_symbol_hook) deprecated_post_add_symbol_hook (); else - { - if (print_symbol_loading) - printf_unfiltered (_("done.\n")); - } + printf_unfiltered (_("done.\n")); } /* We print some messages regardless of whether 'from_tty || @@ -2414,7 +2413,8 @@ reread_symbols (void) zero is OK since dbxread.c also does what it needs to do if objfile->global_psymbols.size is 0. */ (*objfile->sf->sym_read) (objfile, 0); - if (!have_partial_symbols () && !have_full_symbols ()) + if (!objfile_has_partial_symbols (objfile) + && !objfile_has_full_symbols (objfile)) { wrap_here (""); printf_unfiltered (_("(no debugging symbols found)\n")); @@ -4167,10 +4167,10 @@ the global debug-file directory prepende 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, + add_setshow_boolean_cmd ("symbol-loading-warnings", no_class, + &print_symbol_loading_warnings, _("\ +Set printing of warnings when auto-loading files without symbols."), _("\ +Show printing of warnings when auto-loading files without symbols."), NULL, NULL, NULL, &setprintlist, &showprintlist); Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.600 diff -u -p -r1.600 gdb.texinfo --- doc/gdb.texinfo 15 Jun 2009 12:11:36 -0000 1.600 +++ doc/gdb.texinfo 18 Jun 2009 23:59:24 -0000 @@ -12480,21 +12480,21 @@ 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 set print symbol-loading-warnings +@cindex print warnings when auto-loading files without symbols +@item set print symbol-loading-warnings +@itemx set print symbol-loading-warnings on +@itemx set print symbol-loading-warnings off +The @code{set print symbol-loading-warnings} command allows you to enable or +disable printing of warning messages when @value{GDBN} implicitly loads symbols +for files. By default, these messages are disabled. +When debugging applications with lots of shared libraries the quantity +of output can be more annoying than useful. -@kindex show print symbol-loading +@kindex show print symbol-loading-warnings @item show print symbol-loading -Show whether messages will be printed when @value{GDBN} loads symbols. +Show whether warnings will be printed when @value{GDBN} implicitly loads +symbols for files. @kindex maint print symbols @cindex symbol dump ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-06-19 0:48 ` Doug Evans @ 2009-06-22 17:54 ` Tom Tromey 2009-06-22 19:35 ` Pedro Alves 0 siblings, 1 reply; 32+ messages in thread From: Tom Tromey @ 2009-06-22 17:54 UTC (permalink / raw) To: Doug Evans; +Cc: Pedro Alves, Eli Zaretskii, gdb-patches >>>>> "Doug" == Doug Evans <dje@google.com> writes: Doug> What's the reason for passing from_tty=0 to symbol_file_add_main from Doug> captured_main? For questions like this I think the only thing to do is some archaeology. I looked, though, and this seems to have been 0 all the way back to 1.1 in the src repository. (I don't think I have ready access to the older Cygnus repository any more.) Doug> What do folks think about having gdb print an extra line when starting up? Doug> i.e. adding: Doug> Reading symbols from /home/dje/src/hello.x64...done. Doug> Or, when no debugging symbols are found: Doug> Reading symbols from /home/dje/src/hello.x64...(no debugging symbols Doug> found) ...done. Doug> [gdb would previously print "(not debugging symbols found)"] I think it is a good idea. It tells the user clearly what gdb is doing, and it gets rid of the confusing output they see now. Let's do it. Doug> This partially reverts my patch of 2008-07-10 that added the option Doug> "set print symbol-loading". Doug> In its place I changed symbol-loading to symbol-loading-warnings and Doug> made it only apply when from_tty == 0. Doug> And I set the default to "off". Doug> If from_tty == 1, the request is from the user directly (more or Doug> less), and the user more likely wants to know if no debugging symbols Doug> are found. Doug> Plus if from_tty == 1, the user is already getting the text "Reading Doug> ..." so why test the "set print ..." option? Sounds reasonable. Doug> This patch also includes the name of the file without debugging Doug> symbols in the "no debugging symbols found" message. Nice. Doug> Thoughts (especially about my first two questions) ? I like this patch. I think it is ok. However, since output changes are typically contentious, please wait a while to give others a chance to respond. Tom ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-06-22 17:54 ` Tom Tromey @ 2009-06-22 19:35 ` Pedro Alves 2009-06-30 21:49 ` Doug Evans 0 siblings, 1 reply; 32+ messages in thread From: Pedro Alves @ 2009-06-22 19:35 UTC (permalink / raw) To: Tom Tromey; +Cc: Doug Evans, Eli Zaretskii, gdb-patches On Monday 22 June 2009 18:52:40, Tom Tromey wrote: > >>>>> "Doug" == Doug Evans <dje@google.com> writes: > > Doug> What's the reason for passing from_tty=0 to symbol_file_add_main from > Doug> captured_main? > > For questions like this I think the only thing to do is some > archaeology. I looked, though, and this seems to have been 0 all the > way back to 1.1 in the src repository. (I don't think I have ready > access to the older Cygnus repository any more.) You can go further back by looking at the old-releases, found through: http://sourceware.org/gdb/download/ On gdb-2.51, I see this: if (!strcmp (arg, "-se")) { exec_file_command (argv[i], !batch); symbol_file_command (argv[i], !batch); } At revision 1.1 in CVS we have: exec_file_command (execarg, !batch); symbol_file_command (symarg, 0); So at some point in time, the from_tty argument was changed to a hardcoded 0. Why that was so, I don't know. I like gdb's output with Doug's suggestion. (BTW, looking through such old gdb's sources can be quite informative sometimes, it's like looking at a smaller prototype sketch of current gdb. I keep copies of those sources around myself, and sometimes peek them.) -- Pedro Alves ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-06-22 19:35 ` Pedro Alves @ 2009-06-30 21:49 ` Doug Evans 2009-06-30 21:55 ` Pedro Alves 2009-07-01 3:13 ` Eli Zaretskii 0 siblings, 2 replies; 32+ messages in thread From: Doug Evans @ 2009-06-30 21:49 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Tom Tromey, gdb-patches, Pedro Alves On Mon, Jun 22, 2009 at 12:35 PM, Pedro Alves<pedro@codesourcery.com> wrote: > On Monday 22 June 2009 18:52:40, Tom Tromey wrote: > I like gdb's output with > Doug's suggestion. So we have two yeas and zero nays. Eli, are the docs ok? Copied below. Here's the original email: http://sourceware.org/ml/gdb-patches/2009-06/msg00495.html Index: NEWS =================================================================== RCS file: /cvs/src/src/gdb/NEWS,v retrieving revision 1.313 diff -u -p -r1.313 NEWS --- NEWS 11 Jun 2009 11:57:46 -0000 1.313 +++ NEWS 18 Jun 2009 23:59:23 -0000 @@ -193,9 +193,10 @@ set sh calling-convention show sh calling-convention Control the calling convention used when calling SH target functions. -set print symbol-loading -show print symbol-loading - Control printing of symbol loading messages. +set print symbol-loading-warnings +show print symbol-loading-warnings + Control printing of warnings when auto-loading files without + debugging symbols. set debug timestamp show debug timestamp Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.600 diff -u -p -r1.600 gdb.texinfo --- doc/gdb.texinfo 15 Jun 2009 12:11:36 -0000 1.600 +++ doc/gdb.texinfo 18 Jun 2009 23:59:24 -0000 @@ -12480,21 +12480,21 @@ 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 set print symbol-loading-warnings +@cindex print warnings when auto-loading files without symbols +@item set print symbol-loading-warnings +@itemx set print symbol-loading-warnings on +@itemx set print symbol-loading-warnings off +The @code{set print symbol-loading-warnings} command allows you to enable or +disable printing of warning messages when @value{GDBN} implicitly loads symbols +for files. By default, these messages are disabled. +When debugging applications with lots of shared libraries the quantity +of output can be more annoying than useful. -@kindex show print symbol-loading +@kindex show print symbol-loading-warnings @item show print symbol-loading -Show whether messages will be printed when @value{GDBN} loads symbols. +Show whether warnings will be printed when @value{GDBN} implicitly loads +symbols for files. @kindex maint print symbols @cindex symbol dump ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-06-30 21:49 ` Doug Evans @ 2009-06-30 21:55 ` Pedro Alves 2009-06-30 22:20 ` Doug Evans 2009-07-01 3:13 ` Eli Zaretskii 1 sibling, 1 reply; 32+ messages in thread From: Pedro Alves @ 2009-06-30 21:55 UTC (permalink / raw) To: Doug Evans; +Cc: Eli Zaretskii, Tom Tromey, gdb-patches On Tuesday 30 June 2009 22:49:25, Doug Evans wrote: > On Mon, Jun 22, 2009 at 12:35 PM, Pedro Alves<pedro@codesourcery.com> wrote: > > On Monday 22 June 2009 18:52:40, Tom Tromey wrote: > > I like gdb's output with > > Doug's suggestion. > > So we have two yeas and zero nays. To be clear, that referred to the making "gdb program" print something (passing !batch as is_atty flag in main.c). I haven't really looked at the patch or the rest of the suggestion carefully. :-) -- Pedro Alves ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-06-30 21:55 ` Pedro Alves @ 2009-06-30 22:20 ` Doug Evans 2009-07-01 2:29 ` Tom Tromey 0 siblings, 1 reply; 32+ messages in thread From: Doug Evans @ 2009-06-30 22:20 UTC (permalink / raw) To: Pedro Alves; +Cc: Eli Zaretskii, Tom Tromey, gdb-patches On Tue, Jun 30, 2009 at 2:56 PM, Pedro Alves<pedro@codesourcery.com> wrote: > On Tuesday 30 June 2009 22:49:25, Doug Evans wrote: >> On Mon, Jun 22, 2009 at 12:35 PM, Pedro Alves<pedro@codesourcery.com> wrote: >> > On Monday 22 June 2009 18:52:40, Tom Tromey wrote: >> > I like gdb's output with >> > Doug's suggestion. >> >> So we have two yeas and zero nays. > > To be clear, that referred to the making "gdb program" print > something (passing !batch as is_atty flag in main.c). I haven't > really looked at the patch or the rest of the suggestion > carefully. :-) Righto. I took Tom's email as approval of the patch, his only concern was to wait to let people comment on the output. But if you want the patch to wait for more review, ok. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-06-30 22:20 ` Doug Evans @ 2009-07-01 2:29 ` Tom Tromey 0 siblings, 0 replies; 32+ messages in thread From: Tom Tromey @ 2009-07-01 2:29 UTC (permalink / raw) To: Doug Evans; +Cc: Pedro Alves, Eli Zaretskii, gdb-patches >>>>> "Doug" == Doug Evans <dje@google.com> writes: Doug> Righto. I took Tom's email as approval of the patch, his only concern Doug> was to wait to let people comment on the output. Yes, that was my intent. Tom ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-06-30 21:49 ` Doug Evans 2009-06-30 21:55 ` Pedro Alves @ 2009-07-01 3:13 ` Eli Zaretskii 2009-07-01 3:47 ` Doug Evans 1 sibling, 1 reply; 32+ messages in thread From: Eli Zaretskii @ 2009-07-01 3:13 UTC (permalink / raw) To: Doug Evans; +Cc: tromey, gdb-patches, pedro > Date: Tue, 30 Jun 2009 14:49:25 -0700 > From: Doug Evans <dje@google.com> > Cc: Tom Tromey <tromey@redhat.com>, gdb-patches <gdb-patches@sourceware.org>, > Pedro Alves <pedro@codesourcery.com> > > Eli, are the docs ok? The text is okay, but I'm not sure it is accurate wrt the implementation. > +The @code{set print symbol-loading-warnings} command allows you to enable or > +disable printing of warning messages when @value{GDBN} implicitly loads symbols > +for files. This text seems to say that we will print a warning when symbols are loaded ``implicitly'', whatever that means. But in fact, aren't the warnings issued for files that have _no_ debugging symbols at all? ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-07-01 3:13 ` Eli Zaretskii @ 2009-07-01 3:47 ` Doug Evans 2009-07-01 17:48 ` Eli Zaretskii 0 siblings, 1 reply; 32+ messages in thread From: Doug Evans @ 2009-07-01 3:47 UTC (permalink / raw) To: Eli Zaretskii; +Cc: tromey, gdb-patches, pedro On Tue, Jun 30, 2009 at 8:13 PM, Eli Zaretskii<eliz@gnu.org> wrote: >> Date: Tue, 30 Jun 2009 14:49:25 -0700 >> From: Doug Evans <dje@google.com> >> Cc: Tom Tromey <tromey@redhat.com>, gdb-patches <gdb-patches@sourceware.org>, >> Pedro Alves <pedro@codesourcery.com> >> >> Eli, are the docs ok? > > The text is okay, but I'm not sure it is accurate wrt the implementation. > >> +The @code{set print symbol-loading-warnings} command allows you to enable or >> +disable printing of warning messages when @value{GDBN} implicitly loads symbols >> +for files. > > This text seems to say that we will print a warning when symbols are > loaded ``implicitly'', whatever that means. But in fact, aren't the > warnings issued for files that have _no_ debugging symbols at all? s/implicitly loads symbols for files/tries to load symbols for a file and finds the file has no symbols/ ? ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-07-01 3:47 ` Doug Evans @ 2009-07-01 17:48 ` Eli Zaretskii 2009-07-01 17:53 ` Doug Evans 0 siblings, 1 reply; 32+ messages in thread From: Eli Zaretskii @ 2009-07-01 17:48 UTC (permalink / raw) To: Doug Evans; +Cc: tromey, gdb-patches, pedro > Date: Tue, 30 Jun 2009 20:47:05 -0700 > From: Doug Evans <dje@google.com> > Cc: tromey@redhat.com, gdb-patches@sourceware.org, pedro@codesourcery.com > > On Tue, Jun 30, 2009 at 8:13 PM, Eli Zaretskii<eliz@gnu.org> wrote: > >> Date: Tue, 30 Jun 2009 14:49:25 -0700 > >> From: Doug Evans <dje@google.com> > >> Cc: Tom Tromey <tromey@redhat.com>, gdb-patches <gdb-patches@sourceware.org>, > >> Â Â Â Â Pedro Alves <pedro@codesourcery.com> > >> > >> Eli, are the docs ok? > > > > The text is okay, but I'm not sure it is accurate wrt the implementation. > > > >> +The @code{set print symbol-loading-warnings} command allows you to enable or > >> +disable printing of warning messages when @value{GDBN} implicitly loads symbols > >> +for files. > > > > This text seems to say that we will print a warning when symbols are > > loaded ``implicitly'', whatever that means. Â But in fact, aren't the > > warnings issued for files that have _no_ debugging symbols at all? > > s/implicitly loads symbols for files/tries to load symbols for a file > and finds the file has no symbols/ > ? I suggest this variant: The @code{set print symbol-loading-warnings} command allows you to enable or disable printing of warning messages when @value{GDBN} loads an executable or a library that has no debugging symbols. WDYT? ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-07-01 17:48 ` Eli Zaretskii @ 2009-07-01 17:53 ` Doug Evans 2009-07-01 18:01 ` Pedro Alves 0 siblings, 1 reply; 32+ messages in thread From: Doug Evans @ 2009-07-01 17:53 UTC (permalink / raw) To: Eli Zaretskii; +Cc: tromey, gdb-patches, pedro On Wed, Jul 1, 2009 at 10:47 AM, Eli Zaretskii<eliz@gnu.org> wrote: >> > This text seems to say that we will print a warning when symbols are >> > loaded ``implicitly'', whatever that means. But in fact, aren't the >> > warnings issued for files that have _no_ debugging symbols at all? >> >> s/implicitly loads symbols for files/tries to load symbols for a file >> and finds the file has no symbols/ >> ? > > I suggest this variant: > > The @code{set print symbol-loading-warnings} command allows you to > enable or disable printing of warning messages when @value{GDBN} > loads an executable or a library that has no debugging symbols. > > WDYT? Sounds great. Thanks. I think we're all set then. Does anyone have any other concerns with the patch? ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-07-01 17:53 ` Doug Evans @ 2009-07-01 18:01 ` Pedro Alves 2009-07-01 19:55 ` Doug Evans 0 siblings, 1 reply; 32+ messages in thread From: Pedro Alves @ 2009-07-01 18:01 UTC (permalink / raw) To: Doug Evans; +Cc: Eli Zaretskii, tromey, gdb-patches On Wednesday 01 July 2009 18:52:50, Doug Evans wrote: > Does anyone have any other concerns with the patch? Does this mean that there will be no way anymore to say that you don't want symbol loading info? I was assuming we'd still have that option. :-/ I find "set print symbol-loading-warnings" a bit misnamed, since this isn't about *all* warnings. In fact, it's about *no* symbols. I don't really want to get bishedy, but, why was it that keeping the existing option and adding a new one wasn't good? set print symbol-loading on|off set print no-symbols-found-warnings on|off -- Pedro Alves ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-07-01 18:01 ` Pedro Alves @ 2009-07-01 19:55 ` Doug Evans 2009-07-02 13:26 ` Pedro Alves 0 siblings, 1 reply; 32+ messages in thread From: Doug Evans @ 2009-07-01 19:55 UTC (permalink / raw) To: Pedro Alves; +Cc: Eli Zaretskii, tromey, gdb-patches On Wed, Jul 1, 2009 at 11:02 AM, Pedro Alves<pedro@codesourcery.com> wrote: > On Wednesday 01 July 2009 18:52:50, Doug Evans wrote: >> Does anyone have any other concerns with the patch? > > Does this mean that there will be no way anymore to say > that you don't want symbol loading info? I was assuming > we'd still have that option. :-/ > > I find "set print symbol-loading-warnings" a bit > misnamed, since this isn't about *all* warnings. In fact, > it's about *no* symbols. I don't really want to get > bishedy, but, why was it that keeping the existing > option and adding a new one wasn't good? > > set print symbol-loading on|off > set print no-symbols-found-warnings on|off First, there's a bit of history here. I added "print symbol-loading" to be able to turn off the "no debugging symbols found" verbosity, but it wasn't working out the way I wanted - it was all or nothing when what I really wanted was a way to turn off the verbosity for automatically loaded libraries (for which there can be 100's or even >1000) and not, for example, executables, or anything manually done from the command line (one can think of executables as falling in this category). Secondly, it's not clear to me that users would ever want to turn off messages for things they do from the command line. i.e. "if (from_tty)" is a sufficient check for these particular messages and that's what 6.8 does (well, it also tests info_verbose). I realize scripts might cause an excess of verbosity from command-line related symbol loading, but I don't know of any existing examples of that, so I didn't want to keep two options if just for that. Thirdly, symbol-loading-warnings is a compatible renaming of symbol-loading - any distributions that have already shipped "print symbol-loading" will see a minor change in behavior in 7.0 but nothing will break. [I realize this isn't a strong argument to some. I don't have a strong opinion on the option name choice, I just mention it as it did factor into the choice.] Fourth, gdb doesn't print symbol loading messages if (!from_tty && !info_verbose). Except for the "no debugging symbols found" warning, "print symbol-loading" doesn't apply unless either of those flags are true (in current cvs). Fifth, in the past I've observed pushback on unnecessary options, and so here I was trying to "go with the flow". Put this all together and that's why the patch is the way it is. Ultimately, I don't have a strong opinion on having both options. I do have a strong opinion on providing an option to the user to let them turn off the "no debugging symbols found" message (and other such messages) from automatically loaded libraries. Thoughts? ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-07-01 19:55 ` Doug Evans @ 2009-07-02 13:26 ` Pedro Alves 2009-07-02 20:08 ` Doug Evans 0 siblings, 1 reply; 32+ messages in thread From: Pedro Alves @ 2009-07-02 13:26 UTC (permalink / raw) To: Doug Evans; +Cc: Eli Zaretskii, tromey, gdb-patches On Wednesday 01 July 2009 20:55:33, Doug Evans wrote: > On Wed, Jul 1, 2009 at 11:02 AM, Pedro Alves<pedro@codesourcery.com> wrote: > > On Wednesday 01 July 2009 18:52:50, Doug Evans wrote: > >> Does anyone have any other concerns with the patch? > > > > Does this mean that there will be no way anymore to say > > that you don't want symbol loading info? I was assuming > > we'd still have that option. :-/ > > > > I find "set print symbol-loading-warnings" a bit > > misnamed, since this isn't about *all* warnings. In fact, > > it's about *no* symbols. I don't really want to get > > bishedy, but, why was it that keeping the existing > > option and adding a new one wasn't good? > > > > set print symbol-loading on|off > > set print no-symbols-found-warnings on|off > > First, there's a bit of history here. > I added "print symbol-loading" to be able to turn off the "no > debugging symbols found" verbosity, but it wasn't working out the way > I wanted - it was all or nothing when what I really wanted was a way > to turn off the verbosity for automatically loaded libraries (for > which there can be 100's or even >1000) and not, for example, > executables, or anything manually done from the command line (one can > think of executables as falling in this category). Okay, I saw the original patch now. Let's focus on that first. This could be reasonable, I suppose: set print symbol-loading auto|on|off ^ ^ ^ | | | | | +- never | | | +----- always, output even when gdb auto-loads | +-------- default, output only when gdb auto-loads although IIUC, GDB never behaved like that "on" setting, so maybe we can ignore that option, and think of "auto" -> "on". OTOH, the "on" above matches what "set verbose" does. Keep reading. > Secondly, it's not clear to me that users would ever want to turn off > messages for things they do from the command line. i.e. "if > (from_tty)" is a sufficient check for these particular messages and > that's what 6.8 does (well, it also tests info_verbose). I realize > scripts might cause an excess of verbosity from command-line related > symbol loading, but I don't know of any existing examples of that, so > I didn't want to keep two options if just for that. > Thirdly, symbol-loading-warnings is a compatible renaming of > symbol-loading - any distributions that have already shipped "print > symbol-loading" will see a minor change in behavior in 7.0 but nothing > will break. [I realize this isn't a strong argument to some. I don't > have a strong opinion on the option name choice, I just mention it as > it did factor into the choice.] That's ingenious, but overboard, if you ask me. An even more compatible change would be to not change the command name at all. > > Fourth, gdb doesn't print symbol loading messages if (!from_tty && > !info_verbose). Right... > Except for the "no debugging symbols found" warning, > "print symbol-loading" doesn't apply unless either of those flags are > true (in current cvs). ... and isn't this the real problem here? If we're not printing the "Reading symbols from foo...done." part, then we should not print the "no debugging symbols found" message either, ever, should we? Can't we just decide to output that latter warning under the same predicate as for the former "Reading..." output? It seems clear to me that it's formatting intent was to be always output in between the "from foo.so..." and "...done." bits. "Reading symbols from /lib/librt.so.1...(no debugging symbols found)...done." That is, it was missing a "(from_tty || info_verbose)" check? Why do we need the new option for this specific warning at all? > Fifth, in the past I've observed pushback on unnecessary options, and > so here I was trying to "go with the flow". There's the "flow" again :-) > Put this all together and that's why the patch is the way it is. > > Ultimately, I don't have a strong opinion on having both options. I > do have a strong opinion on providing an option to the user to let > them turn off the "no debugging symbols found" message (and other such > messages) from automatically loaded libraries. I think we're complicating things. If GDB is *already printing something*, like: "Reading symbols from /lib/librt.so.1... ...done." ... then it should not be a problem for anyone to see this: "Reading symbols from /lib/librt.so.1...(no debugging symbols found)...done." OTOH, if GDB is printing nothing, then printing a sole: "(no debugging symbols found)" out of the blue, doesn't ever seem useful to me. Is that ever really useful? Wouldn't tweaking the "no debugging symbols found" predicate make everyone happy? -- Pedro Alves ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-07-02 13:26 ` Pedro Alves @ 2009-07-02 20:08 ` Doug Evans 2009-07-02 22:43 ` Pedro Alves 0 siblings, 1 reply; 32+ messages in thread From: Doug Evans @ 2009-07-02 20:08 UTC (permalink / raw) To: Pedro Alves; +Cc: Eli Zaretskii, tromey, gdb-patches On Thu, Jul 2, 2009 at 6:27 AM, Pedro Alves<pedro@codesourcery.com> wrote: >> executables, or anything manually done from the command line (one can >> think of executables as falling in this category). > > Okay, I saw the original patch now. Let's focus on that first. I'm not sure that's what I'd do first, but ok. [The problem I'm trying to solve hasn't changed, I figured we'd just focus on that.] > This could be > reasonable, I suppose: > > set print symbol-loading auto|on|off > ^ ^ ^ > | | | > | | +- never > | | > | +----- always, output even when gdb auto-loads > | > +-------- default, output only when gdb auto-loads > > although IIUC, GDB never behaved like that "on" setting, so maybe we can > ignore that option, and think of "auto" -> "on". OTOH, the "on" above > matches what "set verbose" does. Keep reading. > >[...] > > Thirdly, symbol-loading-warnings is a compatible renaming of > > symbol-loading [...] > > That's ingenious, but overboard, if you ask me. An even more compatible > change would be to not change the command name at all. I wouldn't categorize it as ingenious. Overboard, I dunno, it's just an option name. I'm not sure different levels of compatibility are at play here, really, but ok, if you strongly want one or not want the other I can go with the flow here. >> >> Fourth, gdb doesn't print symbol loading messages if (!from_tty && >> !info_verbose). > > Right... > >> Except for the "no debugging symbols found" warning, >> "print symbol-loading" doesn't apply unless either of those flags are >> true (in current cvs). > > ... and isn't this the real problem here? If we're not printing the > "Reading symbols from foo...done." part, then we should not print the > "no debugging symbols found" message either, ever, should we? Can't we > just decide to output that latter warning under the same predicate as > for the former "Reading..." output? It seems clear to me that it's > formatting intent was to be always output in between > the "from foo.so..." and "...done." bits. > > "Reading symbols from /lib/librt.so.1...(no debugging symbols found)...done." > > That is, it was missing a "(from_tty || info_verbose)" check? > > Why do we need the new option for this specific warning at all? If that's what users want, great. The question I have is: for the case of auto-loaded libraries do they want the warning and otherwise have gdb stay silent? In the case of a smallish number of libraries it sounds reasonable to me, but whatever, I can go with the flow here too. :-) >> Put this all together and that's why the patch is the way it is. >> >> Ultimately, I don't have a strong opinion on having both options. I >> do have a strong opinion on providing an option to the user to let >> them turn off the "no debugging symbols found" message (and other such >> messages) from automatically loaded libraries. > > I think we're complicating things. If GDB is *already printing something*, > like: > > "Reading symbols from /lib/librt.so.1... ...done." > > ... then it should not be a problem for anyone to see this: > > "Reading symbols from /lib/librt.so.1...(no debugging symbols found)...done." I think that's a given, and the patch has that behavior intentionally. > OTOH, if GDB is printing nothing, then printing a sole: > > "(no debugging symbols found)" > > out of the blue, doesn't ever seem useful to me. Is that ever really useful? Well, s@no debugging symbols found@no debugging symbols found in /usr/lib/libfoo.so@. Users would like to know that something isn't going to work because debug info is missing. That is useful. We could tell them differently of course. Maybe an option to "info shared" to only show the ones without debug info or some such. > Wouldn't tweaking the "no debugging symbols found" predicate make everyone happy? "Tweaking" as in only printing "no debugging symbols found [in /usr/lib/libfoo.so]" if (from_tty || info_verbose), and never printing it for auto-loaded libraries? Or something else? ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-07-02 20:08 ` Doug Evans @ 2009-07-02 22:43 ` Pedro Alves 2009-07-11 4:22 ` Doug Evans 0 siblings, 1 reply; 32+ messages in thread From: Pedro Alves @ 2009-07-02 22:43 UTC (permalink / raw) To: Doug Evans; +Cc: Eli Zaretskii, tromey, gdb-patches On Thursday 02 July 2009 21:08:22, Doug Evans wrote: > On Thu, Jul 2, 2009 at 6:27 AM, Pedro Alves<pedro@codesourcery.com> wrote: > > That's ingenious, but overboard, if you ask me. An even more compatible > > change would be to not change the command name at all. > > I wouldn't categorize it as ingenious. Overboard, I dunno, it's just > an option name. Maybe something in the middle? :-) Overboard in the sense that it's a scretch at trying to make backwards compatibility with an option that doesn't do the same thing. I'm of the opinion that if the previous option isn't useful at all, then we should just go with a new name for this one, no need for backwards compat with an option that not many people other than your google users have had much exposure (it's not an officially released option). It kind of defeats the idea of having stable releases to have to care for such backwards compatibility. issues. > I'm not sure different levels of compatibility are at play here, > really, but ok, if you strongly want one or not want the other I can > go with the flow here. I guess I'm just of the camp that considers this a different option to the current one. Okay, I'm so close to start going with the flow too. :-) > >> > >> Fourth, gdb doesn't print symbol loading messages if (!from_tty && > >> !info_verbose). > > > > Right... > > > >> Except for the "no debugging symbols found" warning, > >> "print symbol-loading" doesn't apply unless either of those flags are > >> true (in current cvs). > > > > ... and isn't this the real problem here? If we're not printing the > > "Reading symbols from foo...done." part, then we should not print the > > "no debugging symbols found" message either, ever, should we? Can't we > > just decide to output that latter warning under the same predicate as > > for the former "Reading..." output? It seems clear to me that it's > > formatting intent was to be always output in between > > the "from foo.so..." and "...done." bits. > > > If that's what users want, great. > The question I have is: for the case of auto-loaded libraries do they > want the warning and otherwise have gdb stay silent? I see what you mean. If the answer to that is true, then we do want a distinct command for this. > In the case of a smallish number of libraries it sounds reasonable to > me, but whatever, I can go with the flow here too. :-) You mean, flow away? :-) > > I think we're complicating things. If GDB is *already printing something*, > > like: > > > > "Reading symbols from /lib/librt.so.1... ...done." > > > > ... then it should not be a problem for anyone to see this: > > > > "Reading symbols from /lib/librt.so.1...(no debugging symbols found)...done." > > I think that's a given, and the patch has that behavior intentionally. Ack. > > OTOH, if GDB is printing nothing, then printing a sole: > > > > "(no debugging symbols found)" > > > > out of the blue, doesn't ever seem useful to me. Is that ever really useful? > > Well, s@no debugging symbols found@no debugging symbols found in > /usr/lib/libfoo.so@. What's the output in the non-auto-loaded case, then? "Reading symbols from /lib/librt.so.1... (no debugging symbols found in /lib/librt.so.1) ...done." ? > Users would like to know that something isn't going to work because > debug info is missing. > That is useful. It is useful to know when a module doesn't have debug info, sure, but, that transient warning has been printed like that for years, as is, without showing the shared library name. In that state, I'm not sure how useful it has been. It appears to me we have some freedom to play with it, and when it is printed. > We could tell them differently of course. Maybe an option to "info > shared" to only show the ones without debug info or some such. We do have a "Syms Read" column in info shared's output, maybe we should extend that from "Yes, No" -> "Yes, Sorry-I've-tried-but-didn't-find-any, No". Then the user could ask GDB if it has debug info any time, instead of having to look up the log. > > Wouldn't tweaking the "no debugging symbols found" predicate make everyone happy? > > "Tweaking" as in only printing "no debugging symbols found [in > /usr/lib/libfoo.so]" if (from_tty || info_verbose), and never printing > it for auto-loaded libraries? s/auto-loaded libraries/auto-loaded libraries, modules, executables, whatnot/, yes. I'll back away from arguing now, and let you decide to do what you think is best. I don't think I'll be miserable with the change. (though with a feeling of wrongly named option in my stomach.) -- Pedro Alves ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-07-02 22:43 ` Pedro Alves @ 2009-07-11 4:22 ` Doug Evans 2009-07-20 13:21 ` Pedro Alves 0 siblings, 1 reply; 32+ messages in thread From: Doug Evans @ 2009-07-11 4:22 UTC (permalink / raw) To: Pedro Alves; +Cc: Eli Zaretskii, tromey, gdb-patches [-- Attachment #1: Type: text/plain, Size: 2480 bytes --] On Thu, Jul 2, 2009 at 3:44 PM, Pedro Alves<pedro@codesourcery.com> wrote: >> > OTOH, if GDB is printing nothing, then printing a sole: >> > >> > "(no debugging symbols found)" >> > >> > out of the blue, doesn't ever seem useful to me. Is that ever really useful? >> >> Well, s@no debugging symbols found@no debugging symbols found in >> /usr/lib/libfoo.so@. > > What's the output in the non-auto-loaded case, then? > > "Reading symbols from /lib/librt.so.1... (no debugging symbols found in /lib/librt.so.1) ...done." > > ? Reading symbols from /lib/librt.so.1... (no debugging symbols found) ...done. The patch knows it has already printed the path in that case. >> Users would like to know that something isn't going to work because >> debug info is missing. >> That is useful. > > It is useful to know when a module doesn't have debug info, sure, but, > that transient warning has been printed like that for years, as is, > without showing the shared library name. In that state, I'm not sure > how useful it has been. It appears to me we have some freedom to play > with it, and when it is printed. True. >> We could tell them differently of course. Maybe an option to "info >> shared" to only show the ones without debug info or some such. > > We do have a "Syms Read" column in info shared's output, maybe we > should extend that from "Yes, No" -> "Yes, Sorry-I've-tried-but-didn't-find-any, No". > Then the user could ask GDB if it has debug info any time, instead of having > to look up the log. "works for me" >> > Wouldn't tweaking the "no debugging symbols found" predicate make everyone happy? >> >> "Tweaking" as in only printing "no debugging symbols found [in >> /usr/lib/libfoo.so]" if (from_tty || info_verbose), and never printing >> it for auto-loaded libraries? > > s/auto-loaded libraries/auto-loaded libraries, modules, executables, whatnot/, > yes. I'm not sure if I'd be happy nor not, but see attached patch. > I'll back away from arguing now, and let you decide to do what you think > is best. I don't think I'll be miserable with the change. (though with a feeling > of wrongly named option in my stomach.) The attached patch adds an optional regex argument to "info shared" and marks in the output libraries without debugging info. With this addition, I don't see a real need for a "set print symbol-loading-warning/whatever" option, thus I deleted it. Ok to check in? [-- Attachment #2: gdb-090710-symfile-7.patch.txt --] [-- Type: text/plain, Size: 14641 bytes --] 2009-07-10 Doug Evans <dje@google.com> * NEWS: Remove note on `set print symbol-loading'. Add note about new regex arg to "info sharedlibrary". * main.c (captured_main): Pass !batch for from_tty when calling symbol_file_add_main. * objfiles.h (objfile_has_partial_symbols): Declare. (objfile_has_full_symbols): Declare. * objfiles.c (objfile_has_partial_symbols): New function. (have_partial_symbols): Use it. (objfile_has_full_symbols): New function. (have_full_symbols): Use it. * solib.c (solib_read_symbols): Back out patch of 2008-07-10. Add test for info_verbose for symbol loading messages for consistency with symfile.c. (info_sharedlibrary_command): Handle optional parameter of regex of libraries to list. Inform user of libraries without debugging info. * symfile.c (print_symbol_loading): Delete. (symbol_file_add_with_addrs_or_offsets): Back out patch of 2008-07-10. Print "no debugging symbols found" only if from_tty || info_verbose; and only check file being loaded, not all files. (reread_symbols): Test file being loaded for whether it has symbols, not all files. (__initialize_symfile): Delete `set print symbol-loading'. * symfile.h (print_symbol_loading): Delete. * doc/gdb.texinfo: Delete `set print symbol-loading'. Add note on new optional regex arg to `info sharedlibrary'. Index: NEWS =================================================================== RCS file: /cvs/src/src/gdb/NEWS,v retrieving revision 1.316 diff -u -p -r1.316 NEWS --- NEWS 2 Jul 2009 21:57:27 -0000 1.316 +++ NEWS 10 Jul 2009 21:50:19 -0000 @@ -33,6 +33,9 @@ remote targets. To use this feature, sp with the `remote:' prefix, either via the `set sysroot' command or via the `--with-sysroot' configure-time option. +* "info sharedlibrary" now takes an optional regex of libraries to show, +and it now reports if a shared library has no debugging information. + * Commands `set debug-file-directory', `set solib-search-path' and `set args' now complete on file names. @@ -225,10 +228,6 @@ set sh calling-convention show sh calling-convention Control the calling convention used when calling SH target functions. -set print symbol-loading -show print symbol-loading - Control printing of symbol loading messages. - set debug timestamp show debug timestamp Control display of timestamps with GDB debugging output. Index: main.c =================================================================== RCS file: /cvs/src/src/gdb/main.c,v retrieving revision 1.76 diff -u -p -r1.76 main.c --- main.c 27 Apr 2009 10:24:08 -0000 1.76 +++ main.c 10 Jul 2009 21:50:19 -0000 @@ -801,14 +801,14 @@ Excess command line arguments ignored. ( open it, better only print one error message. catch_command_errors returns non-zero on success! */ if (catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL)) - catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL); + catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL); } else { if (execarg != NULL) catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL); if (symarg != NULL) - catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL); + catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL); } if (corearg && pidarg) Index: objfiles.c =================================================================== RCS file: /cvs/src/src/gdb/objfiles.c,v retrieving revision 1.84 diff -u -p -r1.84 objfiles.c --- objfiles.c 23 Jun 2009 16:28:45 -0000 1.84 +++ objfiles.c 10 Jul 2009 21:50:19 -0000 @@ -677,6 +677,22 @@ objfile_relocate (struct objfile *objfil breakpoint_re_set (); } \f +/* Return non-zero if OBJFILE has partial symbols. */ + +int +objfile_has_partial_symbols (struct objfile *objfile) +{ + return objfile->psymtabs != NULL; +} + +/* Return non-zero if OBJFILE has full symbols. */ + +int +objfile_has_full_symbols (struct objfile *objfile) +{ + return objfile->symtabs != NULL; +} + /* Many places in gdb want to test just to see if we have any partial symbols available. This function returns zero if none are currently available, nonzero otherwise. */ @@ -688,10 +704,8 @@ have_partial_symbols (void) ALL_OBJFILES (ofp) { - if (ofp->psymtabs != NULL) - { - return 1; - } + if (objfile_has_partial_symbols (ofp)) + return 1; } return 0; } @@ -707,10 +721,8 @@ have_full_symbols (void) ALL_OBJFILES (ofp) { - if (ofp->symtabs != NULL) - { - return 1; - } + if (objfile_has_full_symbols (ofp)) + return 1; } return 0; } Index: objfiles.h =================================================================== RCS file: /cvs/src/src/gdb/objfiles.h,v retrieving revision 1.59 diff -u -p -r1.59 objfiles.h --- objfiles.h 15 Jan 2009 16:35:22 -0000 1.59 +++ objfiles.h 10 Jul 2009 21:50:19 -0000 @@ -478,6 +478,10 @@ extern void free_all_objfiles (void); extern void objfile_relocate (struct objfile *, struct section_offsets *); +extern int objfile_has_partial_symbols (struct objfile *objfile); + +extern int objfile_has_full_symbols (struct objfile *objfile); + extern int have_partial_symbols (void); extern int have_full_symbols (void); Index: solib.c =================================================================== RCS file: /cvs/src/src/gdb/solib.c,v retrieving revision 1.121 diff -u -p -r1.121 solib.c --- solib.c 9 Jul 2009 13:39:17 -0000 1.121 +++ solib.c 10 Jul 2009 21:50:19 -0000 @@ -489,12 +489,12 @@ solib_read_symbols (struct so_list *so, if (so->symbols_loaded) { - if (from_tty) + if (from_tty || info_verbose) printf_unfiltered (_("Symbols already loaded for %s\n"), so->so_name); } else if (so->abfd == NULL) { - if (from_tty) + if (from_tty | info_verbose) printf_unfiltered (_("Symbol file not found for %s\n"), so->so_name); } else @@ -510,7 +510,7 @@ solib_read_symbols (struct so_list *so, "Error while reading shared library symbols:\n"); return 0; } - if (from_tty && print_symbol_loading) + if (from_tty || info_verbose) printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name); so->symbols_loaded = 1; return 1; @@ -801,16 +801,26 @@ solib_add (char *pattern, int from_tty, DESCRIPTION Walk through the shared library list and print information - about each attached library. + about each attached library matching PATTERN. If PATTERN is elided, + print them all. */ static void -info_sharedlibrary_command (char *ignore, int from_tty) +info_sharedlibrary_command (char *pattern, int from_tty) { struct so_list *so = NULL; /* link map state variable */ int header_done = 0; + int so_missing_debug_info = 0; int addr_width; + if (pattern) + { + char *re_err = re_comp (pattern); + + if (re_err) + error (_("Invalid regexp: %s"), re_err); + } + /* "0x", a little whitespace, and two hex digits per byte of pointers. */ addr_width = 4 + (gdbarch_ptr_bit (target_gdbarch) / 4); @@ -820,6 +830,9 @@ info_sharedlibrary_command (char *ignore { if (so->so_name[0]) { + if (pattern && ! re_exec (so->so_name)) + continue; + if (!header_done) { printf_unfiltered ("%-*s%-*s%-12s%s\n", addr_width, "From", @@ -840,14 +853,26 @@ info_sharedlibrary_command (char *ignore (LONGEST) so->addr_high, addr_width - 4) : ""); - printf_unfiltered ("%-12s", so->symbols_loaded ? "Yes" : "No"); + + if (so->symbols_loaded + && !objfile_has_partial_symbols (so->objfile) + && !objfile_has_full_symbols (so->objfile)) + { + so_missing_debug_info = 1; + printf_unfiltered ("%-12s", "Yes (*)"); + } + else + printf_unfiltered ("%-12s", !so->symbols_loaded ? "No" : "Yes"); + printf_unfiltered ("%s\n", so->so_name); } } if (so_list_head == NULL) - { - printf_unfiltered (_("No shared libraries loaded at this time.\n")); - } + printf_unfiltered (_("No shared libraries loaded at this time.\n")); + else if (! header_done && pattern) + printf_unfiltered (_("No shared libraries matched.\n")); + else if (header_done && so_missing_debug_info) + printf_unfiltered (_("(*): Shared library is missing debugging information.\n")); } /* Return 1 if ADDRESS lies within SOLIB. */ Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.237 diff -u -p -r1.237 symfile.c --- symfile.c 2 Jul 2009 17:25:58 -0000 1.237 +++ symfile.c 10 Jul 2009 21:50:19 -0000 @@ -171,13 +171,6 @@ 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 attaching to the inferior. This is almost always what users will @@ -989,12 +982,9 @@ symbol_file_add_with_addrs_or_offsets (b deprecated_pre_add_symbol_hook (name); else { - if (print_symbol_loading) - { - printf_unfiltered (_("Reading symbols from %s..."), name); - wrap_here (""); - gdb_flush (gdb_stdout); - } + printf_unfiltered (_("Reading symbols from %s..."), name); + wrap_here (""); + gdb_flush (gdb_stdout); } } syms_from_objfile (objfile, addrs, offsets, num_offsets, @@ -1007,7 +997,7 @@ symbol_file_add_with_addrs_or_offsets (b if ((flags & OBJF_READNOW) || readnow_symbol_files) { - if ((from_tty || info_verbose) && print_symbol_loading) + if (from_tty || info_verbose) { printf_unfiltered (_("expanding to full symbols...")); wrap_here (""); @@ -1049,15 +1039,12 @@ symbol_file_add_with_addrs_or_offsets (b xfree (debugfile); } - if (!have_partial_symbols () && !have_full_symbols () - && print_symbol_loading) + if ((from_tty || info_verbose) + && !objfile_has_partial_symbols (objfile) + && !objfile_has_full_symbols (objfile)) { wrap_here (""); - printf_unfiltered (_("(no debugging symbols found)")); - if (from_tty || info_verbose) - printf_unfiltered ("..."); - else - printf_unfiltered ("\n"); + printf_unfiltered (_("(no debugging symbols found)...")); wrap_here (""); } @@ -1066,10 +1053,7 @@ symbol_file_add_with_addrs_or_offsets (b if (deprecated_post_add_symbol_hook) deprecated_post_add_symbol_hook (); else - { - if (print_symbol_loading) - printf_unfiltered (_("done.\n")); - } + printf_unfiltered (_("done.\n")); } /* We print some messages regardless of whether 'from_tty || @@ -2422,7 +2406,8 @@ reread_symbols (void) zero is OK since dbxread.c also does what it needs to do if objfile->global_psymbols.size is 0. */ (*objfile->sf->sym_read) (objfile, 0); - if (!have_partial_symbols () && !have_full_symbols ()) + if (!objfile_has_partial_symbols (objfile) + && !objfile_has_full_symbols (objfile)) { wrap_here (""); printf_unfiltered (_("(no debugging symbols found)\n")); @@ -4189,12 +4174,4 @@ 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.51 diff -u -p -r1.51 symfile.h --- symfile.h 16 Jun 2009 18:49:25 -0000 1.51 +++ symfile.h 10 Jul 2009 21:50:19 -0000 @@ -284,13 +284,6 @@ 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.605 diff -u -p -r1.605 gdb.texinfo --- doc/gdb.texinfo 10 Jul 2009 10:35:17 -0000 1.605 +++ doc/gdb.texinfo 10 Jul 2009 22:00:27 -0000 @@ -12565,22 +12565,6 @@ 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 @@ -13453,9 +13437,11 @@ command: @table @code @kindex info sharedlibrary @kindex info share -@item info share -@itemx info sharedlibrary -Print the names of the shared libraries which are currently loaded. +@item info share @var{regex} +@itemx info sharedlibrary @var{regex} +Print the names of the shared libraries which are currently loaded +that match @var{regex}. If @var{regex} is omitted then print +all shared libraries that are loaded. @kindex sharedlibrary @kindex share ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-07-11 4:22 ` Doug Evans @ 2009-07-20 13:21 ` Pedro Alves 2009-07-23 18:57 ` Doug Evans 0 siblings, 1 reply; 32+ messages in thread From: Pedro Alves @ 2009-07-20 13:21 UTC (permalink / raw) To: Doug Evans; +Cc: Eli Zaretskii, tromey, gdb-patches [sorry for the delay, I'd been AFK] On Friday 10 July 2009 23:12:19, Doug Evans wrote: > The attached patch adds an optional regex argument to "info shared" > and marks in the output libraries without debugging info. > With this addition, I don't see a real need for a "set print > symbol-loading-warning/whatever" option, thus I deleted it. > > Ok to check in? > I like this approach better. I like the regex consistency with "sharedlibrary". I'm not sure if a '(*)' is the best UI, compared to an explicit word, though, but I can live with it if others can too. What do others think? Also, did you have a chance to run this through your users? Did you try this with any frontend? I've now realized that MI clients are probably parsing "info sharedlibrary" output for lack for an equivalent MI command. :-/ :-( -- Pedro Alves ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-07-20 13:21 ` Pedro Alves @ 2009-07-23 18:57 ` Doug Evans 2009-07-27 17:15 ` Tom Tromey 0 siblings, 1 reply; 32+ messages in thread From: Doug Evans @ 2009-07-23 18:57 UTC (permalink / raw) To: Pedro Alves; +Cc: Eli Zaretskii, tromey, gdb-patches On Mon, Jul 20, 2009 at 6:02 AM, Pedro Alves<pedro@codesourcery.com> wrote: > [sorry for the delay, I'd been AFK] > > On Friday 10 July 2009 23:12:19, Doug Evans wrote: > >> The attached patch adds an optional regex argument to "info shared" >> and marks in the output libraries without debugging info. >> With this addition, I don't see a real need for a "set print >> symbol-loading-warning/whatever" option, thus I deleted it. >> >> Ok to check in? >> > > I like this approach better. I like the regex consistency with > "sharedlibrary". I'm not sure if a '(*)' is the best UI, compared to > an explicit word, though, but I can live with it if others can too. > What do others think? Also, did you have a chance to run this > through your users? My users won't mind. And I like the consistency better too. I tried various words and combinations of words but I couldn't find anything I was happy with that fit and I didn't want to add more space just for this. In the end I figured I was spending too much time and was about to give up, but then I came up with (*) and now I kinda like it. It's loud ("Hey, you probably want to pay attention to this"), it fits :-), and once learned it it'll be easy to remember (to me anyway). It does have the problem of not scaling though (e.g. if we need to add more). Maybe an acronym in uppercase, with a footnote at the bottom explaining it (or not), is the way to go. [I wouldn't suggest having * mean one thing, ! mean another, etc. :-)] > Did you try this with any frontend? I've now realized that MI > clients are probably parsing "info sharedlibrary" output for > lack for an equivalent MI command. :-/ :-( I figured this might be a problem, but it seems like so would anything, modulo having an option / flag to keep the old behavior. Blech. And I didn't want to spend too much time going down that road without first seeing if the basic road was an acceptable one to go down. :-) Maybe the thing to do is stick with the old format *if* using MI? If/when an MI command is added frontends can then just use that instead. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-07-23 18:57 ` Doug Evans @ 2009-07-27 17:15 ` Tom Tromey 2009-08-24 22:02 ` Doug Evans 0 siblings, 1 reply; 32+ messages in thread From: Tom Tromey @ 2009-07-27 17:15 UTC (permalink / raw) To: Doug Evans; +Cc: Pedro Alves, Eli Zaretskii, gdb-patches >>>>> "Doug" == Doug Evans <dje@google.com> writes: Doug> Maybe the thing to do is stick with the old format *if* using MI? Doug> If/when an MI command is added frontends can then just use that instead. I think that might be ok if we had a plan to remove the old code after some time. My concern is that we will otherwise end up with multiple layers of old formatting code. This particular function seems overdue for ui-out-ification. This would let us keep the old version for MI[12], and then properly evolve the output for future versions MI. Tom ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-07-27 17:15 ` Tom Tromey @ 2009-08-24 22:02 ` Doug Evans 2009-08-25 3:47 ` Eli Zaretskii 2009-08-27 19:11 ` Tom Tromey 0 siblings, 2 replies; 32+ messages in thread From: Doug Evans @ 2009-08-24 22:02 UTC (permalink / raw) To: Tom Tromey; +Cc: Pedro Alves, Eli Zaretskii, gdb-patches [-- Attachment #1: Type: text/plain, Size: 2300 bytes --] On Mon, Jul 27, 2009 at 9:48 AM, Tom Tromey<tromey@redhat.com> wrote: >>>>>> "Doug" == Doug Evans <dje@google.com> writes: > > Doug> Maybe the thing to do is stick with the old format *if* using MI? > Doug> If/when an MI command is added frontends can then just use that instead. > > I think that might be ok if we had a plan to remove the old code after > some time. My concern is that we will otherwise end up with multiple > layers of old formatting code. > > This particular function seems overdue for ui-out-ification. > This would let us keep the old version for MI[12], and then properly > evolve the output for future versions MI. > > Tom > Is this what you had in mind? 2009-08-24 Doug Evans <dje@google.com> * NEWS: Add note on "info sharedlibrary". Remove note on "set print symbol-loading". * main.c (captured_main): Pass !batch for from_tty when calling symbol_file_add_main. * objfiles.h (objfile_has_partial_symbols): Declare. (objfile_has_full_symbols): Declare. * objfiles.c (objfile_has_partial_symbols): New function. (have_partial_symbols): Use it. (objfile_has_full_symbols): New function. (have_full_symbols): Use it. * solib.c: Include interps.h. (solib_read_symbols): Back out patch of 2008-07-10. Add test for info_verbose for symbol loading messages for consistency with symfile.c. (info_sharedlibrary_command): Handle optional parameter of regex of libraries to list. Inform user of libraries without debugging info. Rewrite to use ui_out routines to format output. * symfile.c (print_symbol_loading): Delete. (symbol_file_add_with_addrs_or_offsets): Back out patch of 2008-07-10. Print "no debugging symbols found" only if from_tty || info_verbose; and only check file being loaded, not all files. (reread_symbols): Test file being loaded for whether it has symbols, not all files. (__initialize_symfile): Delete `set print symbol-loading'. * symfile.h (print_symbol_loading): Delete. * doc/gdb.texinfo: Delete `set print symbol-loading'. Add note on new optional regex arg to `info sharedlibrary'. [-- Attachment #2: gdb-090824-info-shared-1.patch.txt --] [-- Type: text/plain, Size: 16908 bytes --] 2009-08-24 Doug Evans <dje@google.com> * NEWS: Add note on "info sharedlibrary". Remove note on "set print symbol-loading". * main.c (captured_main): Pass !batch for from_tty when calling symbol_file_add_main. * objfiles.h (objfile_has_partial_symbols): Declare. (objfile_has_full_symbols): Declare. * objfiles.c (objfile_has_partial_symbols): New function. (have_partial_symbols): Use it. (objfile_has_full_symbols): New function. (have_full_symbols): Use it. * solib.c: Include interps.h. (solib_read_symbols): Back out patch of 2008-07-10. Add test for info_verbose for symbol loading messages for consistency with symfile.c. (info_sharedlibrary_command): Handle optional parameter of regex of libraries to list. Inform user of libraries without debugging info. Rewrite to use ui_out routines to format output. * symfile.c (print_symbol_loading): Delete. (symbol_file_add_with_addrs_or_offsets): Back out patch of 2008-07-10. Print "no debugging symbols found" only if from_tty || info_verbose; and only check file being loaded, not all files. (reread_symbols): Test file being loaded for whether it has symbols, not all files. (__initialize_symfile): Delete `set print symbol-loading'. * symfile.h (print_symbol_loading): Delete. * doc/gdb.texinfo: Delete `set print symbol-loading'. Add note on new optional regex arg to `info sharedlibrary'. Index: NEWS =================================================================== RCS file: /cvs/src/src/gdb/NEWS,v retrieving revision 1.326 diff -u -p -r1.326 NEWS --- NEWS 20 Aug 2009 18:02:47 -0000 1.326 +++ NEWS 24 Aug 2009 20:08:30 -0000 @@ -48,6 +48,9 @@ remote targets. To use this feature, sp with the `remote:' prefix, either via the `set sysroot' command or via the `--with-sysroot' configure-time option. +* "info sharedlibrary" now takes an optional regex of libraries to show, +and it now reports if a shared library has no debugging information. + * Commands `set debug-file-directory', `set solib-search-path' and `set args' now complete on file names. @@ -278,10 +281,6 @@ set sh calling-convention show sh calling-convention Control the calling convention used when calling SH target functions. -set print symbol-loading -show print symbol-loading - Control printing of symbol loading messages. - set debug timestamp show debug timestamp Control display of timestamps with GDB debugging output. Index: main.c =================================================================== RCS file: /cvs/src/src/gdb/main.c,v retrieving revision 1.76 diff -u -p -r1.76 main.c --- main.c 27 Apr 2009 10:24:08 -0000 1.76 +++ main.c 24 Aug 2009 20:08:30 -0000 @@ -801,14 +801,14 @@ Excess command line arguments ignored. ( open it, better only print one error message. catch_command_errors returns non-zero on success! */ if (catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL)) - catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL); + catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL); } else { if (execarg != NULL) catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL); if (symarg != NULL) - catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL); + catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL); } if (corearg && pidarg) Index: objfiles.c =================================================================== RCS file: /cvs/src/src/gdb/objfiles.c,v retrieving revision 1.93 diff -u -p -r1.93 objfiles.c --- objfiles.c 21 Aug 2009 17:57:17 -0000 1.93 +++ objfiles.c 24 Aug 2009 20:08:30 -0000 @@ -700,6 +700,22 @@ objfile_relocate (struct objfile *objfil breakpoint_re_set (); } \f +/* Return non-zero if OBJFILE has partial symbols. */ + +int +objfile_has_partial_symbols (struct objfile *objfile) +{ + return objfile->psymtabs != NULL; +} + +/* Return non-zero if OBJFILE has full symbols. */ + +int +objfile_has_full_symbols (struct objfile *objfile) +{ + return objfile->symtabs != NULL; +} + /* Many places in gdb want to test just to see if we have any partial symbols available. This function returns zero if none are currently available, nonzero otherwise. */ @@ -711,10 +727,8 @@ have_partial_symbols (void) ALL_OBJFILES (ofp) { - if (ofp->psymtabs != NULL) - { - return 1; - } + if (objfile_has_partial_symbols (ofp)) + return 1; } return 0; } @@ -730,10 +744,8 @@ have_full_symbols (void) ALL_OBJFILES (ofp) { - if (ofp->symtabs != NULL) - { - return 1; - } + if (objfile_has_full_symbols (ofp)) + return 1; } return 0; } Index: objfiles.h =================================================================== RCS file: /cvs/src/src/gdb/objfiles.h,v retrieving revision 1.62 diff -u -p -r1.62 objfiles.h --- objfiles.h 21 Aug 2009 17:57:17 -0000 1.62 +++ objfiles.h 24 Aug 2009 20:08:30 -0000 @@ -472,6 +472,10 @@ extern void free_all_objfiles (void); extern void objfile_relocate (struct objfile *, struct section_offsets *); +extern int objfile_has_partial_symbols (struct objfile *objfile); + +extern int objfile_has_full_symbols (struct objfile *objfile); + extern int have_partial_symbols (void); extern int have_full_symbols (void); Index: solib.c =================================================================== RCS file: /cvs/src/src/gdb/solib.c,v retrieving revision 1.125 diff -u -p -r1.125 solib.c --- solib.c 21 Aug 2009 17:57:17 -0000 1.125 +++ solib.c 24 Aug 2009 20:08:30 -0000 @@ -46,6 +46,7 @@ #include "readline/readline.h" #include "remote.h" #include "solib.h" +#include "interps.h" /* Architecture-specific operations. */ @@ -472,12 +473,12 @@ solib_read_symbols (struct so_list *so, if (so->symbols_loaded) { - if (from_tty) + if (from_tty || info_verbose) printf_unfiltered (_("Symbols already loaded for %s\n"), so->so_name); } else if (so->abfd == NULL) { - if (from_tty) + if (from_tty || info_verbose) printf_unfiltered (_("Symbol file not found for %s\n"), so->so_name); } else @@ -493,7 +494,7 @@ solib_read_symbols (struct so_list *so, "Error while reading shared library symbols:\n"); return 0; } - if (from_tty && print_symbol_loading) + if (from_tty || info_verbose) printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name); so->symbols_loaded = 1; return 1; @@ -784,52 +785,117 @@ solib_add (char *pattern, int from_tty, DESCRIPTION Walk through the shared library list and print information - about each attached library. + about each attached library matching PATTERN. If PATTERN is elided, + print them all. */ static void -info_sharedlibrary_command (char *ignore, int from_tty) +info_sharedlibrary_command (char *pattern, int from_tty) { struct so_list *so = NULL; /* link map state variable */ int header_done = 0; + int so_missing_debug_info = 0; int addr_width; + int nr_libs; + struct cleanup *table_cleanup; + struct gdbarch *gdbarch = target_gdbarch; + + if (pattern) + { + char *re_err = re_comp (pattern); + + if (re_err) + error (_("Invalid regexp: %s"), re_err); + } /* "0x", a little whitespace, and two hex digits per byte of pointers. */ - addr_width = 4 + (gdbarch_ptr_bit (target_gdbarch) / 4); + addr_width = 4 + (gdbarch_ptr_bit (gdbarch) / 4); update_solib_list (from_tty, 0); - for (so = so_list_head; so; so = so->next) + /* make_cleanup_ui_out_table_begin_end needs to know the number of + rows, so we need to make two passes over the libs. */ + + for (nr_libs = 0, so = so_list_head; so; so = so->next) { if (so->so_name[0]) { - if (!header_done) - { - printf_unfiltered ("%-*s%-*s%-12s%s\n", addr_width, "From", - addr_width, "To", "Syms Read", - "Shared Object Library"); - header_done++; - } + if (pattern && ! re_exec (so->so_name)) + continue; + ++nr_libs; + } + } + + table_cleanup = + make_cleanup_ui_out_table_begin_end (uiout, 4, nr_libs, + "SharedLibraryTable"); + + /* The "- 1" is because ui_out adds one space between columns. */ + ui_out_table_header (uiout, addr_width - 1, ui_left, "From", "From"); + ui_out_table_header (uiout, addr_width - 1, ui_left, "To", "To"); + ui_out_table_header (uiout, 12 - 1, ui_left, "SymsRead", "Syms Read"); + ui_out_table_header (uiout, 0, ui_noalign, + "Name", "Shared Object Library"); + + ui_out_table_body (uiout); + + for (so = so_list_head; so; so = so->next) + { + struct cleanup *lib_cleanup; - printf_unfiltered ("%-*s", addr_width, - so->addr_high != 0 - ? hex_string_custom ( - (LONGEST) so->addr_low, - addr_width - 4) - : ""); - printf_unfiltered ("%-*s", addr_width, - so->addr_high != 0 - ? hex_string_custom ( - (LONGEST) so->addr_high, - addr_width - 4) - : ""); - printf_unfiltered ("%-12s", so->symbols_loaded ? "Yes" : "No"); - printf_unfiltered ("%s\n", so->so_name); + if (! so->so_name[0]) + continue; + if (pattern && ! re_exec (so->so_name)) + continue; + + lib_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "lib"); + + if (so->addr_high != 0) + { + ui_out_field_core_addr (uiout, "From", gdbarch, so->addr_low); + ui_out_field_core_addr (uiout, "To", gdbarch, so->addr_high); + } + else + { + ui_out_field_string (uiout, "From", ""); + ui_out_field_string (uiout, "To", ""); } + + if (! ui_out_is_mi_like_p (interp_ui_out (top_level_interpreter ())) + && so->symbols_loaded + && !objfile_has_partial_symbols (so->objfile) + && !objfile_has_full_symbols (so->objfile)) + { + so_missing_debug_info = 1; + ui_out_field_string (uiout, "SymsRead", "Yes (*)"); + } + else + ui_out_field_string (uiout, "SymsRead", + so->symbols_loaded ? "Yes" : "No"); + + ui_out_field_string (uiout, "SymsRead", so->so_name); + + ui_out_text (uiout, "\n"); + + do_cleanups (lib_cleanup); } - if (so_list_head == NULL) + + do_cleanups (table_cleanup); + + if (nr_libs == 0) + { + if (pattern) + ui_out_message (uiout, 0, + _("No shared libraries matched.\n")); + else + ui_out_message (uiout, 0, + _("No shared libraries loaded at this time.\n")); + } + else { - printf_unfiltered (_("No shared libraries loaded at this time.\n")); + if (so_missing_debug_info) + ui_out_message (uiout, 0, + _("(*): Shared library is missing debugging information.\n")); } } Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.244 diff -u -p -r1.244 symfile.c --- symfile.c 21 Aug 2009 17:57:17 -0000 1.244 +++ symfile.c 24 Aug 2009 20:08:30 -0000 @@ -171,13 +171,6 @@ 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 attaching to the inferior. This is almost always what users will @@ -989,12 +982,9 @@ symbol_file_add_with_addrs_or_offsets (b deprecated_pre_add_symbol_hook (name); else { - if (print_symbol_loading) - { - printf_unfiltered (_("Reading symbols from %s..."), name); - wrap_here (""); - gdb_flush (gdb_stdout); - } + printf_unfiltered (_("Reading symbols from %s..."), name); + wrap_here (""); + gdb_flush (gdb_stdout); } } syms_from_objfile (objfile, addrs, offsets, num_offsets, @@ -1007,7 +997,7 @@ symbol_file_add_with_addrs_or_offsets (b if ((flags & OBJF_READNOW) || readnow_symbol_files) { - if ((from_tty || info_verbose) && print_symbol_loading) + if (from_tty || info_verbose) { printf_unfiltered (_("expanding to full symbols...")); wrap_here (""); @@ -1049,15 +1039,12 @@ symbol_file_add_with_addrs_or_offsets (b xfree (debugfile); } - if (!have_partial_symbols () && !have_full_symbols () - && print_symbol_loading) + if ((from_tty || info_verbose) + && !objfile_has_partial_symbols (objfile) + && !objfile_has_full_symbols (objfile)) { wrap_here (""); - printf_unfiltered (_("(no debugging symbols found)")); - if (from_tty || info_verbose) - printf_unfiltered ("..."); - else - printf_unfiltered ("\n"); + printf_unfiltered (_("(no debugging symbols found)...")); wrap_here (""); } @@ -1066,10 +1053,7 @@ symbol_file_add_with_addrs_or_offsets (b if (deprecated_post_add_symbol_hook) deprecated_post_add_symbol_hook (); else - { - if (print_symbol_loading) - printf_unfiltered (_("done.\n")); - } + printf_unfiltered (_("done.\n")); } /* We print some messages regardless of whether 'from_tty || @@ -2438,7 +2422,8 @@ reread_symbols (void) zero is OK since dbxread.c also does what it needs to do if objfile->global_psymbols.size is 0. */ (*objfile->sf->sym_read) (objfile, 0); - if (!have_partial_symbols () && !have_full_symbols ()) + if (!objfile_has_partial_symbols (objfile) + && !objfile_has_full_symbols (objfile)) { wrap_here (""); printf_unfiltered (_("(no debugging symbols found)\n")); @@ -4207,12 +4192,4 @@ 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.51 diff -u -p -r1.51 symfile.h --- symfile.h 16 Jun 2009 18:49:25 -0000 1.51 +++ symfile.h 24 Aug 2009 20:08:30 -0000 @@ -284,13 +284,6 @@ 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.616 diff -u -p -r1.616 gdb.texinfo --- doc/gdb.texinfo 20 Aug 2009 18:02:48 -0000 1.616 +++ doc/gdb.texinfo 24 Aug 2009 20:08:31 -0000 @@ -12614,22 +12614,6 @@ 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 @@ -13502,9 +13486,11 @@ command: @table @code @kindex info sharedlibrary @kindex info share -@item info share -@itemx info sharedlibrary -Print the names of the shared libraries which are currently loaded. +@item info share @var{regex} +@itemx info sharedlibrary @var{regex} +Print the names of the shared libraries which are currently loaded +that match @var{regex}. If @var{regex} is omitted then print +all shared libraries that are loaded. @kindex sharedlibrary @kindex share ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-08-24 22:02 ` Doug Evans @ 2009-08-25 3:47 ` Eli Zaretskii 2009-08-27 19:11 ` Tom Tromey 1 sibling, 0 replies; 32+ messages in thread From: Eli Zaretskii @ 2009-08-25 3:47 UTC (permalink / raw) To: Doug Evans; +Cc: tromey, pedro, gdb-patches > Date: Mon, 24 Aug 2009 14:13:49 -0700 > From: Doug Evans <dje@google.com> > Cc: Pedro Alves <pedro@codesourcery.com>, Eli Zaretskii <eliz@gnu.org>, gdb-patches@sourceware.org > > * doc/gdb.texinfo: Delete `set print symbol-loading'. > Add note on new optional regex arg to `info sharedlibrary'. This part of the patch is fine with me, but please state the name of the node in the ChangeLog entry, as if it were a function where you made the change. Also, the ChangeLog entry should be in gdb/doc/ChangeLog, not in gdb/ChangeLog, and it should not therefore include the "doc/" part before the file name. Thanks. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-08-24 22:02 ` Doug Evans 2009-08-25 3:47 ` Eli Zaretskii @ 2009-08-27 19:11 ` Tom Tromey 2009-08-27 23:39 ` Doug Evans 1 sibling, 1 reply; 32+ messages in thread From: Tom Tromey @ 2009-08-27 19:11 UTC (permalink / raw) To: Doug Evans; +Cc: Pedro Alves, Eli Zaretskii, gdb-patches >>>>> "Doug" == Doug Evans <dje@google.com> writes: Tom> This particular function seems overdue for ui-out-ification. Tom> This would let us keep the old version for MI[12], and then properly Tom> evolve the output for future versions MI. Doug> Is this what you had in mind? Yes, thanks. FWIW that was just a drive-by complaint of mine... I will try to stop doing that, I didn't intend to get you to do this. Doug> + ui_out_table_header (uiout, addr_width - 1, ui_left, "From", "From"); Doug> + ui_out_table_header (uiout, addr_width - 1, ui_left, "To", "To"); Doug> + ui_out_table_header (uiout, 12 - 1, ui_left, "SymsRead", "Syms Read"); It seems to be GDB style that column names (the first string arg) should be lowercase, not camelcase. Generally they use "-" and not "_" as well (I only saw one exception). Doug> + ui_out_field_string (uiout, "From", ""); Doug> + ui_out_field_string (uiout, "To", ""); Probably use ui_out_field_skip here. Tom ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFA] Fix too many "no debugging symbols found" warnings. 2009-08-27 19:11 ` Tom Tromey @ 2009-08-27 23:39 ` Doug Evans 0 siblings, 0 replies; 32+ messages in thread From: Doug Evans @ 2009-08-27 23:39 UTC (permalink / raw) To: Tom Tromey; +Cc: Pedro Alves, Eli Zaretskii, gdb-patches [-- Attachment #1: Type: text/plain, Size: 3218 bytes --] On Thu, Aug 27, 2009 at 11:28 AM, Tom Tromey<tromey@redhat.com> wrote: >>>>>> "Doug" == Doug Evans <dje@google.com> writes: > > Tom> This particular function seems overdue for ui-out-ification. > Tom> This would let us keep the old version for MI[12], and then properly > Tom> evolve the output for future versions MI. > > Doug> Is this what you had in mind? > > Yes, thanks. > > FWIW that was just a drive-by complaint of mine... I will try to stop > doing that, I didn't intend to get you to do this. > > Doug> + ui_out_table_header (uiout, addr_width - 1, ui_left, "From", "From"); > Doug> + ui_out_table_header (uiout, addr_width - 1, ui_left, "To", "To"); > Doug> + ui_out_table_header (uiout, 12 - 1, ui_left, "SymsRead", "Syms Read"); > > It seems to be GDB style that column names (the first string arg) should > be lowercase, not camelcase. Generally they use "-" and not "_" as well > (I only saw one exception). > > Doug> + ui_out_field_string (uiout, "From", ""); > Doug> + ui_out_field_string (uiout, "To", ""); > > Probably use ui_out_field_skip here. > > Tom > Thanks for the review. I made the suggested changes (including Eli's) and checked it in. I tested it with Eclipse, btw. It does parse the output of "info sharedlibrary" and doesn't like "Yes (*)", so I made the changed output conditional on the top level interpreter not being MI. I think we'll want to add a new MI command for this for Eclipse, etc. to use. [P.S. the "doc/" in the attached changelog entry is just my convention. It doesn't appear in doc/ChangeLog.] 2009-08-27 Doug Evans <dje@google.com> * NEWS: Add note on "info sharedlibrary". Remove note on "set print symbol-loading". * main.c (captured_main): Pass !batch for from_tty when calling symbol_file_add_main. * objfiles.h (objfile_has_partial_symbols): Declare. (objfile_has_full_symbols): Declare. * objfiles.c (objfile_has_partial_symbols): New function. (have_partial_symbols): Use it. (objfile_has_full_symbols): New function. (have_full_symbols): Use it. * solib.c: Include interps.h. (solib_read_symbols): Back out patch of 2008-07-10. Add test for info_verbose for symbol loading messages for consistency with symfile.c. (info_sharedlibrary_command): Handle optional parameter of regex of libraries to list. Inform user of libraries without debugging info. Rewrite to use ui_out routines to format output. * symfile.c (print_symbol_loading): Delete. (symbol_file_add_with_addrs_or_offsets): Back out patch of 2008-07-10. Print "no debugging symbols found" only if from_tty || info_verbose; and only check file being loaded, not all files. (reread_symbols): Test file being loaded for whether it has symbols, not all files. (__initialize_symfile): Delete `set print symbol-loading'. * symfile.h (print_symbol_loading): Delete. * doc/gdb.texinfo (Symbols): Delete `set print symbol-loading'. (Files): Add note on new optional regex arg to `info sharedlibrary'. [-- Attachment #2: gdb-090827-info-shared-2.patch.txt --] [-- Type: text/plain, Size: 16914 bytes --] 2009-08-27 Doug Evans <dje@google.com> * NEWS: Add note on "info sharedlibrary". Remove note on "set print symbol-loading". * main.c (captured_main): Pass !batch for from_tty when calling symbol_file_add_main. * objfiles.h (objfile_has_partial_symbols): Declare. (objfile_has_full_symbols): Declare. * objfiles.c (objfile_has_partial_symbols): New function. (have_partial_symbols): Use it. (objfile_has_full_symbols): New function. (have_full_symbols): Use it. * solib.c: Include interps.h. (solib_read_symbols): Back out patch of 2008-07-10. Add test for info_verbose for symbol loading messages for consistency with symfile.c. (info_sharedlibrary_command): Handle optional parameter of regex of libraries to list. Inform user of libraries without debugging info. Rewrite to use ui_out routines to format output. * symfile.c (print_symbol_loading): Delete. (symbol_file_add_with_addrs_or_offsets): Back out patch of 2008-07-10. Print "no debugging symbols found" only if from_tty || info_verbose; and only check file being loaded, not all files. (reread_symbols): Test file being loaded for whether it has symbols, not all files. (__initialize_symfile): Delete `set print symbol-loading'. * symfile.h (print_symbol_loading): Delete. * doc/gdb.texinfo (Symbols): Delete `set print symbol-loading'. (Files): Add note on new optional regex arg to `info sharedlibrary'. Index: NEWS =================================================================== RCS file: /cvs/src/src/gdb/NEWS,v retrieving revision 1.326 diff -u -p -r1.326 NEWS --- NEWS 20 Aug 2009 18:02:47 -0000 1.326 +++ NEWS 27 Aug 2009 21:49:12 -0000 @@ -48,6 +48,9 @@ remote targets. To use this feature, sp with the `remote:' prefix, either via the `set sysroot' command or via the `--with-sysroot' configure-time option. +* "info sharedlibrary" now takes an optional regex of libraries to show, +and it now reports if a shared library has no debugging information. + * Commands `set debug-file-directory', `set solib-search-path' and `set args' now complete on file names. @@ -278,10 +281,6 @@ set sh calling-convention show sh calling-convention Control the calling convention used when calling SH target functions. -set print symbol-loading -show print symbol-loading - Control printing of symbol loading messages. - set debug timestamp show debug timestamp Control display of timestamps with GDB debugging output. Index: main.c =================================================================== RCS file: /cvs/src/src/gdb/main.c,v retrieving revision 1.76 diff -u -p -r1.76 main.c --- main.c 27 Apr 2009 10:24:08 -0000 1.76 +++ main.c 27 Aug 2009 21:49:12 -0000 @@ -801,14 +801,14 @@ Excess command line arguments ignored. ( open it, better only print one error message. catch_command_errors returns non-zero on success! */ if (catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL)) - catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL); + catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL); } else { if (execarg != NULL) catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL); if (symarg != NULL) - catch_command_errors (symbol_file_add_main, symarg, 0, RETURN_MASK_ALL); + catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL); } if (corearg && pidarg) Index: objfiles.c =================================================================== RCS file: /cvs/src/src/gdb/objfiles.c,v retrieving revision 1.93 diff -u -p -r1.93 objfiles.c --- objfiles.c 21 Aug 2009 17:57:17 -0000 1.93 +++ objfiles.c 27 Aug 2009 21:49:12 -0000 @@ -700,6 +700,22 @@ objfile_relocate (struct objfile *objfil breakpoint_re_set (); } \f +/* Return non-zero if OBJFILE has partial symbols. */ + +int +objfile_has_partial_symbols (struct objfile *objfile) +{ + return objfile->psymtabs != NULL; +} + +/* Return non-zero if OBJFILE has full symbols. */ + +int +objfile_has_full_symbols (struct objfile *objfile) +{ + return objfile->symtabs != NULL; +} + /* Many places in gdb want to test just to see if we have any partial symbols available. This function returns zero if none are currently available, nonzero otherwise. */ @@ -711,10 +727,8 @@ have_partial_symbols (void) ALL_OBJFILES (ofp) { - if (ofp->psymtabs != NULL) - { - return 1; - } + if (objfile_has_partial_symbols (ofp)) + return 1; } return 0; } @@ -730,10 +744,8 @@ have_full_symbols (void) ALL_OBJFILES (ofp) { - if (ofp->symtabs != NULL) - { - return 1; - } + if (objfile_has_full_symbols (ofp)) + return 1; } return 0; } Index: objfiles.h =================================================================== RCS file: /cvs/src/src/gdb/objfiles.h,v retrieving revision 1.62 diff -u -p -r1.62 objfiles.h --- objfiles.h 21 Aug 2009 17:57:17 -0000 1.62 +++ objfiles.h 27 Aug 2009 21:49:12 -0000 @@ -472,6 +472,10 @@ extern void free_all_objfiles (void); extern void objfile_relocate (struct objfile *, struct section_offsets *); +extern int objfile_has_partial_symbols (struct objfile *objfile); + +extern int objfile_has_full_symbols (struct objfile *objfile); + extern int have_partial_symbols (void); extern int have_full_symbols (void); Index: solib.c =================================================================== RCS file: /cvs/src/src/gdb/solib.c,v retrieving revision 1.125 diff -u -p -r1.125 solib.c --- solib.c 21 Aug 2009 17:57:17 -0000 1.125 +++ solib.c 27 Aug 2009 21:49:12 -0000 @@ -46,6 +46,7 @@ #include "readline/readline.h" #include "remote.h" #include "solib.h" +#include "interps.h" /* Architecture-specific operations. */ @@ -472,12 +473,12 @@ solib_read_symbols (struct so_list *so, if (so->symbols_loaded) { - if (from_tty) + if (from_tty || info_verbose) printf_unfiltered (_("Symbols already loaded for %s\n"), so->so_name); } else if (so->abfd == NULL) { - if (from_tty) + if (from_tty || info_verbose) printf_unfiltered (_("Symbol file not found for %s\n"), so->so_name); } else @@ -493,7 +494,7 @@ solib_read_symbols (struct so_list *so, "Error while reading shared library symbols:\n"); return 0; } - if (from_tty && print_symbol_loading) + if (from_tty || info_verbose) printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name); so->symbols_loaded = 1; return 1; @@ -784,52 +785,117 @@ solib_add (char *pattern, int from_tty, DESCRIPTION Walk through the shared library list and print information - about each attached library. + about each attached library matching PATTERN. If PATTERN is elided, + print them all. */ static void -info_sharedlibrary_command (char *ignore, int from_tty) +info_sharedlibrary_command (char *pattern, int from_tty) { struct so_list *so = NULL; /* link map state variable */ int header_done = 0; + int so_missing_debug_info = 0; int addr_width; + int nr_libs; + struct cleanup *table_cleanup; + struct gdbarch *gdbarch = target_gdbarch; + + if (pattern) + { + char *re_err = re_comp (pattern); + + if (re_err) + error (_("Invalid regexp: %s"), re_err); + } /* "0x", a little whitespace, and two hex digits per byte of pointers. */ - addr_width = 4 + (gdbarch_ptr_bit (target_gdbarch) / 4); + addr_width = 4 + (gdbarch_ptr_bit (gdbarch) / 4); update_solib_list (from_tty, 0); - for (so = so_list_head; so; so = so->next) + /* make_cleanup_ui_out_table_begin_end needs to know the number of + rows, so we need to make two passes over the libs. */ + + for (nr_libs = 0, so = so_list_head; so; so = so->next) { if (so->so_name[0]) { - if (!header_done) - { - printf_unfiltered ("%-*s%-*s%-12s%s\n", addr_width, "From", - addr_width, "To", "Syms Read", - "Shared Object Library"); - header_done++; - } + if (pattern && ! re_exec (so->so_name)) + continue; + ++nr_libs; + } + } + + table_cleanup = + make_cleanup_ui_out_table_begin_end (uiout, 4, nr_libs, + "SharedLibraryTable"); + + /* The "- 1" is because ui_out adds one space between columns. */ + ui_out_table_header (uiout, addr_width - 1, ui_left, "from", "From"); + ui_out_table_header (uiout, addr_width - 1, ui_left, "to", "To"); + ui_out_table_header (uiout, 12 - 1, ui_left, "syms-read", "Syms Read"); + ui_out_table_header (uiout, 0, ui_noalign, + "name", "Shared Object Library"); + + ui_out_table_body (uiout); + + for (so = so_list_head; so; so = so->next) + { + struct cleanup *lib_cleanup; - printf_unfiltered ("%-*s", addr_width, - so->addr_high != 0 - ? hex_string_custom ( - (LONGEST) so->addr_low, - addr_width - 4) - : ""); - printf_unfiltered ("%-*s", addr_width, - so->addr_high != 0 - ? hex_string_custom ( - (LONGEST) so->addr_high, - addr_width - 4) - : ""); - printf_unfiltered ("%-12s", so->symbols_loaded ? "Yes" : "No"); - printf_unfiltered ("%s\n", so->so_name); + if (! so->so_name[0]) + continue; + if (pattern && ! re_exec (so->so_name)) + continue; + + lib_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "lib"); + + if (so->addr_high != 0) + { + ui_out_field_core_addr (uiout, "from", gdbarch, so->addr_low); + ui_out_field_core_addr (uiout, "to", gdbarch, so->addr_high); + } + else + { + ui_out_field_skip (uiout, "from"); + ui_out_field_skip (uiout, "to"); } + + if (! ui_out_is_mi_like_p (interp_ui_out (top_level_interpreter ())) + && so->symbols_loaded + && !objfile_has_partial_symbols (so->objfile) + && !objfile_has_full_symbols (so->objfile)) + { + so_missing_debug_info = 1; + ui_out_field_string (uiout, "syms-read", "Yes (*)"); + } + else + ui_out_field_string (uiout, "syms-read", + so->symbols_loaded ? "Yes" : "No"); + + ui_out_field_string (uiout, "name", so->so_name); + + ui_out_text (uiout, "\n"); + + do_cleanups (lib_cleanup); } - if (so_list_head == NULL) + + do_cleanups (table_cleanup); + + if (nr_libs == 0) + { + if (pattern) + ui_out_message (uiout, 0, + _("No shared libraries matched.\n")); + else + ui_out_message (uiout, 0, + _("No shared libraries loaded at this time.\n")); + } + else { - printf_unfiltered (_("No shared libraries loaded at this time.\n")); + if (so_missing_debug_info) + ui_out_message (uiout, 0, + _("(*): Shared library is missing debugging information.\n")); } } Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.244 diff -u -p -r1.244 symfile.c --- symfile.c 21 Aug 2009 17:57:17 -0000 1.244 +++ symfile.c 27 Aug 2009 21:49:12 -0000 @@ -171,13 +171,6 @@ 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 attaching to the inferior. This is almost always what users will @@ -989,12 +982,9 @@ symbol_file_add_with_addrs_or_offsets (b deprecated_pre_add_symbol_hook (name); else { - if (print_symbol_loading) - { - printf_unfiltered (_("Reading symbols from %s..."), name); - wrap_here (""); - gdb_flush (gdb_stdout); - } + printf_unfiltered (_("Reading symbols from %s..."), name); + wrap_here (""); + gdb_flush (gdb_stdout); } } syms_from_objfile (objfile, addrs, offsets, num_offsets, @@ -1007,7 +997,7 @@ symbol_file_add_with_addrs_or_offsets (b if ((flags & OBJF_READNOW) || readnow_symbol_files) { - if ((from_tty || info_verbose) && print_symbol_loading) + if (from_tty || info_verbose) { printf_unfiltered (_("expanding to full symbols...")); wrap_here (""); @@ -1049,15 +1039,12 @@ symbol_file_add_with_addrs_or_offsets (b xfree (debugfile); } - if (!have_partial_symbols () && !have_full_symbols () - && print_symbol_loading) + if ((from_tty || info_verbose) + && !objfile_has_partial_symbols (objfile) + && !objfile_has_full_symbols (objfile)) { wrap_here (""); - printf_unfiltered (_("(no debugging symbols found)")); - if (from_tty || info_verbose) - printf_unfiltered ("..."); - else - printf_unfiltered ("\n"); + printf_unfiltered (_("(no debugging symbols found)...")); wrap_here (""); } @@ -1066,10 +1053,7 @@ symbol_file_add_with_addrs_or_offsets (b if (deprecated_post_add_symbol_hook) deprecated_post_add_symbol_hook (); else - { - if (print_symbol_loading) - printf_unfiltered (_("done.\n")); - } + printf_unfiltered (_("done.\n")); } /* We print some messages regardless of whether 'from_tty || @@ -2438,7 +2422,8 @@ reread_symbols (void) zero is OK since dbxread.c also does what it needs to do if objfile->global_psymbols.size is 0. */ (*objfile->sf->sym_read) (objfile, 0); - if (!have_partial_symbols () && !have_full_symbols ()) + if (!objfile_has_partial_symbols (objfile) + && !objfile_has_full_symbols (objfile)) { wrap_here (""); printf_unfiltered (_("(no debugging symbols found)\n")); @@ -4207,12 +4192,4 @@ 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.51 diff -u -p -r1.51 symfile.h --- symfile.h 16 Jun 2009 18:49:25 -0000 1.51 +++ symfile.h 27 Aug 2009 21:49:12 -0000 @@ -284,13 +284,6 @@ 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.617 diff -u -p -r1.617 gdb.texinfo --- doc/gdb.texinfo 25 Aug 2009 15:24:12 -0000 1.617 +++ doc/gdb.texinfo 27 Aug 2009 21:49:13 -0000 @@ -12637,22 +12637,6 @@ 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 @@ -13525,9 +13509,11 @@ command: @table @code @kindex info sharedlibrary @kindex info share -@item info share -@itemx info sharedlibrary -Print the names of the shared libraries which are currently loaded. +@item info share @var{regex} +@itemx info sharedlibrary @var{regex} +Print the names of the shared libraries which are currently loaded +that match @var{regex}. If @var{regex} is omitted then print +all shared libraries that are loaded. @kindex sharedlibrary @kindex share ^ permalink raw reply [flat|nested] 32+ messages in thread
end of thread, other threads:[~2009-08-27 22:03 UTC | newest] Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-05-23 23:24 [RFA] Fix too many "no debugging symbols found" warnings Doug Evans 2009-05-25 3:20 ` Eli Zaretskii 2009-05-25 16:07 ` Doug Evans 2009-06-04 20:34 ` Tom Tromey 2009-06-04 21:20 ` Pedro Alves 2009-06-05 18:19 ` Tom Tromey 2009-06-05 18:49 ` Pedro Alves 2009-06-05 22:18 ` Tom Tromey 2009-06-19 0:48 ` Doug Evans 2009-06-22 17:54 ` Tom Tromey 2009-06-22 19:35 ` Pedro Alves 2009-06-30 21:49 ` Doug Evans 2009-06-30 21:55 ` Pedro Alves 2009-06-30 22:20 ` Doug Evans 2009-07-01 2:29 ` Tom Tromey 2009-07-01 3:13 ` Eli Zaretskii 2009-07-01 3:47 ` Doug Evans 2009-07-01 17:48 ` Eli Zaretskii 2009-07-01 17:53 ` Doug Evans 2009-07-01 18:01 ` Pedro Alves 2009-07-01 19:55 ` Doug Evans 2009-07-02 13:26 ` Pedro Alves 2009-07-02 20:08 ` Doug Evans 2009-07-02 22:43 ` Pedro Alves 2009-07-11 4:22 ` Doug Evans 2009-07-20 13:21 ` Pedro Alves 2009-07-23 18:57 ` Doug Evans 2009-07-27 17:15 ` Tom Tromey 2009-08-24 22:02 ` Doug Evans 2009-08-25 3:47 ` Eli Zaretskii 2009-08-27 19:11 ` Tom Tromey 2009-08-27 23:39 ` Doug Evans
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox