aboutsummaryrefslogtreecommitdiff
path: root/gdb/rs6000-xdep.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1992-03-01 01:04:13 +0000
committerPer Bothner <per@bothner.com>1992-03-01 01:04:13 +0000
commit2b5a8d9c47f77cebff48c49d5b9025ac8baf88c5 (patch)
treed669c2a34cd995b4d73101423252a86c306e767c /gdb/rs6000-xdep.c
parent1651b22d76d78d5ec16dcb980127805dd9a8c649 (diff)
downloadgdb-2b5a8d9c47f77cebff48c49d5b9025ac8baf88c5.zip
gdb-2b5a8d9c47f77cebff48c49d5b9025ac8baf88c5.tar.gz
gdb-2b5a8d9c47f77cebff48c49d5b9025ac8baf88c5.tar.bz2
More changes, mostly from IBM, for the rs6000. See ChangeLog.
Diffstat (limited to 'gdb/rs6000-xdep.c')
-rw-r--r--gdb/rs6000-xdep.c48
1 files changed, 38 insertions, 10 deletions
diff --git a/gdb/rs6000-xdep.c b/gdb/rs6000-xdep.c
index 6a5543a..7f14dfa 100644
--- a/gdb/rs6000-xdep.c
+++ b/gdb/rs6000-xdep.c
@@ -60,30 +60,58 @@ static int special_regs[] = {
/* Nonzero if we just simulated a single step break. */
extern int one_stepped;
+extern char register_valid[];
+
void
fetch_inferior_registers (regno)
- int regno;
+ int regno;
{
int ii;
extern char registers[];
- /* read 32 general purpose registers. */
+ if (regno < 0) { /* for all registers */
- for (ii=0; ii < 32; ++ii)
- *(int*)&registers[REGISTER_BYTE (ii)] =
+ /* read 32 general purpose registers. */
+
+ for (ii=0; ii < 32; ++ii)
+ *(int*)&registers[REGISTER_BYTE (ii)] =
ptrace (PT_READ_GPR, inferior_pid, ii, 0, 0);
- /* read general purpose floating point registers. */
+ /* read general purpose floating point registers. */
- for (ii=0; ii < 32; ++ii)
- ptrace (PT_READ_FPR, inferior_pid,
+ for (ii=0; ii < 32; ++ii)
+ ptrace (PT_READ_FPR, inferior_pid,
(int*)&registers [REGISTER_BYTE (FP0_REGNUM+ii)], FPR0+ii, 0);
- /* read special registers. */
- for (ii=0; ii <= LAST_SP_REGNUM-FIRST_SP_REGNUM; ++ii)
- *(int*)&registers[REGISTER_BYTE (FIRST_SP_REGNUM+ii)] =
+ /* read special registers. */
+ for (ii=0; ii <= LAST_SP_REGNUM-FIRST_SP_REGNUM; ++ii)
+ *(int*)&registers[REGISTER_BYTE (FIRST_SP_REGNUM+ii)] =
ptrace (PT_READ_GPR, inferior_pid, special_regs[ii], 0, 0);
+
+ registers_fetched ();
+ return;
+ }
+
+ /* else an individual register is addressed. */
+
+ else if (regno < FP0_REGNUM) { /* a GPR */
+ *(int*)&registers[REGISTER_BYTE (regno)] =
+ ptrace (PT_READ_GPR, inferior_pid, regno, 0, 0);
+ }
+ else if (regno <= FPLAST_REGNUM) { /* a FPR */
+ ptrace (PT_READ_FPR, inferior_pid,
+ (int*)&registers [REGISTER_BYTE (regno)], (regno-FP0_REGNUM+FPR0), 0);
+ }
+ else if (regno <= LAST_SP_REGNUM) { /* a special register */
+ *(int*)&registers[REGISTER_BYTE (regno)] =
+ ptrace (PT_READ_GPR, inferior_pid,
+ special_regs[regno-FIRST_SP_REGNUM], 0, 0);
+ }
+ else
+ fprintf (stderr, "gdb error: register no %d not implemented.\n", regno);
+
+ register_valid [regno] = 1;
}
/* Store our register values back into the inferior.