* remote.c (struct remote_state): Add BUF and BUF_SIZE.
[deliverable/binutils-gdb.git] / gdb / infptrace.c
index a9abbf2c39ad903479e0e924ecb33b68f7699bd5..46d656d234df66a01d18fd34c6221e10dea4580d 100644 (file)
@@ -1,5 +1,5 @@
 /* Low level Unix child interface to ptrace, for GDB when running under Unix.
-   Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+   Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
    1998, 1999, 2000, 2001, 2002, 2004
    Free Software Foundation, Inc.
 
@@ -17,8 +17,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 #include "defs.h"
 #include "command.h"
@@ -54,97 +54,25 @@ static void udot_info (char *, int);
 void _initialize_infptrace (void);
 \f
 
-/* This function simply calls ptrace with the given arguments.  
-   It exists so that all calls to ptrace are isolated in this 
-   machine-dependent file. */
 int
 call_ptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data)
 {
-  int pt_status = 0;
-
-#if 0
-  int saved_errno;
-
-  printf ("call_ptrace(request=%d, pid=%d, addr=0x%x, data=0x%x)",
-         request, pid, addr, data);
-#endif
-#if defined(PT_SETTRC)
-  /* If the parent can be told to attach to us, try to do it.  */
-  if (request == PT_SETTRC)
-    {
-      errno = 0;
-#ifndef PTRACE_TYPE_ARG5
-      pt_status = ptrace (PT_SETTRC, pid, addr, data);
-#else
-      /* Deal with HPUX 8.0 braindamage.  We never use the
-         calls which require the fifth argument.  */
-      pt_status = ptrace (PT_SETTRC, pid, addr, data, 0);
-#endif
-      if (errno)
-       perror_with_name ("ptrace");
-#if 0
-      printf (" = %d\n", pt_status);
-#endif
-      if (pt_status < 0)
-       return pt_status;
-      else
-       return parent_attach_all (pid, addr, data);
-    }
-#endif
-
-#if defined(PT_CONTIN1)
-  /* On HPUX, PT_CONTIN1 is a form of continue that preserves pending
-     signals.  If it's available, use it.  */
-  if (request == PT_CONTINUE)
-    request = PT_CONTIN1;
-#endif
-
-#if defined(PT_SINGLE1)
-  /* On HPUX, PT_SINGLE1 is a form of step that preserves pending
-     signals.  If it's available, use it.  */
-  if (request == PT_STEP)
-    request = PT_SINGLE1;
-#endif
-
-#if 0
-  saved_errno = errno;
-  errno = 0;
-#endif
-#ifndef PTRACE_TYPE_ARG5
-  pt_status = ptrace (request, pid, addr, data);
-#else
-  /* Deal with HPUX 8.0 braindamage.  We never use the
-     calls which require the fifth argument.  */
-  pt_status = ptrace (request, pid, addr, data, 0);
-#endif
-
-#if 0
-  if (errno)
-    printf (" [errno = %d]", errno);
-
-  errno = saved_errno;
-  printf (" = 0x%x\n", pt_status);
-#endif
-  return pt_status;
+  return ptrace (request, pid, addr, data);
 }
 
-
-#if defined (DEBUG_PTRACE) || defined (PTRACE_TYPE_ARG5)
-/* For the rest of the file, use an extra level of indirection */
-/* This lets us breakpoint usefully on call_ptrace. */
-#define ptrace call_ptrace
-#endif
-
 /* Wait for a process to finish, possibly running a target-specific
    hook before returning.  */
 
+/* NOTE: cagney: 2004-09-29: Dependant on the native configuration,
+   "hppah-nat.c" may either call this or infttrace.c's implementation
+   of ptrace_wait.  See "hppahpux.mh".  */
+
 int
 ptrace_wait (ptid_t ptid, int *status)
 {
   int wstate;
 
   wstate = wait (status);
-  target_post_wait (pid_to_ptid (wstate), *status);
   return wstate;
 }
 
@@ -171,7 +99,7 @@ kill_inferior (void)
      The kill call causes problems under hpux10, so it's been removed;
      if this causes problems we'll deal with them as they arise.  */
   ptrace (PT_KILL, pid, (PTRACE_TYPE_ARG3) 0, 0);
