From: Tom Tromey Date: Wed, 18 Dec 2013 04:38:21 +0000 (-0700) Subject: Add target_ops argument to to_fileio_open X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cd897586764fedd7c5dec6266fcda7b1699015d1;p=binutils-gdb.git Add target_ops argument to to_fileio_open 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add argument. * target.c (target_fileio_open): Add argument. * remote.c (remote_hostio_open): Add 'self' argument. (remote_bfd_iovec_open): Add 'self' argument. (remote_file_put): Add 'self' argument. (remote_file_get): Add 'self' argument. * inf-child.c (inf_child_fileio_open): Add 'self' argument. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8b262faf6c4..fcbaa36eeed 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2014-02-19 Tom Tromey + + * target.h (struct target_ops) : Add argument. + * target.c (target_fileio_open): Add argument. + * remote.c (remote_hostio_open): Add 'self' argument. + (remote_bfd_iovec_open): Add 'self' argument. + (remote_file_put): Add 'self' argument. + (remote_file_get): Add 'self' argument. + * inf-child.c (inf_child_fileio_open): Add 'self' argument. + 2014-02-19 Tom Tromey * target.h (struct target_ops) : diff --git a/gdb/inf-child.c b/gdb/inf-child.c index e0476368881..cd2aee64ab6 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -231,7 +231,8 @@ inf_child_errno_to_fileio_error (int errnum) target file descriptor, or -1 if an error occurs (and set *TARGET_ERRNO). */ static int -inf_child_fileio_open (const char *filename, int flags, int mode, +inf_child_fileio_open (struct target_ops *self, + const char *filename, int flags, int mode, int *target_errno) { int nat_flags; diff --git a/gdb/remote.c b/gdb/remote.c index b62b5f2660a..a01ca463ded 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -9655,7 +9655,8 @@ remote_hostio_send_command (int command_bytes, int which_packet, *REMOTE_ERRNO). */ static int -remote_hostio_open (const char *filename, int flags, int mode, +remote_hostio_open (struct target_ops *self, + const char *filename, int flags, int mode, int *remote_errno) { struct remote_state *rs = get_remote_state (); @@ -9901,7 +9902,8 @@ remote_bfd_iovec_open (struct bfd *abfd, void *open_closure) gdb_assert (remote_filename_p (filename)); - fd = remote_hostio_open (filename + 7, FILEIO_O_RDONLY, 0, &remote_errno); + fd = remote_hostio_open (find_target_at (process_stratum), + filename + 7, FILEIO_O_RDONLY, 0, &remote_errno); if (fd == -1) { errno = remote_fileio_errno_to_host (remote_errno); @@ -10007,7 +10009,8 @@ remote_file_put (const char *local_file, const char *remote_file, int from_tty) perror_with_name (local_file); back_to = make_cleanup_fclose (file); - fd = remote_hostio_open (remote_file, (FILEIO_O_WRONLY | FILEIO_O_CREAT + fd = remote_hostio_open (find_target_at (process_stratum), + remote_file, (FILEIO_O_WRONLY | FILEIO_O_CREAT | FILEIO_O_TRUNC), 0700, &remote_errno); if (fd == -1) @@ -10091,7 +10094,8 @@ remote_file_get (const char *remote_file, const char *local_file, int from_tty) if (!rs->remote_desc) error (_("command can only be used with remote target")); - fd = remote_hostio_open (remote_file, FILEIO_O_RDONLY, 0, &remote_errno); + fd = remote_hostio_open (find_target_at (process_stratum), + remote_file, FILEIO_O_RDONLY, 0, &remote_errno); if (fd == -1) remote_hostio_error (remote_errno); diff --git a/gdb/target.c b/gdb/target.c index bf4a513ad90..fbec3b92259 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3372,7 +3372,7 @@ target_fileio_open (const char *filename, int flags, int mode, { if (t->to_fileio_open != NULL) { - int fd = t->to_fileio_open (filename, flags, mode, target_errno); + int fd = t->to_fileio_open (t, filename, flags, mode, target_errno); if (targetdebug) fprintf_unfiltered (gdb_stdlog, diff --git a/gdb/target.h b/gdb/target.h index c809c1babed..68b3aeebe4b 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -716,7 +716,8 @@ struct target_ops /* Open FILENAME on the target, using FLAGS and MODE. Return a target file descriptor, or -1 if an error occurs (and set *TARGET_ERRNO). */ - int (*to_fileio_open) (const char *filename, int flags, int mode, + int (*to_fileio_open) (struct target_ops *, + const char *filename, int flags, int mode, int *target_errno); /* Write up to LEN bytes from WRITE_BUF to FD on the target.