From: Tom Tromey Date: Wed, 18 Dec 2013 04:38:46 +0000 (-0700) Subject: Add target_ops argument to to_fileio_pread X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a3be983cee10c1bcd7cda582c3bb91c065ad97a2;p=binutils-gdb.git 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c041549d53b..aa018e8a0ca 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +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. diff --git a/gdb/inf-child.c b/gdb/inf-child.c index 6486b2c77f8..8837fd8c331 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 ae8c5236085..814f945f8c1 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 ace183387bc..00083c22a0d 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 02b66d7ee67..eb83cb95cd6 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