mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-17 16:05:56 +08:00
symtab/15652
* dwarf2read.c (try_open_dwop_file): New arg search_cwd. All callers updated. (open_dwp_file): If we can't find the dwp file, search the basename in debug-file-directory.
This commit is contained in:
@ -1,5 +1,11 @@
|
|||||||
2013-06-20 Doug Evans <dje@google.com>
|
2013-06-20 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
symtab/15652
|
||||||
|
* dwarf2read.c (try_open_dwop_file): New arg search_cwd.
|
||||||
|
All callers updated.
|
||||||
|
(open_dwp_file): If we can't find the dwp file, search the basename
|
||||||
|
in debug-file-directory.
|
||||||
|
|
||||||
* dwarf2read.c (struct dwp_file): Fix comment.
|
* dwarf2read.c (struct dwp_file): Fix comment.
|
||||||
(open_and_init_dwp_file): Set dwp_file->name to bfd's file name.
|
(open_and_init_dwp_file): Set dwp_file->name to bfd's file name.
|
||||||
|
|
||||||
|
@ -9304,11 +9304,13 @@ lookup_dwo_in_dwp (struct dwp_file *dwp_file,
|
|||||||
preliminary analysis. Return a newly initialized bfd *, which
|
preliminary analysis. Return a newly initialized bfd *, which
|
||||||
includes a canonicalized copy of FILE_NAME.
|
includes a canonicalized copy of FILE_NAME.
|
||||||
If IS_DWP is TRUE, we're opening a DWP file, otherwise a DWO file.
|
If IS_DWP is TRUE, we're opening a DWP file, otherwise a DWO file.
|
||||||
In case of trouble, return NULL.
|
SEARCH_CWD is true if the current directory is to be searched.
|
||||||
|
It will be searched before debug-file-directory.
|
||||||
|
If unable to find/open the file, return NULL.
|
||||||
NOTE: This function is derived from symfile_bfd_open. */
|
NOTE: This function is derived from symfile_bfd_open. */
|
||||||
|
|
||||||
static bfd *
|
static bfd *
|
||||||
try_open_dwop_file (const char *file_name, int is_dwp)
|
try_open_dwop_file (const char *file_name, int is_dwp, int search_cwd)
|
||||||
{
|
{
|
||||||
bfd *sym_bfd;
|
bfd *sym_bfd;
|
||||||
int desc, flags;
|
int desc, flags;
|
||||||
@ -9319,11 +9321,16 @@ try_open_dwop_file (const char *file_name, int is_dwp)
|
|||||||
char *search_path;
|
char *search_path;
|
||||||
static const char dirname_separator_string[] = { DIRNAME_SEPARATOR, '\0' };
|
static const char dirname_separator_string[] = { DIRNAME_SEPARATOR, '\0' };
|
||||||
|
|
||||||
if (*debug_file_directory != '\0')
|
if (search_cwd)
|
||||||
search_path = concat (".", dirname_separator_string, debug_file_directory,
|
{
|
||||||
NULL);
|
if (*debug_file_directory != '\0')
|
||||||
|
search_path = concat (".", dirname_separator_string,
|
||||||
|
debug_file_directory, NULL);
|
||||||
|
else
|
||||||
|
search_path = xstrdup (".");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
search_path = xstrdup (".");
|
search_path = xstrdup (debug_file_directory);
|
||||||
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
if (is_dwp)
|
if (is_dwp)
|
||||||
@ -9362,7 +9369,7 @@ open_dwo_file (const char *file_name, const char *comp_dir)
|
|||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
|
|
||||||
if (IS_ABSOLUTE_PATH (file_name))
|
if (IS_ABSOLUTE_PATH (file_name))
|
||||||
return try_open_dwop_file (file_name, 0 /*is_dwp*/);
|
return try_open_dwop_file (file_name, 0 /*is_dwp*/, 0 /*search_cwd*/);
|
||||||
|
|
||||||
/* Before trying the search path, try DWO_NAME in COMP_DIR. */
|
/* Before trying the search path, try DWO_NAME in COMP_DIR. */
|
||||||
|
|
||||||
@ -9372,7 +9379,7 @@ open_dwo_file (const char *file_name, const char *comp_dir)
|
|||||||
|
|
||||||
/* NOTE: If comp_dir is a relative path, this will also try the
|
/* NOTE: If comp_dir is a relative path, this will also try the
|
||||||
search path, which seems useful. */
|
search path, which seems useful. */
|
||||||
abfd = try_open_dwop_file (path_to_try, 0 /*is_dwp*/);
|
abfd = try_open_dwop_file (path_to_try, 0 /*is_dwp*/, 1 /*search_cwd*/);
|
||||||
xfree (path_to_try);
|
xfree (path_to_try);
|
||||||
if (abfd != NULL)
|
if (abfd != NULL)
|
||||||
return abfd;
|
return abfd;
|
||||||
@ -9384,7 +9391,7 @@ open_dwo_file (const char *file_name, const char *comp_dir)
|
|||||||
if (*debug_file_directory == '\0')
|
if (*debug_file_directory == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return try_open_dwop_file (file_name, 0 /*is_dwp*/);
|
return try_open_dwop_file (file_name, 0 /*is_dwp*/, 1 /*search_cwd*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is mapped across the sections and remembers the offset and
|
/* This function is mapped across the sections and remembers the offset and
|
||||||
@ -9568,7 +9575,30 @@ allocate_dwp_loaded_cutus_table (struct objfile *objfile)
|
|||||||
static bfd *
|
static bfd *
|
||||||
open_dwp_file (const char *file_name)
|
open_dwp_file (const char *file_name)
|
||||||
{
|
{
|
||||||
return try_open_dwop_file (file_name, 1 /*is_dwp*/);
|
bfd *abfd;
|
||||||
|
|
||||||
|
abfd = try_open_dwop_file (file_name, 1 /*is_dwp*/, 1 /*search_cwd*/);
|
||||||
|
if (abfd != NULL)
|
||||||
|
return abfd;
|
||||||
|
|
||||||
|
/* Work around upstream bug 15652.
|
||||||
|
http://sourceware.org/bugzilla/show_bug.cgi?id=15652
|
||||||
|
[Whether that's a "bug" is debatable, but it is getting in our way.]
|
||||||
|
We have no real idea where the dwp file is, because gdb's realpath-ing
|
||||||
|
of the executable's path may have discarded the needed info.
|
||||||
|
[IWBN if the dwp file name was recorded in the executable, akin to
|
||||||
|
.gnu_debuglink, but that doesn't exist yet.]
|
||||||
|
Strip the directory from FILE_NAME and search again. */
|
||||||
|
if (*debug_file_directory != '\0')
|
||||||
|
{
|
||||||
|
/* Don't implicitly search the current directory here.
|
||||||
|
If the user wants to search "." to handle this case,
|
||||||
|
it must be added to debug-file-directory. */
|
||||||
|
return try_open_dwop_file (lbasename (file_name), 1 /*is_dwp*/,
|
||||||
|
0 /*search_cwd*/);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the use of the DWP file for the current objfile.
|
/* Initialize the use of the DWP file for the current objfile.
|
||||||
|
Reference in New Issue
Block a user