* breakpoint.c, breakpoint.h (breakpoint_init_inferior): New function
[deliverable/binutils-gdb.git] / gdb / infptrace.c
index 3856b3694386d8adbc1fe75406ade36ec646d169..aafbd85f64f42f0edd9f89b366b992410489c280 100644 (file)
@@ -30,13 +30,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <sys/dir.h>
 #include <signal.h>
 #include <sys/ioctl.h>
-#ifndef USG
+
+#ifndef NO_PTRACE_H
 #ifdef PTRACE_IN_WRONG_PLACE
 #include <ptrace.h>
 #else
 #include <sys/ptrace.h>
 #endif
-#endif
+#endif /* NO_PTRACE_H */
 
 #if !defined (PT_KILL)
 #define PT_KILL 8
@@ -63,6 +64,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #endif
 #include <sys/stat.h>
 
+#if defined (FIVE_ARG_PTRACE
+/* Deal with HPUX 8.0 braindamage.  */
+#define ptrace(a,b,c,d) ptrace(a,b,c,d,0)
+#endif
+
 #if !defined (FETCH_INFERIOR_REGISTERS)
 #include <sys/user.h>          /* Probably need to poke the user structure */
 #if defined (KERNEL_U_ADDR_BSD)
@@ -89,21 +95,16 @@ call_ptrace (request, pid, addr, data)
 #define ptrace call_ptrace
 #endif
 
-/* This is used when GDB is exiting.  It gives less chance of error.*/
-
 void
-kill_inferior_fast ()
+kill_inferior ()
 {
   if (inferior_pid == 0)
     return;
+  /* ptrace PT_KILL only works if process is stopped!!!  So stop it with
+     a real signal first, if we can.  */
+  kill (inferior_pid, SIGKILL);
   ptrace (PT_KILL, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0);
   wait ((int *)0);
-}
-
-void
-kill_inferior ()
-{
-  kill_inferior_fast ();
   target_mourn_inferior ();
 }
 
@@ -120,30 +121,23 @@ child_resume (step, signal)
 
   /* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where
      it was.  (If GDB wanted it to start some other way, we have already
-     written a new PC value to the child.)  */
+     written a new PC value to the child.)
+
+     If this system does not support PT_STEP, a higher level function will
+     have called single_step() to transmute the step request into a
+     continue request (by setting breakpoints on all possible successor
+     instructions), so we don't have to worry about that here.  */
 
   if (step)
-#ifdef NO_SINGLE_STEP
-    single_step (signal);
-#else    
-    ptrace (PT_STEP, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal);
-#endif
+    ptrace (PT_STEP,     inferior_pid, (PTRACE_ARG3_TYPE) 1, signal);
   else
-#ifdef AIX_BUGGY_PTRACE_CONTINUE
-    AIX_BUGGY_PTRACE_CONTINUE;
-#else
     ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal);
-#endif
 
   if (errno)
     perror_with_name ("ptrace");
 }
 \f
 #ifdef ATTACH_DETACH
-/* Nonzero if we are debugging an attached process rather than
-   an inferior.  */
-extern int attach_flag;
-
 /* Start debugging the process whose number is PID.  */
 int
 attach (pid)
This page took 0.0239 seconds and 4 git commands to generate.