2002-11-13 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / fork-child.c
index a32ab8eb1fd47f6e240c1be1e91c9b44bd63b8d5..aacd53cac713c2db3174c7b19cc7adfafe58f0c2 100644 (file)
@@ -89,7 +89,7 @@ breakup_args (char *scratch, char **argv)
 }
 
 
-/* Start an inferior Unix child process and sets inferior_pid to its pid.
+/* Start an inferior Unix child process and sets inferior_ptid to its pid.
    EXEC_FILE is the file to run.
    ALLARGS is a string containing the arguments to the program.
    ENV is the environment vector to pass.  SHELL_FILE is the shell file,
@@ -183,6 +183,7 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
          switch (*p)
            {
            case '\'':
+           case '!':
            case '"':
            case '(':
            case ')':
@@ -214,6 +215,8 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
            {
              if (*p == '\'')
                strcat (shell_command, "'\\''");
+             else if (*p == '!')
+               strcat (shell_command, "\\!");
              else
                strncat (shell_command, p, 1);
            }
@@ -253,6 +256,9 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
   if (pre_trace_fun != NULL)
     (*pre_trace_fun) ();
 
+  /* Create the child process.  Note that the apparent call to vfork()
+     below *might* actually be a call to fork() due to the fact that
+     autoconf will ``#define vfork fork'' on certain platforms.  */
   if (debug_fork)
     pid = fork ();
   else
@@ -352,7 +358,7 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
 
   init_thread_list ();
 
-  inferior_pid = pid;          /* Needed for wait_for_inferior stuff below */
+  inferior_ptid = pid_to_ptid (pid);   /* Needed for wait_for_inferior stuff below */
 
   /* Now that we have a child process, make it our target, and
      initialize anything target-vector-specific that needs initializing.  */
@@ -385,8 +391,6 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
 void
 clone_and_follow_inferior (int child_pid, int *followed_child)
 {
-  extern int auto_solib_add;
-
   int debugger_pid;
   int status;
   char pid_spelling[100];      /* Arbitrary but sufficient length. */
@@ -420,15 +424,13 @@ clone_and_follow_inferior (int child_pid, int *followed_child)
   if (status < 0)
     error ("error getting pipe for handoff semaphore");
 
-  /* Clone the debugger. */
-#ifdef HAVE_VFORK
+  /* Clone the debugger.  Note that the apparent call to vfork()
+     below *might* actually be a call to fork() due to the fact that
+     autoconf will ``#define vfork fork'' on certain platforms.  */
   if (debug_fork)
     debugger_pid = fork ();
   else
     debugger_pid = vfork ();
-#else
-  debugger_pid = fork ();
-#endif
 
   if (debugger_pid < 0)
     perror_with_name ("fork");
@@ -461,7 +463,7 @@ clone_and_follow_inferior (int child_pid, int *followed_child)
        sleep (debug_fork);
 
       /* The child (i.e., the cloned debugger) must now attach to
-         CHILD_PID.  inferior_pid is presently set to the parent process
+         CHILD_PID.  inferior_ptid is presently set to the parent process
          of the fork, while CHILD_PID should be the child process of the
          fork.
 
@@ -470,10 +472,10 @@ clone_and_follow_inferior (int child_pid, int *followed_child)
        */
       read (handoff_semaphore[SEM_LISTEN], &listen_value, sizeof (listen_value));
 
-      /* Note that we DON'T want to actually detach from inferior_pid,
+      /* Note that we DON'T want to actually detach from inferior_ptid,
          because that would allow it to run free.  The original
          debugger wants to retain control of the process.  So, we
-         just reset inferior_pid to CHILD_PID, and then ensure that all
+         just reset inferior_ptid to CHILD_PID, and then ensure that all
          breakpoints are really set in CHILD_PID.
        */
       target_mourn_inferior ();
This page took 0.024852 seconds and 4 git commands to generate.