+2013-09-27 Pedro Alves <palves@redhat.com>
+
+ * remote.h (REMOTE_SYSROOT_PREFIX): New define.
+ (remote_filename_p): Add comment.
+ * remote.c (remote_filename_p): Adjust to use
+ REMOTE_SYSROOT_PREFIX.
+ * solib.c (solib_find): When deciding whether we need to add a
+ directory separator, check whether the sysroot is "remote:"
+ instead of checking whether the patch has a drive spec. Add
+ comments.
+
2013-09-27 Pedro Alves <palves@redhat.com>
* remote.c (struct stop_reply) <solibs_changed, replay_event>:
int
remote_filename_p (const char *filename)
{
- return strncmp (filename, "remote:", 7) == 0;
+ return strncmp (filename,
+ REMOTE_SYSROOT_PREFIX,
+ sizeof (REMOTE_SYSROOT_PREFIX) - 1) == 0;
}
bfd *
bfd *remote_bfd_open (const char *remote_file, const char *target);
+/* If a path starts with this sequence, GDB will retrieve the target
+ libraries from the remote system. */
+
+#define REMOTE_SYSROOT_PREFIX "remote:"
+
+/* True if FILENAME starts with REMOTE_SYSROOT_PREFIX. */
+
int remote_filename_p (const char *filename);
extern int remote_register_number_and_offset (struct gdbarch *gdbarch,
{
int need_dir_separator;
- need_dir_separator = (!IS_DIR_SEPARATOR (in_pathname[0])
- && !HAS_TARGET_DRIVE_SPEC (fskind, in_pathname));
+ /* Concatenate the sysroot and the target reported filename. We
+ may need to glue them with a directory separator. Cases to
+ consider:
+
+ | sysroot | separator | in_pathname |
+ |-----------------+-----------+----------------|
+ | /some/dir | / | c:/foo/bar.dll |
+ | /some/dir | | /foo/bar.dll |
+ | remote: | | c:/foo/bar.dll |
+ | remote: | | /foo/bar.dll |
+ | remote:some/dir | / | c:/foo/bar.dll |
+ | remote:some/dir | | /foo/bar.dll |
+
+ IOW, we don't need to add a separator if IN_PATHNAME already
+ has one, or when the the sysroot is exactly "remote:".
+ There's no need to check for drive spec explicitly, as we only
+ get here if IN_PATHNAME is considered an absolute path. */
+ need_dir_separator = !(IS_DIR_SEPARATOR (in_pathname[0])
+ || strcmp (REMOTE_SYSROOT_PREFIX, sysroot) == 0);
/* Cat the prefixed pathname together. */
temp_pathname = concat (sysroot,