aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2015-08-21 17:09:20 +0100
committerGary Benson <gbenson@redhat.com>2015-08-21 17:11:36 +0100
commit4313b8c0ed5877feb5034bfff4056e1ccfe221f1 (patch)
treeb5585d614337ee376a5dc247272d846254e1dc88 /gdb/target.c
parentf36b87190aed31b1ef7787e5966be542e8abdb58 (diff)
downloadgdb-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/target.c')
-rw-r--r--gdb/target.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/gdb/target.c b/gdb/target.c
index e41a338..a0a55d9 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -2779,11 +2779,13 @@ release_fileio_fd (int fd, fileio_fh_t *fh)
#define fileio_fd_to_fh(fd) \
VEC_index (fileio_fh_t, fileio_fhandles, (fd))
-/* See target.h. */
+/* Helper for target_fileio_open and
+ target_fileio_open_warn_if_slow. */
-int
-target_fileio_open (struct inferior *inf, const char *filename,
- int flags, int mode, int *target_errno)
+static int
+target_fileio_open_1 (struct inferior *inf, const char *filename,
+ int flags, int mode, int warn_if_slow,
+ int *target_errno)
{
struct target_ops *t;
@@ -2792,7 +2794,7 @@ target_fileio_open (struct inferior *inf, const char *filename,
if (t->to_fileio_open != NULL)
{
int fd = t->to_fileio_open (t, inf, filename, flags, mode,
- target_errno);
+ warn_if_slow, target_errno);
if (fd < 0)
fd = -1;
@@ -2801,11 +2803,12 @@ target_fileio_open (struct inferior *inf, const char *filename,
if (targetdebug)
fprintf_unfiltered (gdb_stdlog,
- "target_fileio_open (%d,%s,0x%x,0%o)"
+ "target_fileio_open (%d,%s,0x%x,0%o,%d)"
" = %d (%d)\n",
inf == NULL ? 0 : inf->num,
filename, flags, mode,
- fd, fd != -1 ? 0 : *target_errno);
+ warn_if_slow, fd,
+ fd != -1 ? 0 : *target_errno);
return fd;
}
}
@@ -2817,6 +2820,27 @@ target_fileio_open (struct inferior *inf, const char *filename,
/* See target.h. */
int
+target_fileio_open (struct inferior *inf, const char *filename,
+ int flags, int mode, int *target_errno)
+{
+ return target_fileio_open_1 (inf, filename, flags, mode, 0,
+ target_errno);
+}
+
+/* See target.h. */
+
+int
+target_fileio_open_warn_if_slow (struct inferior *inf,
+ const char *filename,
+ int flags, int mode, int *target_errno)
+{
+ return target_fileio_open_1 (inf, filename, flags, mode, 1,
+ target_errno);
+}
+
+/* See target.h. */
+
+int
target_fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
ULONGEST offset, int *target_errno)
{