From a3be983cee10c1bcd7cda582c3bb91c065ad97a2 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 17 Dec 2013 21:38:46 -0700 Subject: [PATCH] Add target_ops argument to to_fileio_pread 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add argument. * target.c (target_fileio_pread): Add argument. * remote.c (remote_hostio_pread): Add 'self' argument. (remote_bfd_iovec_pread, remote_file_get): Update. * inf-child.c (inf_child_fileio_pread): Add 'self' argument. --- gdb/ChangeLog | 8 ++++++++ gdb/inf-child.c | 3 ++- gdb/remote.c | 9 ++++++--- gdb/target.c | 2 +- gdb/target.h | 3 ++- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c041549..aa018e8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2014-02-19 Tom Tromey + * target.h (struct target_ops) : Add argument. + * target.c (target_fileio_pread): Add argument. + * remote.c (remote_hostio_pread): Add 'self' argument. + (remote_bfd_iovec_pread, remote_file_get): Update. + * inf-child.c (inf_child_fileio_pread): Add 'self' argument. + +2014-02-19 Tom Tromey + * target.h (struct target_ops) : Add argument. * target.c (target_fileio_pwrite): Add argument. * remote.c (remote_hostio_pwrite): Add 'self' argument. diff --git a/gdb/inf-child.c b/gdb/inf-child.c index 6486b2c..8837fd8 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -286,7 +286,8 @@ inf_child_fileio_pwrite (struct target_ops *self, Return the number of bytes read, or -1 if an error occurs (and set *TARGET_ERRNO). */ static int -inf_child_fileio_pread (int fd, gdb_byte *read_buf, int len, +inf_child_fileio_pread (struct target_ops *self, + int fd, gdb_byte *read_buf, int len, ULONGEST offset, int *target_errno) { int ret; diff --git a/gdb/remote.c b/gdb/remote.c index ae8c523..814f945 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -9712,7 +9712,8 @@ remote_hostio_pwrite (struct target_ops *self, set *REMOTE_ERRNO). */ static int -remote_hostio_pread (int fd, gdb_byte *read_buf, int len, +remote_hostio_pread (struct target_ops *self, + int fd, gdb_byte *read_buf, int len, ULONGEST offset, int *remote_errno) { struct remote_state *rs = get_remote_state (); @@ -9944,7 +9945,8 @@ remote_bfd_iovec_pread (struct bfd *abfd, void *stream, void *buf, pos = 0; while (nbytes > pos) { - bytes = remote_hostio_pread (fd, (gdb_byte *) buf + pos, nbytes - pos, + bytes = remote_hostio_pread (find_target_at (process_stratum), + fd, (gdb_byte *) buf + pos, nbytes - pos, offset + pos, &remote_errno); if (bytes == 0) /* Success, but no bytes, means end-of-file. */ @@ -10117,7 +10119,8 @@ remote_file_get (const char *remote_file, const char *local_file, int from_tty) offset = 0; while (1) { - bytes = remote_hostio_pread (fd, buffer, io_size, offset, &remote_errno); + bytes = remote_hostio_pread (find_target_at (process_stratum), + fd, buffer, io_size, offset, &remote_errno); if (bytes == 0) /* Success, but no bytes, means end-of-file. */ break; diff --git a/gdb/target.c b/gdb/target.c index ace1833..00083c2 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3430,7 +3430,7 @@ target_fileio_pread (int fd, gdb_byte *read_buf, int len, { if (t->to_fileio_pread != NULL) { - int ret = t->to_fileio_pread (fd, read_buf, len, offset, + int ret = t->to_fileio_pread (t, fd, read_buf, len, offset, target_errno); if (targetdebug) diff --git a/gdb/target.h b/gdb/target.h index 02b66d7..eb83cb9 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -730,7 +730,8 @@ struct target_ops /* Read up to LEN bytes FD on the target into READ_BUF. Return the number of bytes read, or -1 if an error occurs (and set *TARGET_ERRNO). */ - int (*to_fileio_pread) (int fd, gdb_byte *read_buf, int len, + int (*to_fileio_pread) (struct target_ops *, + int fd, gdb_byte *read_buf, int len, ULONGEST offset, int *target_errno); /* Close FD on the target. Return 0, or -1 if an error occurs -- 2.7.4