From: Doug Evans <dje@google.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
tromey@redhat.com, gdb-patches@sourceware.org
Subject: Re: [RFA] Fix too many "no debugging symbols found" warnings.
Date: Sat, 11 Jul 2009 04:22:00 -0000 [thread overview]
Message-ID: <e394668d0907101512q708b6bf3ua96e2ff55bdea4b9@mail.gmail.com> (raw)
In-Reply-To: <200907022344.12495.pedro@codesourcery.com>
[-- 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
next prev parent reply other threads:[~2009-07-10 22:12 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-23 23:24 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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e394668d0907101512q708b6bf3ua96e2ff55bdea4b9@mail.gmail.com \
--to=dje@google.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox