Add target_ops argument to to_pid_to_exec_file
authorTom Tromey <tromey@redhat.com>
Wed, 18 Dec 2013 04:35:01 +0000 (21:35 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:45:56 +0000 (07:45 -0700)
2014-02-19  Tom Tromey  <tromey@redhat.com>

* windows-nat.c (windows_pid_to_exec_file): Add 'self' argument.
* target.h (struct target_ops) <to_pid_to_exec_file>: Add
argument.
(target_pid_to_exec_file): Add argument.
* target.c (debug_to_pid_to_exec_file): Add argument.
(update_current_target): Update.
* nbsd-nat.h (nbsd_pid_to_exec_file): Add 'self' argument.
* nbsd-nat.c (nbsd_pid_to_exec_file): Add 'self' argument.
* linux-nat.c (linux_child_pid_to_exec_file): Add 'self' argument.
(linux_handle_extended_wait): Update.
* inf-child.c (inf_child_pid_to_exec_file): Add 'self' argument.
* fbsd-nat.h (fbsd_pid_to_exec_file): Add 'self' argument.
* fbsd-nat.c (fbsd_pid_to_exec_file): Add 'self' argument.
* darwin-nat.c (darwin_pid_to_exec_file): Add 'self' argument.

gdb/ChangeLog
gdb/darwin-nat.c
gdb/fbsd-nat.c
gdb/fbsd-nat.h
gdb/inf-child.c
gdb/linux-nat.c
gdb/nbsd-nat.c
gdb/nbsd-nat.h
gdb/target.c
gdb/target.h
gdb/windows-nat.c

index 09b88f7..f9102b3 100644 (file)
@@ -1,5 +1,22 @@
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
+       * windows-nat.c (windows_pid_to_exec_file): Add 'self' argument.
+       * target.h (struct target_ops) <to_pid_to_exec_file>: Add
+       argument.
+       (target_pid_to_exec_file): Add argument.
+       * target.c (debug_to_pid_to_exec_file): Add argument.
+       (update_current_target): Update.
+       * nbsd-nat.h (nbsd_pid_to_exec_file): Add 'self' argument.
+       * nbsd-nat.c (nbsd_pid_to_exec_file): Add 'self' argument.
+       * linux-nat.c (linux_child_pid_to_exec_file): Add 'self' argument.
+       (linux_handle_extended_wait): Update.
+       * inf-child.c (inf_child_pid_to_exec_file): Add 'self' argument.
+       * fbsd-nat.h (fbsd_pid_to_exec_file): Add 'self' argument.
+       * fbsd-nat.c (fbsd_pid_to_exec_file): Add 'self' argument.
+       * darwin-nat.c (darwin_pid_to_exec_file): Add 'self' argument.
+
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
        * target.h (struct target_ops) <to_rcmd>: Add argument.
        (target_rcmd): Add argument.
        * target.c (debug_to_rcmd): Add argument.
index 9027010..6cbfc83 100644 (file)
@@ -1989,7 +1989,7 @@ set_enable_mach_exceptions (char *args, int from_tty,
 }
 
 static char *
-darwin_pid_to_exec_file (int pid)
+darwin_pid_to_exec_file (struct target_ops *self, int pid)
 {
   char *path;
   int res;
index 662fa55..43ee605 100644 (file)
@@ -37,7 +37,7 @@
    the child process identified by PID.  */
 
 char *
-fbsd_pid_to_exec_file (int pid)
+fbsd_pid_to_exec_file (struct target_ops *self, int pid)
 {
   size_t len = PATH_MAX;
   char *buf = xcalloc (len, sizeof (char));
index d9d1443..a048733 100644 (file)
@@ -23,7 +23,7 @@
 /* Return the name of a file that can be opened to get the symbols for
    the child process identified by PID.  */
 
-extern char *fbsd_pid_to_exec_file (int pid);
+extern char *fbsd_pid_to_exec_file (struct target_ops *self, int pid);
 
 /* Iterate over all the memory regions in the current inferior,
    calling FUNC for each memory region.  OBFD is passed as the last
index 37fac4b..e047636 100644 (file)
@@ -134,7 +134,7 @@ inf_child_can_run (struct target_ops *self)
 }
 
 static char *
-inf_child_pid_to_exec_file (int pid)
+inf_child_pid_to_exec_file (struct target_ops *self, int pid)
 {
   /* This version of Unix doesn't support translation of a process ID
      to the filename of the executable file.  */
index 50eef3a..9652692 100644 (file)
@@ -844,7 +844,7 @@ linux_nat_pass_signals (struct target_ops *self,
 /* Prototypes for local functions.  */
 static int stop_wait_callback (struct lwp_info *lp, void *data);
 static int linux_thread_alive (ptid_t ptid);
-static char *linux_child_pid_to_exec_file (int pid);
+static char *linux_child_pid_to_exec_file (struct target_ops *self, int pid);
 
 \f
 /* Convert wait status STATUS to a string.  Used for printing debug
@@ -2193,7 +2193,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status,
 
       ourstatus->kind = TARGET_WAITKIND_EXECD;
       ourstatus->value.execd_pathname
-       = xstrdup (linux_child_pid_to_exec_file (pid));
+       = xstrdup (linux_child_pid_to_exec_file (NULL, pid));
 
       return 0;
     }
@@ -4033,7 +4033,7 @@ linux_nat_thread_name (struct target_ops *self, struct thread_info *thr)
    can be opened to get the symbols for the child process.  */
 
 static char *
-linux_child_pid_to_exec_file (int pid)
+linux_child_pid_to_exec_file (struct target_ops *self, int pid)
 {
   char *name1, *name2;
 
index 347636f..72c471b 100644 (file)
@@ -25,7 +25,7 @@
    the child process identified by PID.  */
 
 char *
-nbsd_pid_to_exec_file (int pid)
+nbsd_pid_to_exec_file (struct target_ops *self, int pid)
 {
   size_t len = PATH_MAX;
   char *buf = xcalloc (len, sizeof (char));
index dc6a570..145505d 100644 (file)
@@ -23,6 +23,6 @@
 /* Return the name of a file that can be opened to get the symbols for
    the child process identified by PID.  */
 
-extern char *nbsd_pid_to_exec_file (int pid);
+extern char *nbsd_pid_to_exec_file (struct target_ops *self, int pid);
 
 #endif /* nbsd-nat.h */
index 3850494..7ffe2df 100644 (file)
@@ -831,7 +831,7 @@ update_current_target (void)
            (void (*) (struct target_ops *, char *, struct ui_file *))
            tcomplain);
   de_fault (to_pid_to_exec_file,
-           (char *(*) (int))
+           (char *(*) (struct target_ops *, int))
            return_null);
   de_fault (to_thread_architecture,
            default_thread_architecture);
@@ -5004,11 +5004,11 @@ debug_to_rcmd (struct target_ops *self, char *command,
 }
 
 static char *
-debug_to_pid_to_exec_file (int pid)
+debug_to_pid_to_exec_file (struct target_ops *self, int pid)
 {
   char *exec_file;
 
-  exec_file = debug_target.to_pid_to_exec_file (pid);
+  exec_file = debug_target.to_pid_to_exec_file (&debug_target, pid);
 
   fprintf_unfiltered (gdb_stdlog, "target_pid_to_exec_file (%d) = %s\n",
                      pid, exec_file);
index af8d834..d1bb68c 100644 (file)
@@ -527,7 +527,7 @@ struct target_ops
     void (*to_stop) (struct target_ops *, ptid_t);
     void (*to_rcmd) (struct target_ops *,
                     char *command, struct ui_file *output);
-    char *(*to_pid_to_exec_file) (int pid);
+    char *(*to_pid_to_exec_file) (struct target_ops *, int pid);
     void (*to_log_command) (const char *);
     struct target_section_table *(*to_get_section_table) (struct target_ops *);
     enum strata to_stratum;
@@ -1545,7 +1545,7 @@ extern char *target_thread_name (struct thread_info *);
    it must persist.  */
 
 #define target_pid_to_exec_file(pid) \
-     (current_target.to_pid_to_exec_file) (pid)
+     (current_target.to_pid_to_exec_file) (&current_target, pid)
 
 /* See the to_thread_architecture description in struct target_ops.  */
 
index 7514eb5..bc00c43 100644 (file)
@@ -1994,7 +1994,7 @@ windows_detach (struct target_ops *ops, const char *args, int from_tty)
 }
 
 static char *
-windows_pid_to_exec_file (int pid)
+windows_pid_to_exec_file (struct target_ops *self, int pid)
 {
   static char path[__PMAX];
 #ifdef __CYGWIN__