-  ptrace_wait (null_ptid, &status);
+  wait (&status);
   target_mourn_inferior ();
 }
 #endif /* DEPRECATED_KILL_INFERIOR */
@@ -216,7 +144,7 @@ child_resume (ptid_t ptid, int step, enum target_signal signal)
   errno = 0;
   ptrace (request, pid, (PTRACE_TYPE_ARG3)1, target_signal_to_host (signal));
   if (errno != 0)
-    perror_with_name ("ptrace");
+    perror_with_name (("ptrace"));
 }
 #endif /* DEPRECATED_CHILD_RESUME */
 \f
@@ -230,11 +158,11 @@ attach (int pid)
   errno = 0;
   ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3) 0, 0);
   if (errno != 0)
-    perror_with_name ("ptrace");
+    perror_with_name (("ptrace"));
   attach_flag = 1;
   return pid;
 #else
-  error ("This system does not support attaching to a process");
+  error (_("This system does not support attaching to a process"));
 #endif
 }
 
@@ -250,10 +178,10 @@ detach (int signal)
   errno = 0;
   ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3) 1, signal);
   if (errno != 0)
-    perror_with_name ("ptrace");
+    perror_with_name (("ptrace"));
   attach_flag = 0;
 #else
-  error ("This system does not support detaching from a process");
+  error (_("This system does not support detaching from a process"));
 #endif
 }
 \f
@@ -307,7 +235,7 @@ fetch_register (int regnum)
       errno = 0;
       buf[i] = ptrace (PT_READ_U, tid, (PTRACE_TYPE_ARG3) addr, 0);
       if (errno != 0)
-       error ("Couldn't read register %s (#%d): %s.", REGISTER_NAME (regnum),
+       error (_("Couldn't read register %s (#%d): %s."), REGISTER_NAME (regnum),
               regnum, safe_strerror (errno));
 
       addr += sizeof (PTRACE_TYPE_RET);
@@ -360,8 +288,8 @@ store_register (int regnum)
       errno = 0;
       ptrace (PT_WRITE_U, tid, (PTRACE_TYPE_ARG3) addr, buf[i]);
       if (errno != 0)
-       error ("Couldn't write register %s (#%d): %s.", REGISTER_NAME (regnum),
-              regnum, safe_strerror (errno));
+       error (_("Couldn't write register %s (#%d): %s."),
+              REGISTER_NAME (regnum), regnum, safe_strerror (errno));
 
       addr += sizeof (PTRACE_TYPE_RET);
     }
@@ -400,11 +328,11 @@ store_inferior_registers (int regnum)
 
    Returns the length copied, which is either the LEN argument or
    zero.  This xfer function does not do partial moves, since
-   child_ops doesn't allow memory operations to cross below us in the
-   target stack anyway.  */
+   deprecated_child_ops doesn't allow memory operations to cross below
+   us in the target stack anyway.  */
 
 int
-child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+child_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
                   struct mem_attrib *attrib, struct target_ops *target)
 {
   int i;
@@ -536,7 +464,7 @@ udot_info (char *dummy1, int dummy2)
 
   if (!target_has_execution)
     {
-      error ("The program is not being run.");
+      error (_("The program is not being run."));
     }
 
 #if !defined (KERNEL_U_SIZE)
@@ -545,7 +473,7 @@ udot_info (char *dummy1, int dummy2)
      routine, called "kernel_u_size" that returns the size of the user
      struct, to the appropriate *-nat.c file and then add to the native
      config file "#define KERNEL_U_SIZE kernel_u_size()" */
-  error ("Don't know how large ``struct user'' is in this version of gdb.");
+  error (_("Don't know how large ``struct user'' is in this version of gdb."));
 
 #else
 
@@ -581,6 +509,6 @@ _initialize_infptrace (void)
 {
 #if !defined (CHILD_XFER_MEMORY)
   add_info ("udot", udot_info,
-           "Print contents of kernel ``struct user'' for current child.");
+           _("Print contents of kernel ``struct user'' for current child."));
 #endif
 }
This page took 0.029082 seconds and 4 git commands to generate.