This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] dwarf2read.c (try_open_dwop_file): Work around behaviour of OPF_TRY_CWD_FIRST
- From: Doug Evans <dje at google dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 13 Jun 2013 16:03:20 -0700
- Subject: [commit] dwarf2read.c (try_open_dwop_file): Work around behaviour of OPF_TRY_CWD_FIRST
Hi.
fyi, I committed this.
The behaviour of OPF_TRY_CWD_FIRST to not search path if the file name
contains a '/' is not appropriate in this context.
Regression tested on amd64-linux with fission.
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 '/'.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.803
diff -u -p -r1.803 dwarf2read.c
--- dwarf2read.c 6 Jun 2013 23:51:09 -0000 1.803
+++ dwarf2read.c 13 Jun 2013 22:32:25 -0000
@@ -9290,22 +9290,31 @@ try_open_dwop_file (const char *file_nam
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))