[binutils-gdb] Only print "no debugging symbols" message once

Tom Tromey tromey@sourceware.org
Thu Oct 4 19:43:00 GMT 2018


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e79497a160f38368688107520d7d1bd0aeafc1c7

commit e79497a160f38368688107520d7d1bd0aeafc1c7
Author: Tom Tromey <tom@tromey.com>
Date:   Sun May 27 21:12:58 2018 -0600

    Only print "no debugging symbols" message once
    
    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.

Diff:
---
 gdb/ChangeLog | 5 +++++
 gdb/symfile.c | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0b9dff6..5e23132 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 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:
 	* symfile.c (symbol_file_add_with_addrs): Update output.
 	* psymtab.c (require_partial_symbols): Update output.
diff --git a/gdb/symfile.c b/gdb/symfile.c
index ed41b5b..981bf33 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -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)



More information about the Gdb-cvs mailing list