diff options
author | Nick Clifton <nickc@redhat.com> | 2017-01-12 16:56:54 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2017-01-12 16:56:54 +0000 |
commit | 2425a30e406a0523020b7e70abb864a06a45bb97 (patch) | |
tree | d6b5cb440da8e0b7123051e3d35c0b4773e7d8ab /bfd/dwarf2.c | |
parent | 620214f742f7816e2844e1bb7f78a7a684431927 (diff) | |
download | gdb-2425a30e406a0523020b7e70abb864a06a45bb97.zip gdb-2425a30e406a0523020b7e70abb864a06a45bb97.tar.gz gdb-2425a30e406a0523020b7e70abb864a06a45bb97.tar.bz2 |
Add support for locating separate debug info files via the build-id method.
PR binutils/20876
bfd * opncls.c (find_separate_debug_file): Add include_dirs
parameter. Only include the directory part of the bfd's filename
in search paths if include_dirs is true. Add a couple of extra
locations for looking for debug files.
( bfd_follow_gnu_debuglink): Update invocation of
find_separate_debug_file.
(bfd_follow_gnu_debugaltlink): Likewise.
(get_build_id): New function: Finds the build-id of the given bfd.
(get_build_id_name): New function: Computes the name of the
separate debug info file for a bfd, based upon its build-id.
(check_build_id_file): New function: Checks to see if a separate
debug info file exists at the given location, and that its
build-id matches that of the original bfd.
(bfd_follow_build_id_debuglink): New function: Finds a separate
debug info file for a given bfd by using the build-id method.
* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Try using the build-id
method of locating a separate debug info file before using the
debuglink method.
* bfd-in2.h: Regenerate.
binutils * NEWS: Mention the new feature.
* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
New proc to test the location of separate debug info files using
the build-id method.
Diffstat (limited to 'bfd/dwarf2.c')
-rw-r--r-- | bfd/dwarf2.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 40edd91..3699587 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -3921,7 +3921,11 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd, bfd *debug_bfd, msec = find_debug_info (debug_bfd, debug_sections, NULL); if (msec == NULL && abfd == debug_bfd) { - char * debug_filename = bfd_follow_gnu_debuglink (abfd, DEBUGDIR); + char * debug_filename; + + debug_filename = bfd_follow_build_id_debuglink (abfd, DEBUGDIR); + if (debug_filename == NULL) + debug_filename = bfd_follow_gnu_debuglink (abfd, DEBUGDIR); if (debug_filename == NULL) /* No dwarf2 info, and no gnu_debuglink to follow. |