Try to use the canonical version of a sysroot for debug file links.
Object file paths passed to find_separate_debug_file are always canonical paths with symbolic links resolved. If a sysroot path traverses a symbolic link, it will not match the object file paths. Generate a canonical version of the sysroot directory. If it is valid, use it instead of gdb_sysroot with child_path to determine if an object file is under a system root. gdb/ChangeLog: * symfile.c (find_separate_debug_file): Use canonical path of sysroot with child_path instead of gdb_sysroot if it is valid.
This commit is contained in:
parent
cd4b78483c
commit
f62318e98d
|
@ -1,3 +1,8 @@
|
||||||
|
2019-02-12 John Baldwin <jhb@FreeBSD.org>
|
||||||
|
|
||||||
|
* symfile.c (find_separate_debug_file): Use canonical path of
|
||||||
|
sysroot with child_path instead of gdb_sysroot if it is valid.
|
||||||
|
|
||||||
2019-02-12 John Baldwin <jhb@FreeBSD.org>
|
2019-02-12 John Baldwin <jhb@FreeBSD.org>
|
||||||
|
|
||||||
* symfile.c (find_separate_debug_file): Use child_path to
|
* symfile.c (find_separate_debug_file): Use child_path to
|
||||||
|
|
|
@ -1441,6 +1441,7 @@ find_separate_debug_file (const char *dir,
|
||||||
const char *dir_notarget = target_prefix ? dir + strlen ("target:") : dir;
|
const char *dir_notarget = target_prefix ? dir + strlen ("target:") : dir;
|
||||||
std::vector<gdb::unique_xmalloc_ptr<char>> debugdir_vec
|
std::vector<gdb::unique_xmalloc_ptr<char>> debugdir_vec
|
||||||
= dirnames_to_char_ptr_vec (debug_file_directory);
|
= dirnames_to_char_ptr_vec (debug_file_directory);
|
||||||
|
gdb::unique_xmalloc_ptr<char> canon_sysroot = gdb_realpath (gdb_sysroot);
|
||||||
|
|
||||||
for (const gdb::unique_xmalloc_ptr<char> &debugdir : debugdir_vec)
|
for (const gdb::unique_xmalloc_ptr<char> &debugdir : debugdir_vec)
|
||||||
{
|
{
|
||||||
|
@ -1453,9 +1454,15 @@ find_separate_debug_file (const char *dir,
|
||||||
if (separate_debug_file_exists (debugfile, crc32, objfile))
|
if (separate_debug_file_exists (debugfile, crc32, objfile))
|
||||||
return debugfile;
|
return debugfile;
|
||||||
|
|
||||||
const char *base_path;
|
const char *base_path = NULL;
|
||||||
if (canon_dir != NULL
|
if (canon_dir != NULL)
|
||||||
&& (base_path = child_path (gdb_sysroot, canon_dir)) != NULL)
|
{
|
||||||
|
if (canon_sysroot.get () != NULL)
|
||||||
|
base_path = child_path (canon_sysroot.get (), canon_dir);
|
||||||
|
else
|
||||||
|
base_path = child_path (gdb_sysroot, canon_dir);
|
||||||
|
}
|
||||||
|
if (base_path != NULL)
|
||||||
{
|
{
|
||||||
/* If the file is in the sysroot, try using its base path in
|
/* If the file is in the sysroot, try using its base path in
|
||||||
the global debugfile directory. */
|
the global debugfile directory. */
|
||||||
|
|
Loading…
Reference in New Issue