aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-12-10 15:37:34 -0700
committerTom Tromey <tom@tromey.com>2023-12-11 09:04:42 -0700
commit9394690cb87b5ddc575b333bd0595b07a7a72c60 (patch)
tree789d8c7831d95c789241dd225cc52f1957c903ac /gdb/symfile.c
parent9a099bc220fbc97e9ccff6a7e1861e11665e8899 (diff)
downloadgdb-9394690cb87b5ddc575b333bd0595b07a7a72c60.zip
gdb-9394690cb87b5ddc575b333bd0595b07a7a72c60.tar.gz
gdb-9394690cb87b5ddc575b333bd0595b07a7a72c60.tar.bz2
Use TARGET_SYSROOT_PREFIX in more places
I found some spots using "target:"; I think it's better to use the define everywhere, so this changes these to use TARGET_SYSROOT_PREFIX. In some spots, is_target_filename is used rather than an explicit check. Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 09aa70b..2bfe36e 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1413,8 +1413,9 @@ find_separate_debug_file (const char *dir,
Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/..." lookups. */
- bool target_prefix = startswith (dir, "target:");
- const char *dir_notarget = target_prefix ? dir + strlen ("target:") : dir;
+ bool target_prefix = is_target_filename (dir);
+ const char *dir_notarget
+ = target_prefix ? dir + strlen (TARGET_SYSROOT_PREFIX) : dir;
std::vector<gdb::unique_xmalloc_ptr<char>> debugdir_vec
= dirnames_to_char_ptr_vec (debug_file_directory.c_str ());
gdb::unique_xmalloc_ptr<char> canon_sysroot
@@ -1443,7 +1444,7 @@ find_separate_debug_file (const char *dir,
for (const gdb::unique_xmalloc_ptr<char> &debugdir : debugdir_vec)
{
- debugfile = target_prefix ? "target:" : "";
+ debugfile = target_prefix ? TARGET_SYSROOT_PREFIX : "";
debugfile += debugdir;
debugfile += "/";
debugfile += drive;
@@ -1465,7 +1466,7 @@ find_separate_debug_file (const char *dir,
{
/* If the file is in the sysroot, try using its base path in
the global debugfile directory. */
- debugfile = target_prefix ? "target:" : "";
+ debugfile = target_prefix ? TARGET_SYSROOT_PREFIX : "";
debugfile += debugdir;
debugfile += "/";
debugfile += base_path;
@@ -1481,12 +1482,13 @@ find_separate_debug_file (const char *dir,
prefix -- but if that would yield the empty string, we
don't bother at all, because that would just give the
same result as above. */
- if (gdb_sysroot != "target:")
+ if (gdb_sysroot != TARGET_SYSROOT_PREFIX)
{
- debugfile = target_prefix ? "target:" : "";
- if (startswith (gdb_sysroot, "target:"))
+ debugfile = target_prefix ? TARGET_SYSROOT_PREFIX : "";
+ if (is_target_filename (gdb_sysroot))
{
- std::string root = gdb_sysroot.substr (strlen ("target:"));
+ std::string root
+ = gdb_sysroot.substr (strlen (TARGET_SYSROOT_PREFIX));
gdb_assert (!root.empty ());
debugfile += root;
}