Only print "no debugging symbols" message once
authorTom Tromey <tom@tromey.com>
Mon, 28 May 2018 03:12:58 +0000 (21:12 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 4 Oct 2018 19:40:10 +0000 (13:40 -0600)
The "no debugging symbols" message can be confusing in some cases, for
example when gdb finds separate debug info for an objfile, but the
separate debug info does not contain symbols.

For example:

    (gdb) file /bin/ls
    Reading symbols from /bin/ls...
    Reading symbols from .gnu_debugdata for /usr/bin/ls...
    (No debugging symbols found in .gnu_debugdata for /usr/bin/ls)
    (No debugging symbols found in /bin/ls)

Here, I think the second "no debugging symbols" message is redundant
and confusing.

This patch changes gdb to only emit this message when the objfile in
question does not have a separate debug file.  So, in the example
above, the output would now read:

    (gdb) file /bin/ls
    Reading symbols from /bin/ls...
    Reading symbols from .gnu_debugdata for /usr/bin/ls...
    (No debugging symbols found in .gnu_debugdata for /usr/bin/ls)

2018-10-04  Tom Tromey  <tom@tromey.com>

* symfile.c (symbol_file_add_with_addrs): Do not print "no
debugging symbols" message if there is a separate debug objfile.

gdb/ChangeLog
gdb/symfile.c

index 0b9dff67c27dc5daed0867c827c52e0fdf5419bc..5e23132069113e378fc2abe486e07b0a8456119c 100644 (file)
@@ -1,3 +1,8 @@
+2018-10-04  Tom Tromey  <tom@tromey.com>
+
+       * symfile.c (symbol_file_add_with_addrs): Do not print "no
+       debugging symbols" message if there is a separate debug objfile.
+
 2018-10-04  Tom Tromey  <tom@tromey.com>
 
        PR cli/19551:
index ed41b5b70fffe90930343fb8ee7b955e644892ab..981bf336ce5344628a62e0c0e3a2229e9cbdc010 100644 (file)
@@ -1128,7 +1128,12 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name,
        objfile->sf->qf->expand_all_symtabs (objfile);
     }
 
-  if (should_print && !objfile_has_symbols (objfile))
+  /* Note that we only print a message if we have no symbols and have
+     no separate debug file.  If there is a separate debug file which
+     does not have symbols, we'll have emitted this message for that
+     file, and so printing it twice is just redundant.  */
+  if (should_print && !objfile_has_symbols (objfile)
+      && objfile->separate_debug_objfile == nullptr)
     printf_filtered (_("(No debugging symbols found in %s)\n"), name);
 
   if (should_print)
This page took 0.041884 seconds and 4 git commands to generate.