Split size in regset section iterators
[deliverable/binutils-gdb.git] / gdb / linux-nat.c
index 86d3dfd2b894c1fb6b830742abd3a05f0aae78d1..64015e75207939f29d3cf499e6f3c1463b8b83e6 100644 (file)
@@ -445,7 +445,6 @@ linux_nat_target::follow_fork (int follow_child, int detach_fork)
   if (!follow_child)
     {
       struct lwp_info *child_lp = NULL;
-      int status = W_STOPCODE (0);
       int has_vforked;
       ptid_t parent_ptid, child_ptid;
       int parent_pid, child_pid;
@@ -465,6 +464,8 @@ linux_nat_target::follow_fork (int follow_child, int detach_fork)
       /* Detach new forked process?  */
       if (detach_fork)
        {
+         int child_stop_signal = 0;
+         bool detach_child = true;
          struct cleanup *old_chain = make_cleanup (delete_lwp_cleanup,
                                                    child_lp);
 
@@ -484,18 +485,24 @@ linux_nat_target::follow_fork (int follow_child, int detach_fork)
          if (!gdbarch_software_single_step_p (target_thread_architecture
                                               (parent_ptid)))
            {
+             int status;
+
              linux_disable_event_reporting (child_pid);
              if (ptrace (PTRACE_SINGLESTEP, child_pid, 0, 0) < 0)
                perror_with_name (_("Couldn't do single step"));
              if (my_waitpid (child_pid, &status, 0) < 0)
                perror_with_name (_("Couldn't wait vfork process"));
+             else
+               {
+                 detach_child = WIFSTOPPED (status);
+                 child_stop_signal = WSTOPSIG (status);
+               }
            }
 
-         if (WIFSTOPPED (status))
+         if (detach_child)
            {
-             int signo;
+             int signo = child_stop_signal;
 
-             signo = WSTOPSIG (status);
              if (signo != 0
                  && !signal_pass_state (gdb_signal_from_host (signo)))
                signo = 0;
@@ -3548,14 +3555,11 @@ linux_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 
   if (debug_linux_nat)
     {
-      char *options_string;
-
-      options_string = target_options_to_string (target_options);
+      std::string options_string = target_options_to_string (target_options);
       fprintf_unfiltered (gdb_stdlog,
                          "linux_nat_wait: [%s], [%s]\n",
                          target_pid_to_str (ptid),
-                         options_string);
-      xfree (options_string);
+                         options_string.c_str ());
     }
 
   /* Flush the async file first.  */
This page took 0.025027 seconds and 4 git commands to generate.