#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
#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)
#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 ();
}
}
\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)