* dsrec.c (load_srec, make_srec): Use bfd_get_section_size instead of
[binutils-gdb.git] / gdb / infptrace.c
index ef86f90cf2ea0280ccc5b1801452398bdab338b0..f40e6e97703905891437646dcfc3e6c7808c0a2e 100644 (file)
 #define PT_KILL                8       /* Send child a SIGKILL signal */
 #endif
 
-#ifndef PT_ATTACH
-#define PT_ATTACH PTRACE_ATTACH
-#endif
-#ifndef PT_DETACH
-#define PT_DETACH PTRACE_DETACH
-#endif
-
 #include "gdbcore.h"
 #ifndef        NO_SYS_FILE
 #include <sys/file.h>
@@ -279,18 +272,25 @@ child_resume (ptid_t ptid, int step, enum target_signal signal)
 }
 #endif /* CHILD_RESUME */
 \f
-
-#ifdef ATTACH_DETACH
 /* Start debugging the process whose number is PID.  */
 int
 attach (int pid)
 {
   errno = 0;
+#ifndef PT_ATTACH
+#ifdef PTRACE_ATTACH
+#define PT_ATTACH PTRACE_ATTACH
+#endif
+#endif
+#ifdef PT_ATTACH
   ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0);
   if (errno)
     perror_with_name ("ptrace");
   attach_flag = 1;
   return pid;
+#else
+  error ("This system does not support attaching to a process");
+#endif
 }
 
 /* Stop debugging the process whose number is PID
@@ -301,13 +301,21 @@ void
 detach (int signal)
 {
   errno = 0;
+#ifndef PT_DETACH
+#ifdef PTRACE_DETACH
+#define PT_DETACH PTRACE_DETACH
+#endif
+#endif
+#ifdef PT_DETACH
   ptrace (PT_DETACH, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) 1,
           signal);
   if (errno)
     print_sys_errmsg ("ptrace", errno);
   attach_flag = 0;
+#else
+  error ("This system does not support detaching from a process");
+#endif
 }
-#endif /* ATTACH_DETACH */
 \f
 /* Default the type of the ptrace transfer to int.  */
 #ifndef PTRACE_XFER_TYPE
@@ -598,9 +606,6 @@ child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
          if (errno)
            return 0;
        }
-#ifdef CLEAR_INSN_CACHE
-      CLEAR_INSN_CACHE ();
-#endif
     }
   else
     {