diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 329e04d40b..0d78fe9f47 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,24 @@ +2003-06-02 Richard Henderson + + * 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. + 2003-06-02 Richard Henderson * alpha-tdep.c (alpha_store_return_value): Avoid switch fallthru. @@ -21,36 +42,36 @@ 2003-06-02 Richard Henderson - * alpha-tdep.c (alpha_push_dummy_call): Use - builtin_type_ieee_double_little instead of builtin_type_double. + * alpha-tdep.c (alpha_push_dummy_call): Use + builtin_type_ieee_double_little instead of builtin_type_double. - * alpha-tdep.c (alpha_push_dummy_call): Handle ABI mandated - sign-extension of 32-bit values. - (alpha_store_return_value): Similarly. + * alpha-tdep.c (alpha_push_dummy_call): Handle ABI mandated + sign-extension of 32-bit values. + (alpha_store_return_value): Similarly. - * alpha-tdep.c (alpha_push_dummy_call): Handle COMPLEX types. - (alpha_extract_return_value): Likewise. - (alpha_store_return_value): Likewise. + * alpha-tdep.c (alpha_push_dummy_call): Handle COMPLEX types. + (alpha_extract_return_value): Likewise. + (alpha_store_return_value): Likewise. - * alpha-tdep.c (alpha_extract_return_value): Handle IEEE Quad floats. - (alpha_store_return_value): Error on IEEE Quad floats. + * alpha-tdep.c (alpha_extract_return_value): Handle IEEE Quad floats. + (alpha_store_return_value): Error on IEEE Quad floats. - * alpha-tdep.c (alpha_extract_return_value): Convert to regcache. - (alpha_extract_struct_value_address): Likewise. - (alpha_store_return_value): Likewise. - (alpha_store_struct_return): Remove. - (alpha_gdbarch_init): Update hook registration to match. + * alpha-tdep.c (alpha_extract_return_value): Convert to regcache. + (alpha_extract_struct_value_address): Likewise. + (alpha_store_return_value): Likewise. + (alpha_store_struct_return): Remove. + (alpha_gdbarch_init): Update hook registration to match. - * alpha-tdep.c (alpha_register_convert_to_virtual): Tidy use of - deprecated interfaces; use ALPHA_REGISTER_SIZE instead of gdbarch - macros where appropriate. - (alpha_register_convert_to_raw): Similarly. Use unpack_long. - (alpha_convert_flt_dbl, alpha_convert_dbl_flt): New. + * alpha-tdep.c (alpha_register_convert_to_virtual): Tidy use of + deprecated interfaces; use ALPHA_REGISTER_SIZE instead of gdbarch + macros where appropriate. + (alpha_register_convert_to_raw): Similarly. Use unpack_long. + (alpha_convert_flt_dbl, alpha_convert_dbl_flt): New. - * alpha-tdep.c (alpha_register_virtual_type): Use void_data_ptr - for SP, GP; void_func_ptr for PC; non-language-specific types - for all others. - * alpha-tdep.h (ALPHA_GP_REGNUM): New. + * alpha-tdep.c (alpha_register_virtual_type): Use void_data_ptr + for SP, GP; void_func_ptr for PC; non-language-specific types + for all others. + * alpha-tdep.h (ALPHA_GP_REGNUM): New. 2003-06-02 Richard Henderson @@ -67,15 +88,15 @@ 2003-06-01 Richard Henderson - * Makefile.in (ALLDEPFILES): Add alpha-mdebug-tdep.c. - (alpha-linux-tdep.o): Update dependencies. - (alpha-nat.o, alpha-tdep.o, alpha-mdebug-tdep.o): Likewise. - * alpha-mdebug-tdep.c: Remove unneeded includes. + * Makefile.in (ALLDEPFILES): Add alpha-mdebug-tdep.c. + (alpha-linux-tdep.o): Update dependencies. + (alpha-nat.o, alpha-tdep.o, alpha-mdebug-tdep.o): Likewise. + * alpha-mdebug-tdep.c: Remove unneeded includes. 2003-06-01 Richard Henderson - * alpha-tdep.c (alpha_register_reggroup_p): New. - (alpha_gdbarch_init): Register it. + * alpha-tdep.c (alpha_register_reggroup_p): New. + (alpha_gdbarch_init): Register it. 2003-06-02 Andrew Cagney @@ -92,8 +113,8 @@ 2003-06-01 Richard Henderson - * alpha-tdep.c (alpha_gdbarch_init): Use set_gdbarch_print_insn ... - (_initialize_alpha_tdep): ... not deprecated_tm_print_insn. + * alpha-tdep.c (alpha_gdbarch_init): Use set_gdbarch_print_insn ... + (_initialize_alpha_tdep): ... not deprecated_tm_print_insn. 2003-06-01 Adam Fedor @@ -169,13 +190,13 @@ 2003-06-01 Richard Henderson - * alpha-tdep.h (ALPHA_FP_REGNUM): Remove. - * alpha-tdep.c (alpha_register_name): Remove vfp entry. - (alpha_cannot_fetch_register): Remove ALPHA_FP_REGNUM. - (alpha_cannot_store_register): Likewise. - * alphabsd-nat.c (fetch_inferior_registers): Don't set FP_REGNUM. - * alpha-nat.c (supply_gregset): Likewise. - * alphanbsd-tdep.c (fetch_core_registers): Likewise. + * alpha-tdep.h (ALPHA_FP_REGNUM): Remove. + * alpha-tdep.c (alpha_register_name): Remove vfp entry. + (alpha_cannot_fetch_register): Remove ALPHA_FP_REGNUM. + (alpha_cannot_store_register): Likewise. + * alphabsd-nat.c (fetch_inferior_registers): Don't set FP_REGNUM. + * alpha-nat.c (supply_gregset): Likewise. + * alphanbsd-tdep.c (fetch_core_registers): Likewise. 2003-06-01 Andrew Cagney @@ -191,17 +212,17 @@ 2003-06-01 Richard Henderson - * alpha-nat.c (fetch_osf_core_registers): Use ALPHA_REGISTER_SIZE - instead of ALPHA_MAX_REGISTER_RAW_SIZE. - (supply_gregset): Likewise. - * alpha-tdep.c (alpha_store_return_value): Likewise. - (alpha_get_longjmp_target): Likewise. - (alpha_register_name): Constify array. - (alpha_gdbarch_init): Remove deprecated_fp_regnum, - deprecated_register_size, deprecated_register_bytes, - deprecated_max_register_raw_size, deprecated_max_register_virtual_size. - * alpha-tdep.h (ALPHA_MAX_REGISTER_RAW_SIZE): Remove. - (ALPHA_MAX_REGISTER_VIRTUAL_SIZE): Remove. + * alpha-nat.c (fetch_osf_core_registers): Use ALPHA_REGISTER_SIZE + instead of ALPHA_MAX_REGISTER_RAW_SIZE. + (supply_gregset): Likewise. + * alpha-tdep.c (alpha_store_return_value): Likewise. + (alpha_get_longjmp_target): Likewise. + (alpha_register_name): Constify array. + (alpha_gdbarch_init): Remove deprecated_fp_regnum, + deprecated_register_size, deprecated_register_bytes, + deprecated_max_register_raw_size, deprecated_max_register_virtual_size. + * alpha-tdep.h (ALPHA_MAX_REGISTER_RAW_SIZE): Remove. + (ALPHA_MAX_REGISTER_VIRTUAL_SIZE): Remove. 2003-06-01 Richard Henderson @@ -217,23 +238,23 @@ 2003-06-01 Richard Henderson - * dwarf2-frame.c (struct dwarf2_cie): Add saw_z_augmentation. - (decode_frame_entry): Set it. Skip FDE augmentation. + * dwarf2-frame.c (struct dwarf2_cie): Add saw_z_augmentation. + (decode_frame_entry): Set it. Skip FDE augmentation. 2003-06-01 Richard Henderson - * dwarf2-frame.c (dwarf2_frame_cache): Handle retaddr_column - not overlapping PC_REGNUM. + * dwarf2-frame.c (dwarf2_frame_cache): Handle retaddr_column + not overlapping PC_REGNUM. 2003-06-01 Richard Henderson - * alpha-tdep.c (alpha_push_dummy_call): Transmography from - alpha_push_arguments. Don't dump argument register data to - the target stack. Fix float and 128-bit long double semantics. - Store $t12 and $ra as specified by the ABI. Use regcache everywhere. - (alpha_fix_call_dummy): Remove. - (alpha_call_dummy_words): Remove. - (alpha_gdbarch_init): Kill deprecated call hooks; add push_dummy_call. + * alpha-tdep.c (alpha_push_dummy_call): Transmography from + alpha_push_arguments. Don't dump argument register data to + the target stack. Fix float and 128-bit long double semantics. + Store $t12 and $ra as specified by the ABI. Use regcache everywhere. + (alpha_fix_call_dummy): Remove. + (alpha_call_dummy_words): Remove. + (alpha_gdbarch_init): Kill deprecated call hooks; add push_dummy_call. 2003-06-01 Richard Henderson diff --git a/gdb/alpha-nat.c b/gdb/alpha-nat.c index 975b5977cc..342deff22b 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; + 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; - 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 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 diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 508f0b917a..74e891baff 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -1259,6 +1259,73 @@ alpha_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) return pc; } + +/* Helper routines for alpha*-nat.c files to move register sets to and + from core files. The UNIQUE pointer is allowed to be NULL, as most + targets don't supply this value in their core files. */ + +void +alpha_supply_int_regs (int regno, const void *r0_r30, + const void *pc, const void *unique) +{ + int i; + + for (i = 0; i < 31; ++i) + if (regno == i || regno == -1) + supply_register (i, (const char *)r0_r30 + i*8); + + if (regno == ALPHA_ZERO_REGNUM || regno == -1) + supply_register (ALPHA_ZERO_REGNUM, NULL); + + if (regno == ALPHA_PC_REGNUM || regno == -1) + supply_register (ALPHA_PC_REGNUM, pc); + + if (regno == ALPHA_UNIQUE_REGNUM || regno == -1) + supply_register (ALPHA_UNIQUE_REGNUM, unique); +} + +void +alpha_fill_int_regs (int regno, void *r0_r30, void *pc, void *unique) +{ + int i; + + for (i = 0; i < 31; ++i) + if (regno == i || regno == -1) + regcache_collect (i, (char *)r0_r30 + i*8); + + if (regno == ALPHA_PC_REGNUM || regno == -1) + regcache_collect (ALPHA_PC_REGNUM, pc); + + if (unique && (regno == ALPHA_UNIQUE_REGNUM || regno == -1)) + regcache_collect (ALPHA_UNIQUE_REGNUM, unique); +} + +void +alpha_supply_fp_regs (int regno, const void *f0_f30, const void *fpcr) +{ + int i; + + for (i = ALPHA_FP0_REGNUM; i < ALPHA_FP0_REGNUM + 31; ++i) + if (regno == i || regno == -1) + supply_register (i, (const char *)f0_f30 + (i - ALPHA_FP0_REGNUM) * 8); + + if (regno == ALPHA_FPCR_REGNUM || regno == -1) + supply_register (ALPHA_FPCR_REGNUM, fpcr); +} + +void +alpha_fill_fp_regs (int regno, void *f0_f30, void *fpcr) +{ + int i; + + for (i = ALPHA_FP0_REGNUM; i < ALPHA_FP0_REGNUM + 31; ++i) + if (regno == i || regno == -1) + regcache_collect (i, (char *)f0_f30 + (i - ALPHA_FP0_REGNUM) * 8); + + if (regno == ALPHA_FPCR_REGNUM || regno == -1) + regcache_collect (ALPHA_FPCR_REGNUM, fpcr); +} + /* alpha_software_single_step() is called just before we want to resume the inferior, if we want to single-step it but there is no hardware diff --git a/gdb/alpha-tdep.h b/gdb/alpha-tdep.h index 7f1ec5139e..eaeaa56b2e 100644 --- a/gdb/alpha-tdep.h +++ b/gdb/alpha-tdep.h @@ -94,4 +94,10 @@ extern CORE_ADDR alpha_after_prologue (CORE_ADDR pc); extern void alpha_mdebug_init_abi (struct gdbarch_info, struct gdbarch *); +extern void alpha_supply_int_regs (int, const void *, const void *, + const void *); +extern void alpha_fill_int_regs (int, void *, void *, void *); +extern void alpha_supply_fp_regs (int, const void *, const void *); +extern void alpha_fill_fp_regs (int, void *, void *); + #endif /* ALPHA_TDEP_H */ diff --git a/gdb/alphabsd-tdep.c b/gdb/alphabsd-tdep.c index 39a9b1ae77..89c9c30c1b 100644 --- a/gdb/alphabsd-tdep.c +++ b/gdb/alphabsd-tdep.c @@ -19,84 +19,37 @@ Boston, MA 02111-1307, USA. */ #include "defs.h" -#include "regcache.h" #include "alpha-tdep.h" #include "alphabsd-tdep.h" -/* Number of general-purpose registers. */ -#define NUM_GREGS 32 - -/* Number of floating-point registers. */ -#define NUM_FPREGS 31 - /* Conviently, GDB uses the same register numbering as the ptrace register structure used by BSD on Alpha. */ void alphabsd_supply_reg (char *regs, int regno) { - int i; - - for (i = 0; i < NUM_GREGS; i++) - { - if (i == regno || regno == -1) - { - if (CANNOT_FETCH_REGISTER (i)) - supply_register (i, NULL); - else - supply_register (i, regs + (i * 8)); - } - } - - /* The PC travels in the ZERO slot. */ - if (regno == PC_REGNUM || regno == -1) - supply_register (PC_REGNUM, regs + (31 * 8)); + /* PC is at slot 32; UNIQUE not present. */ + alpha_supply_int_regs (regno, regs, regs + 31*8, NULL); } void alphabsd_fill_reg (char *regs, int regno) { - int i; - - for (i = 0; i < NUM_GREGS; i++) - if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i)) - regcache_collect (i, regs + (i * 8)); - - /* The PC travels in the ZERO slot. */ - if (regno == PC_REGNUM || regno == -1) - regcache_collect (PC_REGNUM, regs + (31 * 8)); + /* PC is at slot 32; UNIQUE not present. */ + alpha_fill_int_regs (regno, regs, regs + 31*8, NULL); } void alphabsd_supply_fpreg (char *fpregs, int regno) { - int i; - - for (i = FP0_REGNUM; i < FP0_REGNUM + NUM_FPREGS; i++) - { - if (i == regno || regno == -1) - { - if (CANNOT_FETCH_REGISTER (i)) - supply_register (i, NULL); - else - supply_register (i, fpregs + ((i - FP0_REGNUM) * 8)); - } - } - - if (regno == ALPHA_FPCR_REGNUM || regno == -1) - supply_register (ALPHA_FPCR_REGNUM, fpregs + (32 * 8)); + /* FPCR is at slot 33; slot 32 unused. */ + alpha_supply_fp_regs (regno, regs, regs + 32*8); } void alphabsd_fill_fpreg (char *fpregs, int regno) { - int i; - - for (i = FP0_REGNUM; i < FP0_REGNUM + NUM_FPREGS; i++) - if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i)) - regcache_collect (i, fpregs + ((i - FP0_REGNUM) * 8)); - - if (regno == ALPHA_FPCR_REGNUM || regno == -1) - regcache_collect (ALPHA_FPCR_REGNUM, fpregs + (32 * 8)); + /* FPCR is at slot 33; slot 32 unused. */ + alpha_fill_fp_regs (regno, regs, regs + 32*8); } diff --git a/gdb/config/alpha/nm-linux.h b/gdb/config/alpha/nm-linux.h index 9e99b33cd1..a6f9a49f9d 100644 --- a/gdb/config/alpha/nm-linux.h +++ b/gdb/config/alpha/nm-linux.h @@ -45,6 +45,9 @@ pointer to the first register. */ #define ALPHA_REGSET_BASE(regsetp) ((long *) (regsetp)) +/* Given a pointer to a gregset_t, locate the UNIQUE value. */ +#define ALPHA_REGSET_UNIQUE(regsetp) ((long *)(regsetp) + 32) + /* The address of UNIQUE for ptrace. */ #define ALPHA_UNIQUE_PTRACE_ADDR 65