* i387-tdep.c (print_i387_value): Cast &value to (char *) in
[deliverable/binutils-gdb.git] / gdb / linux-thread.c
index df982a6f77775cef700812b7b1f1c06e2d0bacb3..146481c6ac8eaed9126371453767ab700795d728 100644 (file)
@@ -47,18 +47,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    linuxthreads package heavily relies on wait() synchronization to keep
    them correct.  */
 
+#include "defs.h"
 #include <sys/types.h> /* for pid_t */
 #include <sys/ptrace.h> /* for PT_* flags */
-#include <sys/wait.h> /* for WUNTRACED and __WCLONE flags */
+#include "gdb_wait.h" /* for WUNTRACED and __WCLONE flags */
 #include <signal.h> /* for struct sigaction and NSIG */
 #include <sys/utsname.h>
 
-#include "defs.h"
 #include "target.h"
 #include "inferior.h"
 #include "gdbcore.h"
 #include "gdbthread.h"
-#include "wait.h"
 #include "gdbcmd.h"
 #include "breakpoint.h"
 
@@ -379,25 +378,22 @@ linuxthreads_find_trap (pid, stop)
 
 /* Cleanup stub for save_inferior_pid.  */
 static void
-restore_inferior_pid (arg)
-    void *arg;
+restore_inferior_pid (void *arg)
 {
-#if TARGET_PTR_BIT > TARGET_INT_BIT
-  inferior_pid = (int) ((long) arg);
-#else
-  inferior_pid = (int) arg;
-#endif
+  int *saved_pid_ptr = arg;
+  inferior_pid = *saved_pid_ptr;
+  free (arg);
 }
 
 /* Register a cleanup to restore the value of inferior_pid.  */
 static struct cleanup *
-save_inferior_pid ()
+save_inferior_pid (void)
 {
-#if TARGET_PTR_BIT > TARGET_INT_BIT
-  return make_cleanup (restore_inferior_pid, (void *) ((long) inferior_pid));
-#else
-  return make_cleanup (restore_inferior_pid, (void *) inferior_pid);
-#endif
+  int *saved_pid_ptr;
+  
+  saved_pid_ptr = xmalloc (sizeof (int));
+  *saved_pid_ptr = inferior_pid;
+  return make_cleanup (restore_inferior_pid, saved_pid_ptr);
 }
 
 static void
@@ -1130,7 +1126,7 @@ linuxthreads_attach (args, from_tty)
   linuxthreads_breakpoints_inserted = 1;
   linuxthreads_breakpoint_last = -1;
   linuxthreads_wait_last = -1;
-  linuxthreads_exit_status = __W_STOPCODE(0);
+  WSETSTOP (linuxthreads_exit_status, 0);
 
   child_ops.to_attach (args, from_tty);
 
@@ -1190,7 +1186,7 @@ linuxthreads_detach (args, from_tty)
          linuxthreads_find_trap (inferior_pid, 1);
 
          linuxthreads_wait_last = -1;
-         linuxthreads_exit_status = __W_STOPCODE(0);
+         WSETSTOP (linuxthreads_exit_status, 0);
        }
 
       linuxthreads_inferior_pid = 0;
@@ -1602,7 +1598,7 @@ Use the \"file\" or \"exec-file\" command.");
   linuxthreads_breakpoints_inserted = 1;
   linuxthreads_breakpoint_last = -1;
   linuxthreads_wait_last = -1;
-  linuxthreads_exit_status = __W_STOPCODE(0);
+  WSETSTOP (linuxthreads_exit_status, 0);
   
   if (linuxthreads_max)
     linuxthreads_attach_pending = 1;
@@ -1800,4 +1796,6 @@ _initialize_linuxthreads ()
   sigprocmask(SIG_BLOCK, 
              &linuxthreads_wait_mask, 
              &linuxthreads_block_mask);
+  /* Make sure that linuxthreads_block_mask is not blocking SIGCHLD */
+  sigdelset (&linuxthreads_block_mask, SIGCHLD);
 }
This page took 0.026583 seconds and 4 git commands to generate.