Add target_ops argument to to_supports_non_stop
[deliverable/binutils-gdb.git] / gdb / target.c
index 699b55e9d4b84d631f202abbb8064df0eb8bf628..0fc4e869a1b115754bb24134dba9a37a52308fd2 100644 (file)
@@ -144,9 +144,9 @@ static void debug_to_terminal_ours (struct target_ops *self);
 
 static void debug_to_load (struct target_ops *self, char *, int);
 
-static int debug_to_can_run (void);
+static int debug_to_can_run (struct target_ops *self);
 
-static void debug_to_stop (ptid_t);
+static void debug_to_stop (struct target_ops *self, ptid_t);
 
 /* Pointer to array of target architecture structures; the size of the
    array; the current index into the array; the allocated size of the
@@ -792,45 +792,46 @@ update_current_target (void)
            (void (*) (struct target_ops *, ptid_t))
            target_ignore);
   de_fault (to_insert_fork_catchpoint,
-           (int (*) (int))
+           (int (*) (struct target_ops *, int))
            return_one);
   de_fault (to_remove_fork_catchpoint,
-           (int (*) (int))
+           (int (*) (struct target_ops *, int))
            return_one);
   de_fault (to_insert_vfork_catchpoint,
-           (int (*) (int))
+           (int (*) (struct target_ops *, int))
            return_one);
   de_fault (to_remove_vfork_catchpoint,
-           (int (*) (int))
+           (int (*) (struct target_ops *, int))
            return_one);
   de_fault (to_insert_exec_catchpoint,
-           (int (*) (int))
+           (int (*) (struct target_ops *, int))
            return_one);
   de_fault (to_remove_exec_catchpoint,
-           (int (*) (int))
+           (int (*) (struct target_ops *, int))
            return_one);
   de_fault (to_set_syscall_catchpoint,
-           (int (*) (int, int, int, int, int *))
+           (int (*) (struct target_ops *, int, int, int, int, int *))
            return_one);
   de_fault (to_has_exited,
-           (int (*) (int, int, int *))
+           (int (*) (struct target_ops *, int, int, int *))
            return_zero);
   de_fault (to_can_run,
+           (int (*) (struct target_ops *))
            return_zero);
   de_fault (to_extra_thread_info,
-           (char *(*) (struct thread_info *))
+           (char *(*) (struct target_ops *, struct thread_info *))
            return_null);
   de_fault (to_thread_name,
-           (char *(*) (struct thread_info *))
+           (char *(*) (struct target_ops *, struct thread_info *))
            return_null);
   de_fault (to_stop,
-           (void (*) (ptid_t))
+           (void (*) (struct target_ops *, ptid_t))
            target_ignore);
   de_fault (to_rcmd,
-           (void (*) (char *, struct ui_file *))
+           (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);
@@ -2770,7 +2771,7 @@ target_thread_name (struct thread_info *info)
   for (t = current_target.beneath; t != NULL; t = t->beneath)
     {
       if (t->to_thread_name != NULL)
-       return (*t->to_thread_name) (info);
+       return (*t->to_thread_name) (t, info);
     }
 
   return NULL;
@@ -2820,7 +2821,7 @@ target_pass_signals (int numsigs, unsigned char *pass_signals)
              fprintf_unfiltered (gdb_stdlog, " })\n");
            }
 
-         (*t->to_pass_signals) (numsigs, pass_signals);
+         (*t->to_pass_signals) (t, numsigs, pass_signals);
          return;
        }
     }
@@ -2850,7 +2851,7 @@ target_program_signals (int numsigs, unsigned char *program_signals)
              fprintf_unfiltered (gdb_stdlog, " })\n");
            }
 
-         (*t->to_program_signals) (numsigs, program_signals);
+         (*t->to_program_signals) (t, numsigs, program_signals);
          return;
        }
     }
@@ -3211,13 +3212,13 @@ find_default_is_async_p (struct target_ops *ignore)
 }
 
 static int
-find_default_supports_non_stop (void)
+find_default_supports_non_stop (struct target_ops *self)
 {
   struct target_ops *t;
 
   t = find_default_run_target (NULL);
   if (t && t->to_supports_non_stop)
-    return (t->to_supports_non_stop) ();
+    return (t->to_supports_non_stop) (t);
   return 0;
 }
 
@@ -3228,7 +3229,7 @@ target_supports_non_stop (void)
 
   for (t = &current_target; t != NULL; t = t->beneath)
     if (t->to_supports_non_stop)
-      return t->to_supports_non_stop ();
+      return t->to_supports_non_stop (t);
 
   return 0;
 }
@@ -3924,7 +3925,7 @@ target_stop (ptid_t ptid)
       return;
     }
 
-  (*current_target.to_stop) (ptid);
+  (*current_target.to_stop) (&current_target, ptid);
 }
 
 static void
@@ -4866,11 +4867,11 @@ debug_to_post_startup_inferior (struct target_ops *self, ptid_t ptid)
 }
 
 static int
-debug_to_insert_fork_catchpoint (int pid)
+debug_to_insert_fork_catchpoint (struct target_ops *self, int pid)
 {
   int retval;
 
-  retval = debug_target.to_insert_fork_catchpoint (pid);
+  retval = debug_target.to_insert_fork_catchpoint (&debug_target, pid);
 
   fprintf_unfiltered (gdb_stdlog, "target_insert_fork_catchpoint (%d) = %d\n",
                      pid, retval);
@@ -4879,11 +4880,11 @@ debug_to_insert_fork_catchpoint (int pid)
 }
 
 static int
-debug_to_remove_fork_catchpoint (int pid)
+debug_to_remove_fork_catchpoint (struct target_ops *self, int pid)
 {
   int retval;
 
-  retval = debug_target.to_remove_fork_catchpoint (pid);
+  retval = debug_target.to_remove_fork_catchpoint (&debug_target, pid);
 
   fprintf_unfiltered (gdb_stdlog, "target_remove_fork_catchpoint (%d) = %d\n",
                      pid, retval);
@@ -4892,11 +4893,11 @@ debug_to_remove_fork_catchpoint (int pid)
 }
 
 static int
-debug_to_insert_vfork_catchpoint (int pid)
+debug_to_insert_vfork_catchpoint (struct target_ops *self, int pid)
 {
   int retval;
 
-  retval = debug_target.to_insert_vfork_catchpoint (pid);
+  retval = debug_target.to_insert_vfork_catchpoint (&debug_target, pid);
 
   fprintf_unfiltered (gdb_stdlog, "target_insert_vfork_catchpoint (%d) = %d\n",
                      pid, retval);
@@ -4905,11 +4906,11 @@ debug_to_insert_vfork_catchpoint (int pid)
 }
 
 static int
-debug_to_remove_vfork_catchpoint (int pid)
+debug_to_remove_vfork_catchpoint (struct target_ops *self, int pid)
 {
   int retval;
 
-  retval = debug_target.to_remove_vfork_catchpoint (pid);
+  retval = debug_target.to_remove_vfork_catchpoint (&debug_target, pid);
 
   fprintf_unfiltered (gdb_stdlog, "target_remove_vfork_catchpoint (%d) = %d\n",
                      pid, retval);
@@ -4918,11 +4919,11 @@ debug_to_remove_vfork_catchpoint (int pid)
 }
 
 static int
-debug_to_insert_exec_catchpoint (int pid)
+debug_to_insert_exec_catchpoint (struct target_ops *self, int pid)
 {
   int retval;
 
-  retval = debug_target.to_insert_exec_catchpoint (pid);
+  retval = debug_target.to_insert_exec_catchpoint (&debug_target, pid);
 
   fprintf_unfiltered (gdb_stdlog, "target_insert_exec_catchpoint (%d) = %d\n",
                      pid, retval);
@@ -4931,11 +4932,11 @@ debug_to_insert_exec_catchpoint (int pid)
 }
 
 static int
-debug_to_remove_exec_catchpoint (int pid)
+debug_to_remove_exec_catchpoint (struct target_ops *self, int pid)
 {
   int retval;
 
-  retval = debug_target.to_remove_exec_catchpoint (pid);
+  retval = debug_target.to_remove_exec_catchpoint (&debug_target, pid);
 
   fprintf_unfiltered (gdb_stdlog, "target_remove_exec_catchpoint (%d) = %d\n",
                      pid, retval);
@@ -4944,11 +4945,13 @@ debug_to_remove_exec_catchpoint (int pid)
 }
 
 static int
-debug_to_has_exited (int pid, int wait_status, int *exit_status)
+debug_to_has_exited (struct target_ops *self,
+                    int pid, int wait_status, int *exit_status)
 {
   int has_exited;
 
-  has_exited = debug_target.to_has_exited (pid, wait_status, exit_status);
+  has_exited = debug_target.to_has_exited (&debug_target,
+                                          pid, wait_status, exit_status);
 
   fprintf_unfiltered (gdb_stdlog, "target_has_exited (%d, %d, %d) = %d\n",
                      pid, wait_status, *exit_status, has_exited);
@@ -4957,11 +4960,11 @@ debug_to_has_exited (int pid, int wait_status, int *exit_status)
 }
 
 static int
-debug_to_can_run (void)
+debug_to_can_run (struct target_ops *self)
 {
   int retval;
 
-  retval = debug_target.to_can_run ();
+  retval = debug_target.to_can_run (&debug_target);
 
   fprintf_unfiltered (gdb_stdlog, "target_can_run () = %d\n", retval);
 
@@ -4984,28 +4987,28 @@ debug_to_thread_architecture (struct target_ops *ops, ptid_t ptid)
 }
 
 static void
-debug_to_stop (ptid_t ptid)
+debug_to_stop (struct target_ops *self, ptid_t ptid)
 {
-  debug_target.to_stop (ptid);
+  debug_target.to_stop (&debug_target, ptid);
 
   fprintf_unfiltered (gdb_stdlog, "target_stop (%s)\n",
                      target_pid_to_str (ptid));
 }
 
 static void
-debug_to_rcmd (char *command,
+debug_to_rcmd (struct target_ops *self, char *command,
               struct ui_file *outbuf)
 {
-  debug_target.to_rcmd (command, outbuf);
+  debug_target.to_rcmd (&debug_target, command, outbuf);
   fprintf_unfiltered (gdb_stdlog, "target_rcmd (%s, ...)\n", 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);
@@ -5072,10 +5075,11 @@ do_monitor_command (char *cmd,
                 int from_tty)
 {
   if ((current_target.to_rcmd
-       == (void (*) (char *, struct ui_file *)) tcomplain)
+       == (void (*) (struct target_ops *, char *, struct ui_file *)) tcomplain)
       || (current_target.to_rcmd == debug_to_rcmd
          && (debug_target.to_rcmd
-             == (void (*) (char *, struct ui_file *)) tcomplain)))
+             == (void (*) (struct target_ops *,
+                           char *, struct ui_file *)) tcomplain)))
     error (_("\"monitor\" command not supported by this target."));
   target_rcmd (cmd, gdb_stdtarg);
 }
This page took 0.029993 seconds and 4 git commands to generate.