aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2013-06-13 23:01:37 +0000
committerDoug Evans <dje@google.com>2013-06-13 23:01:37 +0000
commit9c02c1294723e1363c7555c8f404cf88eaf8e7c4 (patch)
treeea1779c7d63fe5c7b4d2702e708e9fb669cf941a
parentcdd4989877f0692d8424f4361a1cd6c768884c61 (diff)
downloadgdb-9c02c1294723e1363c7555c8f404cf88eaf8e7c4.zip
gdb-9c02c1294723e1363c7555c8f404cf88eaf8e7c4.tar.gz
gdb-9c02c1294723e1363c7555c8f404cf88eaf8e7c4.tar.bz2
* dwarf2read.c (try_open_dwop_file): Work around behaviour of
OPF_TRY_CWD_FIRST to not search path if the file contains a '/'.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/dwarf2read.c23
2 files changed, 21 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ad73d8f..7ae0797 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-13 Doug Evans <dje@google.com>
+
+ * dwarf2read.c (try_open_dwop_file): Work around behaviour of
+ OPF_TRY_CWD_FIRST to not search path if the file contains a '/'.
+
2013-06-12 Phil Muldoon <pmuldoon@redhat.com>
* stack.c (backtrace_command_1): Fix indentation.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 55b1b17..a902b70 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -9290,22 +9290,31 @@ try_open_dwop_file (const char *file_name, int is_dwp)
bfd *sym_bfd;
int desc, flags;
char *absolute_name;
+ /* Blech. OPF_TRY_CWD_FIRST also disables searching the path list if
+ FILE_NAME contains a '/'. So we can't use it. Instead prepend "."
+ to debug_file_directory. */
+ char *search_path;
+ static const char dirname_separator_string[] = { DIRNAME_SEPARATOR, '\0' };
+
+ if (*debug_file_directory != '\0')
+ search_path = concat (".", dirname_separator_string, debug_file_directory,
+ NULL);
+ else
+ search_path = xstrdup (".");
- flags = OPF_TRY_CWD_FIRST;
+ flags = 0;
if (is_dwp)
flags |= OPF_SEARCH_IN_PATH;
- desc = openp (debug_file_directory, flags, file_name,
+ desc = openp (search_path, flags, file_name,
O_RDONLY | O_BINARY, &absolute_name);
+ xfree (search_path);
if (desc < 0)
return NULL;
sym_bfd = gdb_bfd_open (absolute_name, gnutarget, desc);
- if (!sym_bfd)
- {
- xfree (absolute_name);
- return NULL;
- }
xfree (absolute_name);
+ if (sym_bfd == NULL)
+ return NULL;
bfd_set_cacheable (sym_bfd, 1);
if (!bfd_check_format (sym_bfd, bfd_object))