mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-01 09:49:43 +08:00
Use child_path to determine if an object file is under a sysroot.
This fixes the case where the sysroot happens to end in a trailing '/'. Note that the path returned from child_path always skips over the directory separator at the start of the base path, so a separator must always be explicitly added before the base path. gdb/ChangeLog: * symfile.c (find_separate_debug_file): Use child_path to determine if an object file is under a sysroot.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2019-02-12 John Baldwin <jhb@FreeBSD.org>
|
||||||
|
|
||||||
|
* symfile.c (find_separate_debug_file): Use child_path to
|
||||||
|
determine if an object file is under a sysroot.
|
||||||
|
|
||||||
2019-02-12 John Baldwin <jhb@FreeBSD.org>
|
2019-02-12 John Baldwin <jhb@FreeBSD.org>
|
||||||
|
|
||||||
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
|
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
#include "gdb_bfd.h"
|
#include "gdb_bfd.h"
|
||||||
#include "cli/cli-utils.h"
|
#include "cli/cli-utils.h"
|
||||||
#include "common/byte-vector.h"
|
#include "common/byte-vector.h"
|
||||||
|
#include "common/pathstuff.h"
|
||||||
#include "common/selftest.h"
|
#include "common/selftest.h"
|
||||||
#include "cli/cli-style.h"
|
#include "cli/cli-style.h"
|
||||||
#include "common/forward-scope-exit.h"
|
#include "common/forward-scope-exit.h"
|
||||||
@ -1452,16 +1453,16 @@ 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;
|
||||||
if (canon_dir != NULL
|
if (canon_dir != NULL
|
||||||
&& filename_ncmp (canon_dir, gdb_sysroot,
|
&& (base_path = child_path (gdb_sysroot, canon_dir)) != NULL)
|
||||||
strlen (gdb_sysroot)) == 0
|
|
||||||
&& IS_DIR_SEPARATOR (canon_dir[strlen (gdb_sysroot)]))
|
|
||||||
{
|
{
|
||||||
/* 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. */
|
||||||
debugfile = target_prefix ? "target:" : "";
|
debugfile = target_prefix ? "target:" : "";
|
||||||
debugfile += debugdir.get ();
|
debugfile += debugdir.get ();
|
||||||
debugfile += (canon_dir + strlen (gdb_sysroot));
|
debugfile += "/";
|
||||||
|
debugfile += base_path;
|
||||||
debugfile += "/";
|
debugfile += "/";
|
||||||
debugfile += debuglink;
|
debugfile += debuglink;
|
||||||
|
|
||||||
@ -1473,7 +1474,8 @@ find_separate_debug_file (const char *dir,
|
|||||||
debugfile = target_prefix ? "target:" : "";
|
debugfile = target_prefix ? "target:" : "";
|
||||||
debugfile += gdb_sysroot;
|
debugfile += gdb_sysroot;
|
||||||
debugfile += debugdir.get ();
|
debugfile += debugdir.get ();
|
||||||
debugfile += (canon_dir + strlen (gdb_sysroot));
|
debugfile += "/";
|
||||||
|
debugfile += base_path;
|
||||||
debugfile += "/";
|
debugfile += "/";
|
||||||
debugfile += debuglink;
|
debugfile += debuglink;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user