aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2000-05-10 17:38:16 +0000
committerMichael Snyder <msnyder@vmware.com>2000-05-10 17:38:16 +0000
commit60054393321258d1acc88f65169fb60589cb4b41 (patch)
tree2e14d4aa8da30649e52937f14b5da33bcc4f42e5
parent598ca718d00001789f64d2669c56f87acea2b3ca (diff)
downloadgdb-60054393321258d1acc88f65169fb60589cb4b41.zip
gdb-60054393321258d1acc88f65169fb60589cb4b41.tar.gz
gdb-60054393321258d1acc88f65169fb60589cb4b41.tar.bz2
2000-05-08 Michael Snyder <msnyder@seadog.cygnus.com>
* gdbarch.sh: Add FP0_REGNUM to list of multi-arched register numbers. * gdbarch.c, gdbarch.h: Regenerate. * core-regset.c: Change FP0_REGNUM to a runtime test. * procfs.c: Ditto. * sun3-nat.c: Ditto. * sparc-tdep.c: Ditto. * i386mach-nat.c: Remove unnecessary ifdef for FP0_REGNUM. * ptx4-nat.c: Ditto. * sol-thread.c (sol_thread_create_inferior): only add the thread to the thread list if it is not already in there. (prototypes for thread_db func ptrs): pretty up formatting.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/core-regset.c5
-rw-r--r--gdb/gdbarch.c23
-rw-r--r--gdb/gdbarch.h13
-rwxr-xr-xgdb/gdbarch.sh1
-rw-r--r--gdb/i386mach-nat.c2
-rw-r--r--gdb/procfs.c69
-rw-r--r--gdb/ptx4-nat.c4
-rw-r--r--gdb/sparc-tdep.c97
-rw-r--r--gdb/sun3-nat.c77
10 files changed, 171 insertions, 130 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index df55d95..faf01da 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
2000-05-08 Michael Snyder <msnyder@seadog.cygnus.com>
+ * gdbarch.sh: Add FP0_REGNUM to list of multi-arched register numbers.
+ * gdbarch.c, gdbarch.h: Regenerate.
+ * core-regset.c: Change FP0_REGNUM to a runtime test.
+ * procfs.c: Ditto.
+ * sun3-nat.c: Ditto.
+ * sparc-tdep.c: Ditto.
+
+ * i386mach-nat.c: Remove unnecessary ifdef for FP0_REGNUM.
+ * ptx4-nat.c: Ditto.
+
* sol-thread.c (sol_thread_create_inferior): only add the thread
to the thread list if it is not already in there.
(prototypes for thread_db func ptrs): pretty up formatting.
diff --git a/gdb/core-regset.c b/gdb/core-regset.c
index 8f96c0f..3688027 100644
--- a/gdb/core-regset.c
+++ b/gdb/core-regset.c
@@ -109,9 +109,8 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
else
{
memcpy ((char *) &fpregset, core_reg_sect, sizeof (fpregset));
-#if defined (FP0_REGNUM)
- supply_fpregset (&fpregset);
-#endif
+ if (FP0_REGNUM >= 0)
+ supply_fpregset (&fpregset);
}
}
#endif /* defined(HAVE_GREGSET_T) && defined (HAVE_FPREGSET_T) */
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 17bed5c..4cfb8bc 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -146,6 +146,7 @@ struct gdbarch
int sp_regnum;
int fp_regnum;
int pc_regnum;
+ int fp0_regnum;
int npc_regnum;
int nnpc_regnum;
gdbarch_register_name_ftype *register_name;
@@ -283,6 +284,7 @@ struct gdbarch startup_gdbarch = {
0,
0,
0,
+ 0,
generic_get_saved_register,
0,
0,
@@ -353,6 +355,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->sp_regnum = -1;
gdbarch->fp_regnum = -1;
gdbarch->pc_regnum = -1;
+ gdbarch->fp0_regnum = -1;
gdbarch->npc_regnum = -1;
gdbarch->nnpc_regnum = -1;
gdbarch->register_name = legacy_register_name;
@@ -472,6 +475,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
if ((GDB_MULTI_ARCH >= 2)
&& (gdbarch->pc_regnum == -1))
internal_error ("gdbarch: verify_gdbarch: pc_regnum invalid");
+ /* Skip verify of fp0_regnum, invalid_p == 0 */
/* Skip verify of npc_regnum, invalid_p == 0 */
/* Skip verify of nnpc_regnum, invalid_p == 0 */
/* Skip verify of register_name, invalid_p == 0 */
@@ -712,6 +716,9 @@ gdbarch_dump (void)
"gdbarch_update: PC_REGNUM = %ld\n",
(long) PC_REGNUM);
fprintf_unfiltered (gdb_stdlog,
+ "gdbarch_update: FP0_REGNUM = %ld\n",
+ (long) FP0_REGNUM);
+ fprintf_unfiltered (gdb_stdlog,
"gdbarch_update: NPC_REGNUM = %ld\n",
(long) NPC_REGNUM);
fprintf_unfiltered (gdb_stdlog,
@@ -1349,6 +1356,22 @@ set_gdbarch_pc_regnum (struct gdbarch *gdbarch,
}
int
+gdbarch_fp0_regnum (struct gdbarch *gdbarch)
+{
+ /* Skip verify of fp0_regnum, invalid_p == 0 */
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_fp0_regnum called\n");
+ return gdbarch->fp0_regnum;
+}
+
+void
+set_gdbarch_fp0_regnum (struct gdbarch *gdbarch,
+ int fp0_regnum)
+{
+ gdbarch->fp0_regnum = fp0_regnum;
+}
+
+int
gdbarch_npc_regnum (struct gdbarch *gdbarch)
{
/* Skip verify of npc_regnum, invalid_p == 0 */
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 7ccad0a..dde7c51 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -264,6 +264,19 @@ extern void set_gdbarch_pc_regnum (struct gdbarch *gdbarch, int pc_regnum);
#endif
/* Default (value) for non- multi-arch platforms. */
+#if (GDB_MULTI_ARCH == 0) && !defined (FP0_REGNUM)
+#define FP0_REGNUM (-1)
+#endif
+
+extern int gdbarch_fp0_regnum (struct gdbarch *gdbarch);
+extern void set_gdbarch_fp0_regnum (struct gdbarch *gdbarch, int fp0_regnum);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > 1) || !defined (FP0_REGNUM)
+#define FP0_REGNUM (gdbarch_fp0_regnum (current_gdbarch))
+#endif
+#endif
+
+/* Default (value) for non- multi-arch platforms. */
#if (GDB_MULTI_ARCH == 0) && !defined (NPC_REGNUM)
#define NPC_REGNUM (-1)
#endif
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 892d61f..6026ca1 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -241,6 +241,7 @@ v:2:NUM_REGS:int:num_regs::::0:-1
v:2:SP_REGNUM:int:sp_regnum::::0:-1
v:2:FP_REGNUM:int:fp_regnum::::0:-1
v:2:PC_REGNUM:int:pc_regnum::::0:-1
+v:2:FP0_REGNUM:int:fp0_regnum::::0:-1:0
v:2:NPC_REGNUM:int:npc_regnum::::0:-1:0
v:2:NNPC_REGNUM:int:nnpc_regnum::::0:-1:0
f:2:REGISTER_NAME:char *:register_name:int regnr:regnr:::legacy_register_name:0
diff --git a/gdb/i386mach-nat.c b/gdb/i386mach-nat.c
index 5ecb103..cd1e1fe 100644
--- a/gdb/i386mach-nat.c
+++ b/gdb/i386mach-nat.c
@@ -129,11 +129,9 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
break;
case 2:
-#ifdef FP0_REGNUM
memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)],
core_reg_sect,
core_reg_size); /* FIXME, probably bogus */
-#endif
#ifdef FPC_REGNUM
memcpy (&registers[REGISTER_BYTE (FPC_REGNUM)],
&corestr.c_fpu.f_fpstatus.f_ctrl,
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 1a6c947..2fa825b 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -3502,19 +3502,20 @@ procfs_fetch_registers (regno)
supply_gregset (gregs);
-#if defined (FP0_REGNUM) /* need floating point? */
- if ((regno >= 0 && regno < FP0_REGNUM) ||
- regno == PC_REGNUM ||
- (NPC_REGNUM >= 0 && regno == NPC_REGNUM) ||
- regno == FP_REGNUM ||
- regno == SP_REGNUM)
- return; /* not a floating point register */
+ if (FP0_REGNUM >= 0) /* need floating point? */
+ {
+ if ((regno >= 0 && regno < FP0_REGNUM) ||
+ regno == PC_REGNUM ||
+ (NPC_REGNUM >= 0 && regno == NPC_REGNUM) ||
+ regno == FP_REGNUM ||
+ regno == SP_REGNUM)
+ return; /* not a floating point register */
- if ((fpregs = proc_get_fpregs (pi)) == NULL)
- proc_error (pi, "fetch_registers, get_fpregs", __LINE__);
+ if ((fpregs = proc_get_fpregs (pi)) == NULL)
+ proc_error (pi, "fetch_registers, get_fpregs", __LINE__);
- supply_fpregset (fpregs);
-#endif
+ supply_fpregset (fpregs);
+ }
}
/* Get ready to modify the registers array. On machines which store
@@ -3576,21 +3577,22 @@ procfs_store_registers (regno)
if (!proc_set_gregs (pi))
proc_error (pi, "store_registers, set_gregs", __LINE__);
-#if defined (FP0_REGNUM) /* need floating point? */
- if ((regno >= 0 && regno < FP0_REGNUM) ||
- regno == PC_REGNUM ||
- (NPC_REGNUM >= 0 && regno == NPC_REGNUM) ||
- regno == FP_REGNUM ||
- regno == SP_REGNUM)
- return; /* not a floating point register */
-
- if ((fpregs = proc_get_fpregs (pi)) == NULL)
- proc_error (pi, "store_registers, get_fpregs", __LINE__);
-
- fill_fpregset (fpregs, regno);
- if (!proc_set_fpregs (pi))
- proc_error (pi, "store_registers, set_fpregs", __LINE__);
-#endif
+ if (FP0_REGNUM >= 0) /* need floating point? */
+ {
+ if ((regno >= 0 && regno < FP0_REGNUM) ||
+ regno == PC_REGNUM ||
+ (NPC_REGNUM >= 0 && regno == NPC_REGNUM) ||
+ regno == FP_REGNUM ||
+ regno == SP_REGNUM)
+ return; /* not a floating point register */
+
+ if ((fpregs = proc_get_fpregs (pi)) == NULL)
+ proc_error (pi, "store_registers, get_fpregs", __LINE__);
+
+ fill_fpregset (fpregs, regno);
+ if (!proc_set_fpregs (pi))
+ proc_error (pi, "store_registers, set_fpregs", __LINE__);
+ }
}
/*
@@ -4111,14 +4113,13 @@ invalidate_cache (parent, pi, ptr)
if (!proc_set_gregs (pi)) /* flush gregs cache */
proc_warn (pi, "target_resume, set_gregs",
__LINE__);
-#ifdef FP0_REGNUM
- if (pi->fpregs_dirty)
- if (parent == NULL ||
- proc_get_current_thread (parent) != pi->tid)
- if (!proc_set_fpregs (pi)) /* flush fpregs cache */
- proc_warn (pi, "target_resume, set_fpregs",
- __LINE__);
-#endif
+ if (FP0_REGNUM >= 0)
+ if (pi->fpregs_dirty)
+ if (parent == NULL ||
+ proc_get_current_thread (parent) != pi->tid)
+ if (!proc_set_fpregs (pi)) /* flush fpregs cache */
+ proc_warn (pi, "target_resume, set_fpregs",
+ __LINE__);
#endif
if (parent != NULL)
diff --git a/gdb/ptx4-nat.c b/gdb/ptx4-nat.c
index 9640d28..a7acee2 100644
--- a/gdb/ptx4-nat.c
+++ b/gdb/ptx4-nat.c
@@ -62,8 +62,6 @@ fill_gregset (gregsetp, regno)
}
}
-#if defined (FP0_REGNUM)
-
/* Given a pointer to a floating point register set in /proc format
(fpregset_t *), unpack the register contents and supply them as gdb's
idea of the current floating point register values. */
@@ -93,8 +91,6 @@ fill_fpregset (fpregsetp, regno)
/* FIXME: see m68k-tdep.c for an example, for the m68k. */
}
-#endif /* defined (FP0_REGNUM) */
-
/*
* This doesn't quite do the same thing as the procfs.c version, but give
* it the same name so we don't have to put an ifdef in solib.c.
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index ed6245c..ceac802 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -44,8 +44,12 @@
#ifdef GDB_TARGET_IS_SPARC64
#define FP_REGISTER_BYTES (64 * 4)
-#else
+#else
+#if (SPARC_HAS_FPU)
#define FP_REGISTER_BYTES (32 * 4)
+#else
+#define FP_REGISTER_BYTES 0
+#endif
#endif
/* If not defined, assume 32 bit sparc. */
@@ -749,16 +753,16 @@ sparc_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
else if (regnum >= O0_REGNUM && regnum < O0_REGNUM + 8)
addr = frame1->frame + (regnum - O0_REGNUM) * SPARC_INTREG_SIZE
- (FP_REGISTER_BYTES + 16 * SPARC_INTREG_SIZE);
-#ifdef FP0_REGNUM
- else if (regnum >= FP0_REGNUM && regnum < FP0_REGNUM + 32)
+ else if (FP0_REGNUM >= 0 &&
+ regnum >= FP0_REGNUM && regnum < FP0_REGNUM + 32)
addr = frame1->frame + (regnum - FP0_REGNUM) * 4
- (FP_REGISTER_BYTES);
#ifdef GDB_TARGET_IS_SPARC64
- else if (regnum >= FP0_REGNUM + 32 && regnum < FP_MAX_REGNUM)
+ else if (FP0_REGNUM >= 0 &&
+ regnum >= FP0_REGNUM + 32 && regnum < FP_MAX_REGNUM)
addr = frame1->frame + 32 * 4 + (regnum - FP0_REGNUM - 32) * 8
- (FP_REGISTER_BYTES);
#endif
-#endif /* FP0_REGNUM */
else if (regnum >= Y_REGNUM && regnum < NUM_REGS)
addr = frame1->frame + (regnum - Y_REGNUM) * SPARC_INTREG_SIZE
- (FP_REGISTER_BYTES + 24 * SPARC_INTREG_SIZE);
@@ -849,13 +853,8 @@ sparc_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
#endif
/* See tm-sparc.h for how this is calculated. */
-#ifdef FP0_REGNUM
#define DUMMY_STACK_REG_BUF_SIZE \
-(((8+8+8) * SPARC_INTREG_SIZE) + FP_REGISTER_BYTES)
-#else
-#define DUMMY_STACK_REG_BUF_SIZE \
-(((8+8+8) * SPARC_INTREG_SIZE) )
-#endif /* FP0_REGNUM */
+ (((8+8+8) * SPARC_INTREG_SIZE) + FP_REGISTER_BYTES)
#define DUMMY_STACK_SIZE (DUMMY_STACK_REG_BUF_SIZE + DUMMY_REG_SAVE_OFFSET)
void
@@ -887,11 +886,10 @@ sparc_push_dummy_frame ()
&register_temp[16 * SPARC_INTREG_SIZE],
SPARC_INTREG_SIZE * 8);
-#ifdef FP0_REGNUM
- read_register_bytes (REGISTER_BYTE (FP0_REGNUM),
- &register_temp[24 * SPARC_INTREG_SIZE],
- FP_REGISTER_BYTES);
-#endif /* FP0_REGNUM */
+ if (FP0_REGNUM >= 0)
+ read_register_bytes (REGISTER_BYTE (FP0_REGNUM),
+ &register_temp[24 * SPARC_INTREG_SIZE],
+ FP_REGISTER_BYTES);
sp -= DUMMY_STACK_SIZE;
@@ -991,18 +989,20 @@ sparc_frame_find_saved_regs (fi, saved_regs_addr)
saved_regs_addr->regs[regnum] =
frame_addr + (regnum - I0_REGNUM) * SPARC_INTREG_SIZE
- DUMMY_STACK_REG_BUF_SIZE + 8 * SPARC_INTREG_SIZE;
-#ifdef FP0_REGNUM
- for (regnum = FP0_REGNUM; regnum < FP0_REGNUM + 32; regnum++)
- saved_regs_addr->regs[regnum] =
- frame_addr + (regnum - FP0_REGNUM) * 4
- - DUMMY_STACK_REG_BUF_SIZE + 24 * SPARC_INTREG_SIZE;
+ if (FP0_REGNUM >= 0)
+ {
+ for (regnum = FP0_REGNUM; regnum < FP0_REGNUM + 32; regnum++)
+ saved_regs_addr->regs[regnum] =
+ frame_addr + (regnum - FP0_REGNUM) * 4
+ - DUMMY_STACK_REG_BUF_SIZE + 24 * SPARC_INTREG_SIZE;
#ifdef GDB_TARGET_IS_SPARC64
- for (regnum = FP0_REGNUM + 32; regnum < FP_MAX_REGNUM; regnum++)
- saved_regs_addr->regs[regnum] =
- frame_addr + 32 * 4 + (regnum - FP0_REGNUM - 32) * 4
- - DUMMY_STACK_REG_BUF_SIZE + 24 * SPARC_INTREG_SIZE;
+ for (regnum = FP0_REGNUM + 32; regnum < FP_MAX_REGNUM; regnum++)
+ saved_regs_addr->regs[regnum] =
+ frame_addr + 32 * 4 + (regnum - FP0_REGNUM - 32) * 4
+ - DUMMY_STACK_REG_BUF_SIZE + 24 * SPARC_INTREG_SIZE;
#endif
-#endif /* FP0_REGNUM */
+ }
+
#ifdef GDB_TARGET_IS_SPARC64
for (regnum = PC_REGNUM; regnum < PC_REGNUM + 7; regnum++)
{
@@ -1094,26 +1094,27 @@ sparc_pop_frame ()
int regnum;
sparc_frame_find_saved_regs (frame, &fsr);
-#ifdef FP0_REGNUM
- if (fsr.regs[FP0_REGNUM])
+ if (FP0_REGNUM >= 0)
{
- read_memory (fsr.regs[FP0_REGNUM], raw_buffer, FP_REGISTER_BYTES);
- write_register_bytes (REGISTER_BYTE (FP0_REGNUM),
- raw_buffer, FP_REGISTER_BYTES);
- }
+ if (fsr.regs[FP0_REGNUM])
+ {
+ read_memory (fsr.regs[FP0_REGNUM], raw_buffer, FP_REGISTER_BYTES);
+ write_register_bytes (REGISTER_BYTE (FP0_REGNUM),
+ raw_buffer, FP_REGISTER_BYTES);
+ }
#ifndef GDB_TARGET_IS_SPARC64
- if (fsr.regs[FPS_REGNUM])
- {
- read_memory (fsr.regs[FPS_REGNUM], raw_buffer, 4);
- write_register_bytes (REGISTER_BYTE (FPS_REGNUM), raw_buffer, 4);
- }
- if (fsr.regs[CPS_REGNUM])
- {
- read_memory (fsr.regs[CPS_REGNUM], raw_buffer, 4);
- write_register_bytes (REGISTER_BYTE (CPS_REGNUM), raw_buffer, 4);
- }
+ if (fsr.regs[FPS_REGNUM])
+ {
+ read_memory (fsr.regs[FPS_REGNUM], raw_buffer, 4);
+ write_register_bytes (REGISTER_BYTE (FPS_REGNUM), raw_buffer, 4);
+ }
+ if (fsr.regs[CPS_REGNUM])
+ {
+ read_memory (fsr.regs[CPS_REGNUM], raw_buffer, 4);
+ write_register_bytes (REGISTER_BYTE (CPS_REGNUM), raw_buffer, 4);
+ }
#endif
-#endif /* FP0_REGNUM */
+ }
if (fsr.regs[G1_REGNUM])
{
read_memory (fsr.regs[G1_REGNUM], raw_buffer, 7 * SPARC_INTREG_SIZE);
@@ -1388,8 +1389,6 @@ fill_gregset (gregsetp, regno)
}
}
-#if defined (FP0_REGNUM)
-
/* Given a pointer to a floating point register set in /proc format
(fpregset_t *), unpack the register contents and supply them as gdb's
idea of the current floating point register values. */
@@ -1401,6 +1400,9 @@ supply_fpregset (fpregsetp)
register int regi;
char *from;
+ if (FP0_REGNUM < 0)
+ return;
+
for (regi = FP0_REGNUM; regi < FP_MAX_REGNUM; regi++)
{
from = (char *) &fpregsetp->pr_fr.pr_regs[regi - FP0_REGNUM];
@@ -1424,6 +1426,9 @@ fill_fpregset (fpregsetp, regno)
char *to;
char *from;
+ if (FP0_REGNUM < 0)
+ return;
+
for (regi = FP0_REGNUM; regi < FP_MAX_REGNUM; regi++)
{
if ((regno == -1) || (regno == regi))
@@ -1439,8 +1444,6 @@ fill_fpregset (fpregsetp, regno)
}
}
-#endif /* defined (FP0_REGNUM) */
-
#endif /* USE_PROC_FS */
diff --git a/gdb/sun3-nat.c b/gdb/sun3-nat.c
index 1e878ca..8e5e16f 100644
--- a/gdb/sun3-nat.c
+++ b/gdb/sun3-nat.c
@@ -33,31 +33,29 @@ fetch_inferior_registers (regno)
int regno;
{
struct regs inferior_registers;
-#ifdef FP0_REGNUM
struct fp_status inferior_fp_registers;
-#endif
registers_fetched ();
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
+
+ if (FP0_REGNUM >= 0)
+ ptrace (PTRACE_GETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) & inferior_fp_registers);
memcpy (registers, &inferior_registers, 16 * 4);
-#ifdef FP0_REGNUM
- memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
- sizeof inferior_fp_registers.fps_regs);
-#endif
+ if (FP0_REGNUM >= 0)
+ memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
+ sizeof inferior_fp_registers.fps_regs);
+
*(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
+ if (FP0_REGNUM >= 0)
+ memcpy (&registers[REGISTER_BYTE (FPC_REGNUM)],
+ &inferior_fp_registers.fps_control,
+ sizeof inferior_fp_registers -
+ sizeof inferior_fp_registers.fps_regs);
}
/* Store our register values back into the inferior.
@@ -69,30 +67,27 @@ store_inferior_registers (regno)
int regno;
{
struct regs inferior_registers;
-#ifdef FP0_REGNUM
struct fp_status inferior_fp_registers;
-#endif
memcpy (&inferior_registers, registers, 16 * 4);
-#ifdef FP0_REGNUM
- memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
- sizeof inferior_fp_registers.fps_regs);
-#endif
+ if (FP0_REGNUM >= 0)
+ memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
+ sizeof inferior_fp_registers.fps_regs);
+
inferior_registers.r_ps = *(int *) &registers[REGISTER_BYTE (PS_REGNUM)];
inferior_registers.r_pc = *(int *) &registers[REGISTER_BYTE (PC_REGNUM)];
-#ifdef FP0_REGNUM
- memcpy (&inferior_fp_registers.fps_control,
- &registers[REGISTER_BYTE (FPC_REGNUM)],
- sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
-#endif
+ if (FP0_REGNUM >= 0)
+ memcpy (&inferior_fp_registers.fps_control,
+ &registers[REGISTER_BYTE (FPC_REGNUM)],
+ sizeof inferior_fp_registers -
+ sizeof inferior_fp_registers.fps_regs);
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
+ if (FP0_REGNUM >= 0)
+ ptrace (PTRACE_SETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) & inferior_fp_registers);
}
@@ -125,18 +120,20 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
if (core_reg_size >= sizeof (struct fpu))
{
-#ifdef FP0_REGNUM
- memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)],
- fpustruct->f_fpstatus.fps_regs,
- sizeof fpustruct->f_fpstatus.fps_regs);
- memcpy (&registers[REGISTER_BYTE (FPC_REGNUM)],
- &fpustruct->f_fpstatus.fps_control,
- sizeof fpustruct->f_fpstatus -
- sizeof fpustruct->f_fpstatus.fps_regs);
-#endif
+ if (FP0_REGNUM >= 0)
+ {
+ memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)],
+ fpustruct->f_fpstatus.fps_regs,
+ sizeof fpustruct->f_fpstatus.fps_regs);
+ memcpy (&registers[REGISTER_BYTE (FPC_REGNUM)],
+ &fpustruct->f_fpstatus.fps_control,
+ sizeof fpustruct->f_fpstatus -
+ sizeof fpustruct->f_fpstatus.fps_regs);
+ }
}
else
- fprintf_unfiltered (gdb_stderr, "Couldn't read float regs from core file\n");
+ fprintf_unfiltered (gdb_stderr,
+ "Couldn't read float regs from core file\n");
}
}