sun386 host/target/native separation
[deliverable/binutils-gdb.git] / gdb / arm-xdep.c
index b3979748abf55595b2abe87f05d2f9e7d4326399..64aa0d8c33da7813ce9151b46a63e46ca15e7753 100644 (file)
@@ -3,27 +3,25 @@
 
 This file is part of GDB.
 
-GDB is free software; you can redistribute it and/or modify
+This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
 
-GDB is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GDB; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "defs.h"
-#include "param.h"
 #include "frame.h"
 #include "inferior.h"
 #include "arm-opcode.h"
 
-#include <stdio.h>
 #include <sys/param.h>
 #include <sys/dir.h>
 #include <signal.h>
@@ -44,38 +42,41 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 void
 fetch_inferior_registers (regno)
-     int regno;
+     int regno;                /* Original value discarded */
 {
-  register int regno;
   register unsigned int regaddr;
   char buf[MAX_REGISTER_RAW_SIZE];
   register int i;
 
   struct user u;
   unsigned int offset = (char *) &u.u_ar0 - (char *) &u;
-  offset = ptrace (PT_READ_U, inferior_pid, offset, 0) - KERNEL_U_ADDR;
+  offset = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0)
+      - KERNEL_U_ADDR;
 
   registers_fetched ();
   
   for (regno = 0; regno < 16; regno++)
     {
       regaddr = offset + regno * 4;
-      *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid, regaddr, 0);
+      *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid,
+                               (PTRACE_ARG3_TYPE) regaddr, 0);
       if (regno == PC_REGNUM)
          *(int *)&buf[0] = GET_PC_PART(*(int *)&buf[0]);
       supply_register (regno, buf);
     }
-  *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid, offset + PC*4);
+  *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid,
+                           (PTRACE_ARG3_TYPE) (offset + PC*4), 0);
   supply_register (PS_REGNUM, buf); /* set virtual register ps same as pc */
 
   /* read the floating point registers */
   offset = (char *) &u.u_fp_regs - (char *)&u;
-  *(int *)buf = ptrace (PT_READ_U, inferior_pid, offset, 0);
+  *(int *)buf = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0);
   supply_register (FPS_REGNUM, buf);
   for (regno = 16; regno < 24; regno++) {
       regaddr = offset + 4 + 12 * (regno - 16);
       for (i = 0; i < 12; i += sizeof(int))
-         *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid, regaddr + i, 0);
+         *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid,
+                                    (PTRACE_ARG3_TYPE) (regaddr + i), 0);
       supply_register (regno, buf);
   }
 }
@@ -84,6 +85,7 @@ fetch_inferior_registers (regno)
    If REGNO is -1, do this for all registers.
    Otherwise, REGNO specifies which register (so we can save time).  */
 
+void
 store_inferior_registers (regno)
      int regno;
 {
@@ -93,7 +95,8 @@ store_inferior_registers (regno)
   struct user u;
   unsigned long value;
   unsigned int offset = (char *) &u.u_ar0 - (char *) &u;
-  offset = ptrace (PT_READ_U, inferior_pid, offset, 0) - KERNEL_U_ADDR;
+  offset = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0)
+      - KERNEL_U_ADDR;
 
   if (regno >= 0) {
       if (regno >= 16) return;
@@ -102,7 +105,7 @@ store_inferior_registers (regno)
       value = read_register(regno);
       if (regno == PC_REGNUM)
          value = SET_PC_PART(read_register (PS_REGNUM), value);
-      ptrace (PT_WRITE_U, inferior_pid, regaddr, value);
+      ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value);
       if (errno != 0)
        {
          sprintf (buf, "writing register number %d", regno);
@@ -116,7 +119,7 @@ store_inferior_registers (regno)
       value = read_register(regno);
       if (regno == PC_REGNUM)
          value = SET_PC_PART(read_register (PS_REGNUM), value);
-      ptrace (6, inferior_pid, regaddr, value);
+      ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value);
       if (errno != 0)
        {
          sprintf (buf, "writing all regs, number %d", regno);
@@ -261,7 +264,7 @@ core_file_command (filename, from_tty)
        corefile = savestring (filename, strlen (filename));
       else
        {
-         corefile = concat (current_directory, "/", filename);
+         corefile = concat (current_directory, "/", filename, NULL);
        }
 
       set_current_frame ( create_new_frame (read_register (FP_REGNUM),
This page took 0.026709 seconds and 4 git commands to generate.