aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1993-08-27 17:34:30 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1993-08-27 17:34:30 +0000
commit5b3c73e6a13c541dc557afe12d188afc7c37519c (patch)
tree862f374f15a9a16b8a4f058947f2a3313b3d8400
parent7053c1a5e32e4f585ddbfe5f6c4cbae0bea306c5 (diff)
downloadgdb-5b3c73e6a13c541dc557afe12d188afc7c37519c.zip
gdb-5b3c73e6a13c541dc557afe12d188afc7c37519c.tar.gz
gdb-5b3c73e6a13c541dc557afe12d188afc7c37519c.tar.bz2
* gdbserver/low-sun3.c: New file.
* gdbserver/Makefile.in, config/m68k/sun3.mh: Change accordingly.
-rw-r--r--gdb/gdbserver/.Sanitize1
-rw-r--r--gdb/gdbserver/Makefile.in5
-rw-r--r--gdb/gdbserver/low-sun3.c101
3 files changed, 43 insertions, 64 deletions
diff --git a/gdb/gdbserver/.Sanitize b/gdb/gdbserver/.Sanitize
index db910a5..21b2f62 100644
--- a/gdb/gdbserver/.Sanitize
+++ b/gdb/gdbserver/.Sanitize
@@ -28,6 +28,7 @@ README
configure.in
low-lynx.c
low-sparc.c
+low-sun3.c
remote-utils.c
server.c
server.h
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 9cd7990..90db83f 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -144,8 +144,8 @@ LINTFLAGS= -I${BFD_DIR}
# All source files that go into linking GDB remote server.
-SFILES = $(srcdir)/utils.c $(srcdir)/low-lynx.c $(srcdir)/low-sparc.c \
- $(srcdir)/server.c $(srcdir)/remote-utils.c
+SFILES = $(srcdir)/low-lynx.c $(srcdir)/low-sparc.c $(srcdir)/low-sun3.c \
+ $(srcdir)/utils.c $(srcdir)/server.c $(srcdir)/remote-utils.c
DEPFILES = $(GDBSERVER_DEPFILES)
@@ -279,6 +279,7 @@ server.o : ${srcdir}/server.c ${srcdir}/server.h
remote-utils.o : ${srcdir}/remote-utils.c ${srcdir}/server.h
low-lynx.o : ${srcdir}/low-lynx.c ${srcdir}/server.h
low-sparc.o : $(srcdir)/low-sparc.c $(srcdir)/server.h
+low-sun3.o : $(srcdir)/low-sun3.c $(srcdir)/server.h
utils.o : ${srcdir}/utils.c ${srcdir}/server.h
# This is the end of "Makefile.in".
diff --git a/gdb/gdbserver/low-sun3.c b/gdb/gdbserver/low-sun3.c
index eb578ee..c318ff5 100644
--- a/gdb/gdbserver/low-sun3.c
+++ b/gdb/gdbserver/low-sun3.c
@@ -21,9 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "/usr/include/sys/wait.h"
#include "frame.h"
#include "inferior.h"
-/***************************
-#include "initialize.h"
-****************************/
#include <stdio.h>
#include <sys/param.h>
@@ -155,41 +152,27 @@ fetch_inferior_registers (ignored)
{
struct regs inferior_registers;
struct fp_status inferior_fp_registers;
- int i;
-
- /* Global and Out regs are fetched directly, as well as the control
- registers. If we're getting one of the in or local regs,
- and the stack pointer has not yet been fetched,
- we have to do that first, since they're found in memory relative
- to the stack pointer. */
-
- if (ptrace (PTRACE_GETREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_registers, 0))
- perror("ptrace_getregs");
-
- registers[REGISTER_BYTE (0)] = 0;
- memcpy (&registers[REGISTER_BYTE (1)], &inferior_registers.r_g1,
- 15 * REGISTER_RAW_SIZE (G0_REGNUM));
- *(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
- *(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
- *(int *)&registers[REGISTER_BYTE (NPC_REGNUM)] = inferior_registers.r_npc;
- *(int *)&registers[REGISTER_BYTE (Y_REGNUM)] = inferior_registers.r_y;
-
- /* Floating point registers */
- if (ptrace (PTRACE_GETFPREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_fp_registers,
- 0))
- perror("ptrace_getfpregs");
+ ptrace (PTRACE_GETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers);
+#ifdef FP0_REGNUM
+ ptrace (PTRACE_GETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers);
+#endif
+
+ memcpy (registers, &inferior_registers, 16 * 4);
+#ifdef FP0_REGNUM
memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
- sizeof inferior_fp_registers.fpu_fr);
-
- /* These regs are saved on the stack by the kernel. Only read them
- all (16 ptrace calls!) if we really need them. */
-
- read_inferior_memory (*(CORE_ADDR*)&registers[REGISTER_BYTE (SP_REGNUM)],
- &registers[REGISTER_BYTE (L0_REGNUM)],
- 16*REGISTER_RAW_SIZE (L0_REGNUM));
+ sizeof inferior_fp_registers.fps_regs);
+#endif
+ *(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
+ *(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
+#ifdef FP0_REGNUM
+ memcpy
+ (&registers[REGISTER_BYTE (FPC_REGNUM)],
+ &inferior_fp_registers.fps_control,
+ sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
+#endif
}
/* Store our register values back into the inferior.
@@ -202,33 +185,27 @@ store_inferior_registers (ignored)
{
struct regs inferior_registers;
struct fp_status inferior_fp_registers;
- CORE_ADDR sp = *(CORE_ADDR *)&registers[REGISTER_BYTE (SP_REGNUM)];
-
- write_inferior_memory (sp, &registers[REGISTER_BYTE (L0_REGNUM)],
- 16*REGISTER_RAW_SIZE (L0_REGNUM));
-
- memcpy (&inferior_registers.r_g1, &registers[REGISTER_BYTE (G1_REGNUM)],
- 15 * REGISTER_RAW_SIZE (G1_REGNUM));
-
- inferior_registers.r_ps =
- *(int *)&registers[REGISTER_BYTE (PS_REGNUM)];
- inferior_registers.r_pc =
- *(int *)&registers[REGISTER_BYTE (PC_REGNUM)];
- inferior_registers.r_npc =
- *(int *)&registers[REGISTER_BYTE (NPC_REGNUM)];
- inferior_registers.r_y =
- *(int *)&registers[REGISTER_BYTE (Y_REGNUM)];
-
- if (ptrace (PTRACE_SETREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_registers, 0))
- perror("ptrace_setregs");
-
- memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
- sizeof inferior_fp_registers.fpu_fr);
- if (ptrace (PTRACE_SETFPREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0))
- perror("ptrace_setfpregs");
+ bcopy (registers, &inferior_registers, 16 * 4);
+#ifdef FP0_REGNUM
+ bcopy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
+ sizeof inferior_fp_registers.fps_regs);
+#endif
+ inferior_registers.r_ps = *(int *)&registers[REGISTER_BYTE (PS_REGNUM)];
+ inferior_registers.r_pc = *(int *)&registers[REGISTER_BYTE (PC_REGNUM)];
+
+#ifdef FP0_REGNUM
+ bcopy (&registers[REGISTER_BYTE (FPC_REGNUM)],
+ &inferior_fp_registers.fps_control,
+ sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
+#endif
+
+ ptrace (PTRACE_SETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers);
+#if FP0_REGNUM
+ ptrace (PTRACE_SETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers);
+#endif
}
/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory