Multi-target support
[deliverable/binutils-gdb.git] / gdb / gdbserver / fork-child.c
index 1002620759be428ac5cf26cc35dbc06a69cee6f4..7a71ec0b1cafbc7dddaafb1cccd4d42e0ab8353f 100644 (file)
@@ -1,5 +1,5 @@
 /* Fork a Unix child process, and set up to debug it, for GDBserver.
-   Copyright (C) 1989-2017 Free Software Foundation, Inc.
+   Copyright (C) 1989-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,7 +17,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "server.h"
-#include "job-control.h"
+#include "gdbsupport/job-control.h"
 #include "nat/fork-inferior.h"
 #ifdef HAVE_SIGNAL_H
 #include <signal.h>
@@ -44,6 +44,7 @@ restore_old_foreground_pgrp (void)
 void
 prefork_hook (const char *args)
 {
+  client_state &cs = get_client_state ();
   if (debug_threads)
     {
       debug_printf ("args: %s\n", args);
@@ -57,7 +58,7 @@ prefork_hook (const char *args)
 
   /* Clear this so the backend doesn't get confused, thinking
      CONT_THREAD died, and it needs to resume all threads.  */
-  cont_thread = null_ptid;
+  cs.cont_thread = null_ptid;
 }
 
 /* See nat/fork-inferior.h.  */
@@ -96,6 +97,7 @@ gdb_flush_out_err ()
 void
 post_fork_inferior (int pid, const char *program)
 {
+  client_state &cs = get_client_state ();
 #ifdef SIGTTOU
   signal (SIGTTOU, SIG_IGN);
   signal (SIGTTIN, SIG_IGN);
@@ -105,10 +107,11 @@ post_fork_inferior (int pid, const char *program)
   atexit (restore_old_foreground_pgrp);
 #endif
 
-  startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED,
-                   &last_status, &last_ptid);
+  startup_inferior (the_target, pid,
+                   START_INFERIOR_TRAPS_EXPECTED,
+                   &cs.last_status, &cs.last_ptid);
   current_thread->last_resume_kind = resume_stop;
-  current_thread->last_status = last_status;
+  current_thread->last_status = cs.last_status;
   signal_pid = pid;
   target_post_create_inferior ();
   fprintf (stderr, "Process %s created; pid = %d\n", program, pid);
This page took 0.027339 seconds and 4 git commands to generate.