use _filtered routines for printing so symbolic addresses show up in the right place
[deliverable/binutils-gdb.git] / gdb / hppabsd-xdep.c
index ca3d10e610ff863a7effeaeb936b7fc4670760c5..bec14c4c4b5352536dcc079b95da05d531b77750 100644 (file)
@@ -1,6 +1,6 @@
 /* Machine-dependent code which would otherwise be in infptrace.c,
    for GDB, the GNU debugger.  This code is for the HP PA-RISC cpu.
-   Copyright (C) 1986, 1987, 1989, 1990, 1991 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
 
    Contributed by the Center for Software Science at the
    University of Utah (pa-gdb-bugs@cs.utah.edu).
@@ -24,7 +24,6 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-#include <stdio.h>
 #include "defs.h"
 #include "frame.h"
 #include "inferior.h"
@@ -60,7 +59,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
    machine-dependent file. */
 int
 call_ptrace (request, pid, addr, data)
-     int request, pid, *addr, data;
+     int request, pid;
+     PTRACE_ARG3_TYPE addr;
+     int data;
 {
   return ptrace (request, pid, addr, data);
 }
@@ -71,21 +72,13 @@ 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, inferior_pid, 0, 0);
+  ptrace (PT_KILL, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0);
   wait ((int *)0);
-}
-
-void
-kill_inferior ()
-{
-  kill_inferior_fast ();
   target_mourn_inferior ();
 }
 
@@ -100,14 +93,14 @@ child_resume (step, signal)
 {
   errno = 0;
 
-  /* An address of (int *)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.)  */
+  /* 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.)  */
 
   if (step)
-    ptrace (PT_STEP, inferior_pid, (int *)1, signal);
+    ptrace (PT_STEP, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal);
   else
-    ptrace (PT_CONTINUE, inferior_pid, (int *)1, signal);
+    ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal);
 
   if (errno)
     perror_with_name ("ptrace");
@@ -124,7 +117,7 @@ attach (pid)
      int pid;
 {
   errno = 0;
-  ptrace (PT_ATTACH, pid, 0, 0);
+  ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0);
   if (errno)
     perror_with_name ("ptrace");
   attach_flag = 1;
@@ -140,7 +133,7 @@ detach (signal)
      int signal;
 {
   errno = 0;
-  ptrace (PT_DETACH, inferior_pid, 1, signal);
+  ptrace (PT_DETACH, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal);
   if (errno)
     perror_with_name ("ptrace");
   attach_flag = 0;
@@ -202,7 +195,8 @@ void _initialize_kernel_u_addr ()
 #if !defined (U_REGS_OFFSET)
 #define U_REGS_OFFSET \
   ptrace (PT_READ_U, inferior_pid, \
-          (int *)(offsetof (struct user, u_ar0)), 0) - KERNEL_U_ADDR
+          (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \
+    - KERNEL_U_ADDR
 #endif
 
 /* Registers we shouldn't try to fetch.  */
@@ -237,7 +231,8 @@ fetch_register (regno)
   for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
     {
       errno = 0;
-      *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid, (int *)regaddr, 0);
+      *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid,
+                                (PTRACE_ARG3_TYPE) regaddr, 0);
       regaddr += sizeof (int);
       if (errno != 0)
        {
@@ -290,7 +285,7 @@ store_inferior_registers (regno)
       for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
        {
          errno = 0;
-         ptrace (PT_WRITE_U, inferior_pid, (int *)regaddr,
+         ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
                  *(int *) &registers[REGISTER_BYTE (regno) + i]);
          if (errno != 0)
            {
@@ -310,7 +305,7 @@ store_inferior_registers (regno)
          for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
            {
              errno = 0;
-             ptrace (PT_WRITE_U, inferior_pid, (int *)regaddr,
+             ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
                      *(int *) &registers[REGISTER_BYTE (regno) + i]);
              if (errno != 0)
                {
@@ -363,14 +358,16 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
 
       if (addr != memaddr || len < (int)sizeof (int)) {
        /* Need part of initial word -- fetch it.  */
-        buffer[0] = ptrace (PT_READ_I, inferior_pid, (int *)addr, 0);
+        buffer[0] = ptrace (PT_READ_I, inferior_pid, (PTRACE_ARG3_TYPE) addr,
+                           0);
       }
 
       if (count > 1)           /* FIXME, avoid if even boundary */
        {
          buffer[count - 1]
            = ptrace (PT_READ_I, inferior_pid,
-                     (int *)(addr + (count - 1) * sizeof (int)), 0);
+                     (PTRACE_ARG3_TYPE) (addr + (count - 1) * sizeof (int)),
+                     0);
        }
 
       /* Copy data to be written over corresponding part of buffer */
@@ -382,13 +379,15 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
       for (i = 0; i < count; i++, addr += sizeof (int))
        {
          errno = 0;
-         ptrace (PT_WRITE_D, inferior_pid, (int *)addr, buffer[i]);
+         ptrace (PT_WRITE_D, inferior_pid, (PTRACE_ARG3_TYPE) addr,
+                 buffer[i]);
          if (errno)
            {
              /* Using the appropriate one (I or D) is necessary for
                 Gould NP1, at least.  */
              errno = 0;
-             ptrace (PT_WRITE_I, inferior_pid, (int *)addr, buffer[i]);
+             ptrace (PT_WRITE_I, inferior_pid, (PTRACE_ARG3_TYPE) addr,
+                     buffer[i]);
            }
          if (errno)
            return 0;
@@ -400,7 +399,8 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
       for (i = 0; i < count; i++, addr += sizeof (int))
        {
          errno = 0;
-         buffer[i] = ptrace (PT_READ_I, inferior_pid, (int *)addr, 0);
+         buffer[i] = ptrace (PT_READ_I, inferior_pid,
+                             (PTRACE_ARG3_TYPE) addr, 0);
          if (errno)
            return 0;
          QUIT;
@@ -411,7 +411,3 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
     }
   return len;
 }
-
-
-
-
This page took 0.025469 seconds and 4 git commands to generate.