Add target_ops argument to to_fileio_open
authorTom Tromey <tromey@redhat.com>
Wed, 18 Dec 2013 04:38:21 +0000 (21:38 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:46:10 +0000 (07:46 -0700)
2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_fileio_open>: 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
gdb/inf-child.c
gdb/remote.c
gdb/target.c
gdb/target.h

index 8b262faf6c4292c8be0c1c43dd896780141e8b98..fcbaa36eeedece73542bc98874a889e51cd6e52b 100644 (file)
@@ -1,3 +1,13 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * target.h (struct target_ops) <to_fileio_open>: 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  <tromey@redhat.com>
 
        * target.h (struct target_ops) <to_can_run_breakpoint_commands>:
index e0476368881641dafb2e726fb9431e1c7465519f..cd2aee64ab6539097e67a44feb25336c21feb39e 100644 (file)
@@ -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;
index b62b5f2660a88034b3dbca3748c7dbb6cd00d99d..a01ca463ded51754754a75e8d717e9e175a852f0 100644 (file)
@@ -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);
 
index bf4a513ad9031e048ca21182a3860b57602cb950..fbec3b92259677ed601c54845f9f2f9e17197208 100644 (file)
@@ -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,
index c809c1babed776217375bdafd7cda1cecc6d3436..68b3aeebe4b12b9a22b8122d97647b4a5d580deb 100644 (file)
@@ -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.
This page took 0.037878 seconds and 4 git commands to generate.