diff options
author | Gary Benson <gbenson@redhat.com> | 2015-08-21 17:09:20 +0100 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2015-08-21 17:11:36 +0100 |
commit | 4313b8c0ed5877feb5034bfff4056e1ccfe221f1 (patch) | |
tree | b5585d614337ee376a5dc247272d846254e1dc88 /gdb/remote.c | |
parent | f36b87190aed31b1ef7787e5966be542e8abdb58 (diff) | |
download | gdb-4313b8c0ed5877feb5034bfff4056e1ccfe221f1.zip gdb-4313b8c0ed5877feb5034bfff4056e1ccfe221f1.tar.gz gdb-4313b8c0ed5877feb5034bfff4056e1ccfe221f1.tar.bz2 |
Warn when accessing binaries from remote targets
GDB provides no indicator of progress during file operations, and can
appear to have locked up during slow remote transfers. This commit
updates GDB to print a warning each time a file is accessed over RSP.
An additional message detailing how to avoid remote transfers is
printed for the first transfer only.
gdb/ChangeLog:
* target.h (struct target_ops) <to_fileio_open>: New argument
warn_if_slow. Update comment. All implementations updated.
(target_fileio_open_warn_if_slow): New declaration.
* target.c (target_fileio_open): Renamed as...
(target_fileio_open_1): ...this. New argument warn_if_slow.
Pass warn_if_slow to implementation. Update debug printing.
(target_fileio_open): New function.
(target_fileio_open_warn_if_slow): Likewise.
* gdb_bfd.c (gdb_bfd_iovec_fileio_open): Use new function
target_fileio_open_warn_if_slow.
gdb/testsuite/ChangeLog:
* gdb.trace/pending.exp: Cope with remote transfer warnings.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r-- | gdb/remote.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index 068d079..12294bc 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -10498,12 +10498,29 @@ remote_hostio_set_filesystem (struct inferior *inf, int *remote_errno) static int remote_hostio_open (struct target_ops *self, struct inferior *inf, const char *filename, - int flags, int mode, int *remote_errno) + int flags, int mode, int warn_if_slow, + int *remote_errno) { struct remote_state *rs = get_remote_state (); char *p = rs->buf; int left = get_remote_packet_size () - 1; + if (warn_if_slow) + { + static int warning_issued = 0; + + printf_unfiltered (_("Reading %s from remote target...\n"), + filename); + + if (!warning_issued) + { + warning (_("File transfers from remote targets can be slow." + " Use \"set sysroot\" to access files locally" + " instead.")); + warning_issued = 1; + } + } + if (remote_hostio_set_filesystem (inf, remote_errno) != 0) return -1; @@ -10827,7 +10844,7 @@ remote_filesystem_is_local (struct target_ops *self) filename is irrelevant, we only care about whether the stub recognizes the packet or not. */ fd = remote_hostio_open (self, NULL, "just probing", - FILEIO_O_RDONLY, 0700, + FILEIO_O_RDONLY, 0700, 0, &remote_errno); if (fd >= 0) @@ -10949,7 +10966,7 @@ remote_file_put (const char *local_file, const char *remote_file, int from_tty) fd = remote_hostio_open (find_target_at (process_stratum), NULL, remote_file, (FILEIO_O_WRONLY | FILEIO_O_CREAT | FILEIO_O_TRUNC), - 0700, &remote_errno); + 0700, 0, &remote_errno); if (fd == -1) remote_hostio_error (remote_errno); @@ -11033,7 +11050,8 @@ remote_file_get (const char *remote_file, const char *local_file, int from_tty) error (_("command can only be used with remote target")); fd = remote_hostio_open (find_target_at (process_stratum), NULL, - remote_file, FILEIO_O_RDONLY, 0, &remote_errno); + remote_file, FILEIO_O_RDONLY, 0, 0, + &remote_errno); if (fd == -1) remote_hostio_error (remote_errno); |