diff options
author | Daniel Jacobowitz <drow@false.org> | 2007-01-09 21:34:30 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2007-01-09 21:34:30 +0000 |
commit | aa28a74efb2773e42c35302b4e8a2e0510cb2858 (patch) | |
tree | e83dee8aa1fbd91d10a019e93e37c1eea6d37fce /gdb/symfile.c | |
parent | 1cfd2c3eed930ee8a6e074d73f77f86d3c151546 (diff) | |
download | binutils-gdb-aa28a74efb2773e42c35302b4e8a2e0510cb2858.tar.gz |
* configure.ac (DEBUGDIR_RELOCATABLE): Define for debugdir inside
exec_prefix.
(TARGET_SYSTEM_ROOT_RELOCATABLE): Allow for exec_prefix being
'${prefix}'.
* configure, config.in: Regenerate.
* defs.h (debug_file_directory): Declare.
* main.c (captured_main): Canonicalize gdb_sysroot. Assume
TARGET_SYSTEM_ROOT is defined. Initialize debug_file_directory and
relocate it if DEBUGDIR_RELOCATABLE.
* symfile.c (debug_file_directory): Make non-static.
(find_separate_debug_file): Look for debug info for SYSROOT/PATH
in DEBUGDIR/PATH if DEBUGDIR is inside SYSROOT.
(_initialize_symfile): Don't initialize debug_file_directory here.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index 99c965eede8..37a57c86ab3 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1156,7 +1156,7 @@ separate_debug_file_exists (const char *name, unsigned long crc) return crc == file_crc; } -static char *debug_file_directory = NULL; +char *debug_file_directory = NULL; static void show_debug_file_directory (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) @@ -1178,6 +1178,7 @@ find_separate_debug_file (struct objfile *objfile) char *dir; char *debugfile; char *name_copy; + char *canon_name; bfd_size_type debuglink_size; unsigned long crc32; int i; @@ -1245,6 +1246,30 @@ find_separate_debug_file (struct objfile *objfile) return xstrdup (debugfile); } + /* If the file is in the sysroot, try using its base path in the + global debugfile directory. */ + canon_name = lrealpath (dir); + if (canon_name + && strncmp (canon_name, gdb_sysroot, strlen (gdb_sysroot)) == 0 + && IS_DIR_SEPARATOR (canon_name[strlen (gdb_sysroot)])) + { + strcpy (debugfile, debug_file_directory); + strcat (debugfile, canon_name + strlen (gdb_sysroot)); + strcat (debugfile, "/"); + strcat (debugfile, basename); + + if (separate_debug_file_exists (debugfile, crc32)) + { + xfree (canon_name); + xfree (basename); + xfree (dir); + return xstrdup (debugfile); + } + } + + if (canon_name) + xfree (canon_name); + xfree (basename); xfree (dir); return NULL; @@ -3857,7 +3882,6 @@ Usage: set extension-language .foo bar"), add_info ("extensions", info_ext_lang_command, _("All filename extensions associated with a source language.")); - debug_file_directory = xstrdup (DEBUGDIR); add_setshow_optional_filename_cmd ("debug-file-directory", class_support, &debug_file_directory, _("\ Set the directory where separate debug symbols are searched for."), _("\ |