summaryrefslogtreecommitdiff
path: root/gdb/alpha-nat.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-06-02 20:57:16 +0000
committerRichard Henderson <rth@redhat.com>2003-06-02 20:57:16 +0000
commit5b8593d95b4e5b19fbe35c35ced777c8d7080cf9 (patch)
tree949b531bf8273ef9e6b5b2e6fdfb11fdbc27860b /gdb/alpha-nat.c
parente8b709ea1a4a1e68f2170f2323c03f8c093bffea (diff)
downloadgdb-5b8593d95b4e5b19fbe35c35ced777c8d7080cf9.tar.gz
* alpha-tdep.c (alpha_supply_int_regs, alpha_fill_int_regs): New.
(alpha_supply_fp_regs, alpha_fill_fp_regs): New. * alpha-tdep.h: Declare them. * alpha-nat.c (fetch_osf_core_registers): Constify core_reg_mapping. Remove zerobuf. Don't error on UNIQUE. (fetch_elf_core_registers): Use alpha_supply_{int,fp}_regs. (ALPHA_REGSET_UNIQUE): Provide default. (supply_gregset): Use alpha_supply_int_regs. (fill_gregset): Use alpha_fill_int_regs. (supply_fpregset): Use alpha_supply_fp_regs. (fill_fpregset): Use alpha_fill_fp_regs. * alphabsd-tdep.c (NUM_GREGS, NUM_FPREGS): Remove. (alphabsd_supply_reg): Use alpha_supply_int_regs. (alphabsd_fill_reg): Use alpha_fill_int_regs. (alphabsd_supply_fpreg): Use alpha_supply_fp_regs. (alphabsd_fill_fpreg): Use alpha_fill_fp_regs. * config/alpha/nm-linux.h (ALPHA_REGSET_UNIQUE): New.
Diffstat (limited to 'gdb/alpha-nat.c')
-rw-r--r--gdb/alpha-nat.c95
1 files changed, 39 insertions, 56 deletions
diff --git a/gdb/alpha-nat.c b/gdb/alpha-nat.c
index 975b5977cca..342deff22b4 100644
--- a/gdb/alpha-nat.c
+++ b/gdb/alpha-nat.c
@@ -68,7 +68,7 @@ fetch_osf_core_registers (char *core_reg_sect, unsigned core_reg_size,
OSF/1.2 core files. OSF5 uses different names for the register
enum list, need to handle two cases. The actual values are the
same. */
- static int core_reg_mapping[ALPHA_NUM_REGS] =
+ static int const core_reg_mapping[ALPHA_NUM_REGS] =
{
#ifdef NCF_REGS
#define EFL NCF_REGS
@@ -94,18 +94,23 @@ fetch_osf_core_registers (char *core_reg_sect, unsigned core_reg_size,
EF_PC, -1
#endif
};
- static char zerobuf[ALPHA_REGISTER_SIZE] = {0};
- for (regno = 0; regno < NUM_REGS; regno++)
+ for (regno = 0; regno < ALPHA_NUM_REGS; regno++)
{
if (CANNOT_FETCH_REGISTER (regno))
{
- supply_register (regno, zerobuf);
+ supply_register (regno, NULL);
continue;
}
addr = 8 * core_reg_mapping[regno];
if (addr < 0 || addr >= core_reg_size)
{
+ /* ??? UNIQUE is a new addition. Don't generate an error. */
+ if (regno == ALPHA_UNIQUE_REGNUM)
+ {
+ supply_register (regno, NULL);
+ continue;
+ }
if (bad_reg < 0)
bad_reg = regno;
}
@@ -130,31 +135,22 @@ fetch_elf_core_registers (char *core_reg_sect, unsigned core_reg_size,
return;
}
- if (which == 2)
+ switch (which)
{
- /* The FPU Registers. */
- memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)],
- core_reg_sect, 31 * 8);
- memset (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM + 31)], 0, 8);
- memset (&deprecated_register_valid[FP0_REGNUM], 1, 32);
- }
- else
- {
- /* The General Registers. */
- memcpy (&deprecated_registers[REGISTER_BYTE (ALPHA_V0_REGNUM)],
- core_reg_sect, 31 * 8);
- memcpy (&deprecated_registers[REGISTER_BYTE (PC_REGNUM)],
- core_reg_sect + 31 * 8, 8);
- memset (&deprecated_registers[REGISTER_BYTE (ALPHA_ZERO_REGNUM)], 0, 8);
- memset (&deprecated_register_valid[ALPHA_V0_REGNUM], 1, 32);
- deprecated_register_valid[PC_REGNUM] = 1;
-
- if (core_reg_size >= 33 * 8)
- {
- memcpy (&deprecated_registers[REGISTER_BYTE (ALPHA_UNIQUE_REGNUM)],
- core_reg_sect + 32 * 8, 8);
- deprecated_register_valid[ALPHA_UNIQUE_REGNUM] = 1;
- }
+ case 0: /* integer registers */
+ /* PC is in slot 32; UNIQUE is in slot 33, if present. */
+ alpha_supply_int_regs (-1, core_reg_sect, core_reg_sect + 31*8,
+ (core_reg_size >= 33 * 8
+ ? core_reg_sect + 32*8 : NULL));
+ break;
+
+ case 2: /* floating-point registers */
+ /* FPCR is in slot 32. */
+ alpha_supply_fp_regs (-1, core_reg_sect, core_reg_sect + 31*8);
+ break;
+
+ default:
+ break;
}
}
@@ -192,6 +188,11 @@ kernel_u_size (void)
/* Prototypes for supply_gregset etc. */
#include "gregset.h"
+/* Locate the UNIQUE value within the gregset_t. */
+#ifndef ALPHA_REGSET_UNIQUE
+#define ALPHA_REGSET_UNIQUE(ptr) NULL
+#endif
+
/*
* See the comment in m68k-tdep.c regarding the utility of these functions.
*/
@@ -199,31 +200,21 @@ kernel_u_size (void)
void
supply_gregset (gdb_gregset_t *gregsetp)
{
- register int regi;
register long *regp = ALPHA_REGSET_BASE (gregsetp);
- static char zerobuf[ALPHA_REGISTER_SIZE] = {0};
+ void *unique = ALPHA_REGSET_UNIQUE (gregsetp);
- for (regi = 0; regi < 31; regi++)
- supply_register (regi, (char *) (regp + regi));
-
- supply_register (PC_REGNUM, (char *) (regp + 31));
-
- /* Fill inaccessible registers with zero. */
- supply_register (ALPHA_ZERO_REGNUM, zerobuf);
+ /* PC is in slot 32. */
+ alpha_supply_int_regs (-1, regp, regp + 31, unique);
}
void
fill_gregset (gdb_gregset_t *gregsetp, int regno)
{
- int regi;
register long *regp = ALPHA_REGSET_BASE (gregsetp);
+ void *unique = ALPHA_REGSET_UNIQUE (gregsetp);
- for (regi = 0; regi < 31; regi++)
- if ((regno == -1) || (regno == regi))
- *(regp + regi) = *(long *) &deprecated_registers[REGISTER_BYTE (regi)];
-
- if ((regno == -1) || (regno == PC_REGNUM))
- *(regp + 31) = *(long *) &deprecated_registers[REGISTER_BYTE (PC_REGNUM)];
+ /* PC is in slot 32. */
+ alpha_fill_int_regs (regno, regp, regp + 31, unique);
}
/*
@@ -234,27 +225,19 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno)
void
supply_fpregset (gdb_fpregset_t *fpregsetp)
{
- register int regi;
register long *regp = ALPHA_REGSET_BASE (fpregsetp);
- for (regi = 0; regi < 32; regi++)
- supply_register (regi + FP0_REGNUM, (char *) (regp + regi));
+ /* FPCR is in slot 32. */
+ alpha_supply_fp_regs (-1, regp, regp + 31);
}
void
fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
{
- int regi;
register long *regp = ALPHA_REGSET_BASE (fpregsetp);
- for (regi = FP0_REGNUM; regi < FP0_REGNUM + 32; regi++)
- {
- if ((regno == -1) || (regno == regi))
- {
- *(regp + regi - FP0_REGNUM) =
- *(long *) &deprecated_registers[REGISTER_BYTE (regi)];
- }
- }
+ /* FPCR is in slot 32. */
+ alpha_fill_fp_regs (regno, regp, regp + 31);
}
#endif