aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2016-05-03 16:30:58 -0700
committerDoug Evans <dje@google.com>2016-05-03 16:30:58 -0700
commit6c4474237ab3356b100ebbdd6ff1a8839745023d (patch)
tree006a3570bd940bd10676bcc8d7e8a8303555f8a2 /gdb/dwarf2read.c
parenta1ec3d244a75a6e6a2f54235c26e6b1e3b8a2482 (diff)
downloadgdb-6c4474237ab3356b100ebbdd6ff1a8839745023d.zip
gdb-6c4474237ab3356b100ebbdd6ff1a8839745023d.tar.gz
gdb-6c4474237ab3356b100ebbdd6ff1a8839745023d.tar.bz2
PR symtab/19914 fix handling of dwp + split debug
PR symtab/19914 * dwarf2read.c (open_and_init_dwp_file): Look at backlink if objfile is separate debug file. testsuite/ * gdb.dwarf2/dwp-sepdebug.c: New file. * gdb.dwarf2/dwp-sepdebug.exp: New file.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 7bbf080..eb81151 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -10838,12 +10838,26 @@ open_and_init_dwp_file (void)
struct dwp_file *dwp_file;
char *dwp_name;
bfd *dbfd;
- struct cleanup *cleanups;
+ struct cleanup *cleanups = make_cleanup (null_cleanup, 0);
/* Try to find first .dwp for the binary file before any symbolic links
resolving. */
- dwp_name = xstrprintf ("%s.dwp", objfile->original_name);
- cleanups = make_cleanup (xfree, dwp_name);
+
+ /* If the objfile is a debug file, find the name of the real binary
+ file and get the name of dwp file from there. */
+ if (objfile->separate_debug_objfile_backlink != NULL)
+ {
+ struct objfile *backlink = objfile->separate_debug_objfile_backlink;
+ const char *backlink_basename = lbasename (backlink->original_name);
+ char *debug_dirname = ldirname (objfile->original_name);
+
+ make_cleanup (xfree, debug_dirname);
+ dwp_name = xstrprintf ("%s%s%s.dwp", debug_dirname,
+ SLASH_STRING, backlink_basename);
+ }
+ else
+ dwp_name = xstrprintf ("%s.dwp", objfile->original_name);
+ make_cleanup (xfree, dwp_name);
dbfd = open_dwp_file (dwp_name);
if (dbfd == NULL