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.
This commit is contained in:
Gary Benson
2015-08-21 17:09:20 +01:00
parent f36b87190a
commit 4313b8c0ed
9 changed files with 97 additions and 24 deletions

View File

@ -873,11 +873,14 @@ struct target_ops
/* Open FILENAME on the target, in the filesystem as seen by INF,
using FLAGS and MODE. If INF is NULL, use the filesystem seen
by the debugger (GDB or, for remote targets, the remote stub).
Return a target file descriptor, or -1 if an error occurs (and
set *TARGET_ERRNO). */
If WARN_IF_SLOW is nonzero, print a warning message if the file
is being accessed over a link that may be slow. Return a
target file descriptor, or -1 if an error occurs (and set
*TARGET_ERRNO). */
int (*to_fileio_open) (struct target_ops *,
struct inferior *inf, const char *filename,
int flags, int mode, int *target_errno);
int flags, int mode, int warn_if_slow,
int *target_errno);
/* Write up to LEN bytes from WRITE_BUF to FD on the target.
Return the number of bytes written, or -1 if an error occurs
@ -2007,6 +2010,14 @@ extern int target_fileio_open (struct inferior *inf,
const char *filename, int flags,
int mode, int *target_errno);
/* Like target_fileio_open, but print a warning message if the
file is being accessed over a link that may be slow. */
extern int target_fileio_open_warn_if_slow (struct inferior *inf,
const char *filename,
int flags,
int mode,
int *target_errno);
/* Write up to LEN bytes from WRITE_BUF to FD on the target.
Return the number of bytes written, or -1 if an error occurs
(and set *TARGET_ERRNO). */