* A few more improvements to gx jit prototype.
[deliverable/binutils-gdb.git] / gdb / sparc-nat.c
index 3f2768307cee87b8cf2923046c5d9c02f94b8e96..3f5f8bf748ca1711c0415c6575638b9411ed1d41 100644 (file)
@@ -1,5 +1,5 @@
 /* Functions specific to running gdb native on a SPARC running SunOS4.
-   Copyright 1989, 1992, 1993, 1994 Free Software Foundation, Inc.
+   Copyright 1989, 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -15,16 +15,22 @@ GNU General Public License for more details.
 
 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.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "inferior.h"
 #include "target.h"
+#include "gdbcore.h"
 
 #include <signal.h>
 #include <sys/ptrace.h>
 #include <sys/wait.h>
+#ifdef __linux__
+#include <asm/reg.h>
+#else
 #include <machine/reg.h>
+#endif
+#include <sys/user.h>
 
 /* We don't store all registers immediately when requested, since they
    get sent over in large chunks anyway.  Instead, we accumulate most
@@ -36,6 +42,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define        STACK_REGS      2
 #define        FP_REGS         4
 
+static void
+fetch_core_registers PARAMS ((char *, unsigned int, int, CORE_ADDR));
+
 /* Fetch one or more registers from the inferior.  REGNO == -1 to get
    them all.  We actually fetch more than requested, when convenient,
    marking them as valid so we won't fetch them again.  */
@@ -111,9 +120,9 @@ fetch_inferior_registers (regno)
      all (16 ptrace calls!) if we really need them.  */
   if (regno == -1)
     {
-      target_xfer_memory (*(CORE_ADDR*)&registers[REGISTER_BYTE (SP_REGNUM)],
+      target_read_memory (*(CORE_ADDR*)&registers[REGISTER_BYTE (SP_REGNUM)],
                          &registers[REGISTER_BYTE (L0_REGNUM)],
-                         16*REGISTER_RAW_SIZE (L0_REGNUM), 0);
+                         16*REGISTER_RAW_SIZE (L0_REGNUM));
       for (i = L0_REGNUM; i <= I7_REGNUM; i++)
        register_valid[i] = 1;
     }
@@ -123,8 +132,8 @@ fetch_inferior_registers (regno)
       i = REGISTER_BYTE (regno);
       if (register_valid[regno])
        printf_unfiltered("register %d valid and read\n", regno);
-      target_xfer_memory (sp + i - REGISTER_BYTE (L0_REGNUM),
-                         &registers[i], REGISTER_RAW_SIZE (regno), 0);
+      target_read_memory (sp + i - REGISTER_BYTE (L0_REGNUM),
+                         &registers[i], REGISTER_RAW_SIZE (regno));
       register_valid[regno] = 1;
     }
 }
@@ -187,16 +196,16 @@ store_inferior_registers (regno)
       if (regno < 0 || regno == SP_REGNUM)
        {
          if (!register_valid[L0_REGNUM+5]) abort();
-         target_xfer_memory (sp, 
-                             &registers[REGISTER_BYTE (L0_REGNUM)],
-                             16*REGISTER_RAW_SIZE (L0_REGNUM), 1);
+         target_write_memory (sp, 
+                              &registers[REGISTER_BYTE (L0_REGNUM)],
+                              16*REGISTER_RAW_SIZE (L0_REGNUM));
        }
       else
        {
          if (!register_valid[regno]) abort();
-         target_xfer_memory (sp + REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM),
-                             &registers[REGISTER_BYTE (regno)],
-                             REGISTER_RAW_SIZE (regno), 1);
+         target_write_memory (sp + REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM),
+                              &registers[REGISTER_BYTE (regno)],
+                              REGISTER_RAW_SIZE (regno));
        }
        
     }
@@ -237,12 +246,12 @@ store_inferior_registers (regno)
 }
 
 
-void
+static void
 fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
   char *core_reg_sect;
   unsigned core_reg_size;
   int which;
-  unsigned int ignore; /* reg addr, unused in this version */
+  CORE_ADDR ignore;    /* reg addr, unused in this version */
 {
 
   if (which == 0) {
@@ -295,3 +304,25 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
   }
 }
 
+int
+kernel_u_size ()
+{
+  return (sizeof (struct user));
+}
+
+\f
+/* Register that we are able to handle sparc core file formats.
+   FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns sparc_core_fns =
+{
+  bfd_target_unknown_flavour,
+  fetch_core_registers,
+  NULL
+};
+
+void
+_initialize_core_sparc ()
+{
+  add_core_fns (&sparc_core_fns);
+}
This page took 0.026632 seconds and 4 git commands to generate.