This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 5/5] Also look for debug files in gdb_sysroot
- From: Gary Benson <gbenson at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: CÃdric Buissart <cedric dot buissart at gmail dot com>
- Date: Tue, 16 Jun 2015 10:42:48 +0100
- Subject: [PATCH 5/5] Also look for debug files in gdb_sysroot
- Authentication-results: sourceware.org; auth=none
- References: <1434447768-17328-1-git-send-email-gbenson at redhat dot com>
This commit makes GDB look for separate debug files in gdb_sysroot if
not found in the currently searched locations. This allows for easier
analysis of core files from foreign machines using the sysroot option.
The user creates or mounts a directory containing the necessary
binaries and debuginfo and then sets GDB's sysroot to that directory
before starting their debug session.
gdb/ChangeLog:
* gdb/symfile.c (find_separate_debug_file): In debugdir loop,
also try alternate directory prefixed with gdb_sysroot.
---
gdb/ChangeLog | 6 ++++++
gdb/symfile.c | 11 +++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 0cc940a..1cd99ea 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1613,6 +1613,7 @@ find_separate_debug_file (const char *dir,
if (altdir != NULL)
{
+ /* Try in the alternate directory directly. */
debugfile = build_debug_file_name (no_prefix, debugdir,
altdir, debuglink, NULL);
if (separate_debug_file_exists (debugfile, crc32, objfile))
@@ -1621,6 +1622,16 @@ find_separate_debug_file (const char *dir,
return debugfile;
}
xfree (debugfile);
+
+ /* Try in the alternate directory in gdb_sysroot. */
+ debugfile = build_debug_file_name (gdb_sysroot, debugdir,
+ altdir, debuglink, NULL);
+ if (separate_debug_file_exists (debugfile, crc32, objfile))
+ {
+ do_cleanups (back_to);
+ return debugfile;
+ }
+ xfree (debugfile);
}
}
--
1.7.1