diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2018-12-26 11:49:51 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2018-12-26 11:49:51 -0500 |
commit | 50794b45a2a7330fc32b118bff584a3a2e649ac5 (patch) | |
tree | 1ff976fb2cba7808f2ecbfc54bfd167a394f06d8 /gdb/build-id.c | |
parent | 5172760036cc706596970b35f106aa5a9093b44b (diff) | |
download | gdb-50794b45a2a7330fc32b118bff584a3a2e649ac5.zip gdb-50794b45a2a7330fc32b118bff584a3a2e649ac5.tar.gz gdb-50794b45a2a7330fc32b118bff584a3a2e649ac5.tar.bz2 |
Improve "set debug separate-debug-file"
"set debug separate-debug-file" shows which candidates are considered,
when trying to find separate debug info. But it's not clear if GDB used
a certain candidate, and if not, why not. This patch adds some
precision:
Before:
Looking for separate debug info (debug link) for /lib/x86_64-linux-gnu/libc.so.6
Trying /lib/x86_64-linux-gnu/libc-2.23.so
Trying /lib/x86_64-linux-gnu/.debug/libc-2.23.so
Trying /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.23.so
After:
Looking for separate debug info (debug link) for /lib/x86_64-linux-gnu/libc.so.6
Trying /lib/x86_64-linux-gnu/libc-2.23.so... no, same file as the objfile.
Trying /lib/x86_64-linux-gnu/.debug/libc-2.23.so... no, unable to open.
Trying /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.23.so... yes!
gdb/ChangeLog:
* build-id.c (build_id_to_debug_bfd): Enhance debug output.
* symfile.c (separate_debug_file_exists): Likewise.
Diffstat (limited to 'gdb/build-id.c')
-rw-r--r-- | gdb/build-id.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/gdb/build-id.c b/gdb/build-id.c index c8eacbd..ea6b61d 100644 --- a/gdb/build-id.c +++ b/gdb/build-id.c @@ -98,7 +98,10 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) link += ".debug"; if (separate_debug_file_debug) - printf_unfiltered (_(" Trying %s\n"), link.c_str ()); + { + printf_unfiltered (_(" Trying %s..."), link.c_str ()); + gdb_flush (gdb_stdout); + } /* lrealpath() is expensive even for the usually non-existent files. */ gdb::unique_xmalloc_ptr<char> filename; @@ -106,16 +109,36 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) filename.reset (lrealpath (link.c_str ())); if (filename == NULL) - continue; + { + if (separate_debug_file_debug) + printf_unfiltered (_(" no, unable to compute real path\n")); + + continue; + } /* We expect to be silent on the non-existing files. */ abfd = gdb_bfd_open (filename.get (), gnutarget, -1); if (abfd == NULL) - continue; + { + if (separate_debug_file_debug) + printf_unfiltered (_(" no, unable to open.\n")); + + continue; + } if (build_id_verify (abfd.get(), build_id_len, build_id)) - break; + { + if (separate_debug_file_debug) + printf_unfiltered (_(" yes!\n")); + + break; + } + else + { + if (separate_debug_file_debug) + printf_unfiltered (_(" no, build-id does not match.\n")); + } abfd.release (); } |