*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / inflow.c
index 16047b2f178a02e332c3a1a42f16d0da47ea4d2e..28ebf7d152db18b1d43bbf5f66a213233616c10d 100644 (file)
@@ -1,5 +1,6 @@
 /* Low level interface to ptrace, for GDB when running under Unix.
-   Copyright 1986-87, 1989, 1991-92, 1995, 1998 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+   1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -22,7 +23,6 @@
 #include "frame.h"
 #include "inferior.h"
 #include "command.h"
-#include "signals.h"
 #include "serial.h"
 #include "terminal.h"
 #include "target.h"
@@ -185,7 +185,7 @@ terminal_init_inferior_with_pgrp (int pgrp)
       /* We could just as well copy our_ttystate (if we felt like adding
          a new function SERIAL_COPY_TTY_STATE).  */
       if (inferior_ttystate)
-       free (inferior_ttystate);
+       xfree (inferior_ttystate);
       inferior_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
 
 #ifdef PROCESS_GROUP_TYPE
@@ -207,9 +207,9 @@ terminal_init_inferior (void)
      debugging target with a version of target_terminal_init_inferior which
      passes in the process group to a generic routine which does all the work
      (and the non-threaded child_terminal_init_inferior can just pass in
-     inferior_pid to the same routine).  */
+     inferior_ptid to the same routine).  */
   /* We assume INFERIOR_PID is also the child's process group.  */
-  terminal_init_inferior_with_pgrp (PIDGET (inferior_pid));
+  terminal_init_inferior_with_pgrp (PIDGET (inferior_ptid));
 #endif /* PROCESS_GROUP_TYPE */
 }
 
@@ -318,9 +318,11 @@ terminal_ours_1 (int output_only)
 
   if (!terminal_is_ours)
     {
+#ifdef SIGTTOU
       /* Ignore this signal since it will happen when we try to set the
          pgrp.  */
-      void (*osigttou) ();
+      void (*osigttou) () = NULL;
+#endif
       int result;
 
       terminal_is_ours = 1;
@@ -331,7 +333,7 @@ terminal_ours_1 (int output_only)
 #endif
 
       if (inferior_ttystate)
-       free (inferior_ttystate);
+       xfree (inferior_ttystate);
       inferior_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
 #ifdef HAVE_TERMIOS
       inferior_process_group = tcgetpgrp (0);
@@ -571,11 +573,11 @@ new_tty (void)
 static void
 kill_command (char *arg, int from_tty)
 {
-  /* FIXME:  This should not really be inferior_pid (or target_has_execution).
+  /* FIXME:  This should not really be inferior_ptid (or target_has_execution).
      It should be a distinct flag that indicates that a target is active, cuz
      some targets don't have processes! */
 
-  if (inferior_pid == 0)
+  if (ptid_equal (inferior_ptid, null_ptid))
     error ("The program is not being run.");
   if (!query ("Kill the program being debugged? "))
     error ("Not confirmed.");
@@ -603,7 +605,7 @@ static void
 pass_signal (int signo)
 {
 #ifndef _WIN32
-  kill (PIDGET (inferior_pid), SIGINT);
+  kill (PIDGET (inferior_ptid), SIGINT);
 #endif
 }
 
@@ -645,7 +647,7 @@ handle_sigio (int signo)
     {
 #ifndef _WIN32
       if ((*target_activity_function) ())
-       kill (inferior_pid, SIGINT);
+       kill (PIDGET (inferior_ptid), SIGINT);
 #endif
     }
 }
@@ -678,14 +680,14 @@ void
 set_sigio_trap (void)
 {
   if (target_activity_function)
-    abort ();
+    internal_error (__FILE__, __LINE__, "failed internal consistency check");
 }
 
 void
 clear_sigio_trap (void)
 {
   if (target_activity_function)
-    abort ();
+    internal_error (__FILE__, __LINE__, "failed internal consistency check");
 }
 #endif /* No SIGIO.  */
 \f
@@ -733,7 +735,7 @@ _initialize_inflow (void)
   add_com ("kill", class_run, kill_command,
           "Kill execution of program being debugged.");
 
-  inferior_pid = 0;
+  inferior_ptid = null_ptid;
 
   terminal_is_ours = 1;
 
This page took 0.025028 seconds and 4 git commands to generate.