const char *target_prefix_str = target_prefix ? TARGET_SYSROOT_PREFIX : "";
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
- = gdb_realpath (gdb_sysroot.c_str ());
+ const char *sysroot_str = gdb_sysroot.c_str ();
+ if (is_target_filename (sysroot_str) && target_filesystem_is_local ())
+ sysroot_str += strlen (TARGET_SYSROOT_PREFIX);
+ gdb::unique_xmalloc_ptr<char> canon_sysroot = gdb_realpath (sysroot_str);
/* MS-Windows/MS-DOS don't allow colons in file names; we must
convert the drive letter into a one-letter directory, so that the
return debugfile;
/* If the file is in the sysroot, try using its base path in
- the sysroot's global debugfile directory. GDB_SYSROOT
- might refer to a target: path; we strip the "target:"
- 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. */
+ the sysroot's global debugfile directory. */
if (gdb_sysroot != TARGET_SYSROOT_PREFIX)
{
- std::string root;
- if (is_target_filename (gdb_sysroot))
- {
- root = gdb_sysroot.substr (strlen (TARGET_SYSROOT_PREFIX));
- gdb_assert (!root.empty ());
- }
- else
- root = gdb_sysroot;
-
- debugfile = path_join (target_prefix_str, root.c_str (),
- debugdir.get (), base_path, debuglink);
+ debugfile = path_join (gdb_sysroot.c_str (), debugdir.get (),
+ base_path, debuglink);
if (separate_debug_file_exists (debugfile, crc32, objfile,
warnings))
# in the sysroot.
gdb_file_cmd ${sysroot_prefix}$exec_in_sysroot
- # Giving a sysroot a 'target:' prefix doesn't seem to work as
- # might be expected for debug-link based lookups. For this
- # style of lookup GDB only seems to care if the original file
- # itself had a 'target:' prefix. The 'target:' prefix on the
- # sysroot just seems to cause GDB to bail on looking up via
- # the 'target:' prefixed sysroot.
- #
- # Bug PR gdb/30866 seems to be the (or a) relevant bug for
- # this problem.
- if { $sysroot_prefix ne ""
- && [target_info gdb_protocol] ne "extended-remote" } {
- setup_kfail "*-*-*" 31804
- }
gdb_assert { $::gdb_file_cmd_debug_info eq "debug" } \
"ensure debug information was found"
- if { $sysroot_prefix ne ""
- && [target_info gdb_protocol] ne "extended-remote" } {
- setup_kfail "*-*-*" 31804
- }
set re [string_to_regexp "Reading symbols from ${sysroot_prefix}$debug_symlink..."]
gdb_assert {[regexp $re $::gdb_file_cmd_msg]} \
"debug symbols read from correct file"