From cd897586764fedd7c5dec6266fcda7b1699015d1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 17 Dec 2013 21:38:21 -0700 Subject: [PATCH] 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. --- gdb/ChangeLog | 10 ++++++++++ gdb/inf-child.c | 3 ++- gdb/remote.c | 12 ++++++++---- gdb/target.c | 2 +- gdb/target.h | 3 ++- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8b262faf6c..fcbaa36eee 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 e047636888..cd2aee64ab 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 b62b5f2660..a01ca463de 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 bf4a513ad9..fbec3b9225 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 c809c1babe..68b3aeebe4 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. -- 2.34.1