From: Andrew Cagney Date: Mon, 10 Dec 2001 04:58:31 +0000 (+0000) Subject: * arch-utils.c (generic_register_raw_size): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=46cd78fb4637fcab17b78f8e4c8a6983960f404d;p=binutils-gdb.git * arch-utils.c (generic_register_raw_size): New function. * gdbarch.sh (REGISTER_RAW_SIZE): Use generic_register_raw_size as the static default. * gdbarch.c: Regenerate. * arch-utils.h (generic_register_raw_size): Declare. * config/mips/tm-mips.h (REGISTER_RAW_SIZE): Delete macro. * mips-tdep.c (mips_register_raw_size): Make function static. (mips_gdbarch_init): Initialize register_raw_size. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cfac5d13c00..478ce4c458b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2001-12-09 Andrew Cagney + + * arch-utils.c (generic_register_raw_size): New function. + * gdbarch.sh (REGISTER_RAW_SIZE): Use generic_register_raw_size as + the static default. + * gdbarch.c: Regenerate. + * arch-utils.h (generic_register_raw_size): Declare. + + * config/mips/tm-mips.h (REGISTER_RAW_SIZE): Delete macro. + * mips-tdep.c (mips_register_raw_size): Make function static. + (mips_gdbarch_init): Initialize register_raw_size. + 2001-12-08 Fred Fish * dwarf2read.c (read_typedef): Replace hand crafted type diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 2b23951fb9b..60c83016011 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -376,6 +376,17 @@ legacy_virtual_frame_pointer (CORE_ADDR pc, *frame_regnum = FP_REGNUM; *frame_offset = 0; } + +/* Assume the world is flat. Every register is large enough to fit a + target integer. */ + +int +generic_register_raw_size (int regnum) +{ + gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS); + return TARGET_INT_BIT / HOST_CHAR_BIT; +} + /* Functions to manipulate the endianness of the target. */ diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index b065decb270..d1b4226ee87 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -138,4 +138,8 @@ extern int generic_in_solib_call_trampoline (CORE_ADDR pc, char *name); extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc); +/* Assume all registers are the same size and a size identical to that + of the integer type. */ +extern int generic_register_raw_size (int regnum); + #endif diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index f89d7abe108..488322c35ad 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -175,14 +175,6 @@ extern void mips_do_registers_info (int, int); #define REGISTER_BYTE(N) ((N) * MIPS_REGSIZE) -/* Number of bytes of storage in the actual machine representation for - register N. NOTE: This indirectly defines the register size - transfered by the GDB protocol. */ - -extern int mips_register_raw_size (int reg_nr); -#define REGISTER_RAW_SIZE(N) (mips_register_raw_size ((N))) - - /* Covert between the RAW and VIRTUAL registers. Some MIPS (SR, FSR, FIR) have a `raw' size of MIPS_REGSIZE but are diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index ffd1ac57c73..276d2e0ae20 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -312,7 +312,7 @@ struct gdbarch startup_gdbarch = 0, 0, 0, - 0, + generic_register_raw_size, 0, 0, 0, diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index d0a2569c70b..02369b1f1ce 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -427,7 +427,7 @@ f:2:REGISTER_NAME:char *:register_name:int regnr:regnr:::legacy_register_name::0 v:2:REGISTER_SIZE:int:register_size::::0:-1 v:2:REGISTER_BYTES:int:register_bytes::::0:-1 f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::0:0 -f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::0:0 +f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_raw_size:0 v:2:MAX_REGISTER_RAW_SIZE:int:max_register_raw_size::::0:-1 f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::0:0 v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1 diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 3f20f68d3e0..3f1b816ec67 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -410,8 +410,9 @@ mips_print_extra_frame_info (struct frame_info *fi) paddr_d (fi->extra_info->proc_desc->pdr.frameoffset)); } -/* Convert between RAW and VIRTUAL registers. The RAW register size - defines the remote-gdb packet. */ +/* Number of bytes of storage in the actual machine representation for + register N. NOTE: This indirectly defines the register size + transfered by the GDB protocol. */ static int mips64_transfers_32bit_regs_p = 0; @@ -429,6 +430,9 @@ mips_register_raw_size (int reg_nr) return MIPS_REGSIZE; } +/* Convert between RAW and VIRTUAL registers. The RAW register size + defines the remote-gdb packet. */ + int mips_register_convertible (int reg_nr) { @@ -4075,12 +4079,13 @@ mips_gdbarch_init (struct gdbarch_info info, gdbarch = gdbarch_alloc (&info, tdep); tdep->elf_flags = elf_flags; - /* Initially set everything according to the ABI. */ + /* Initially set everything according to the default ABI/ISA. */ set_gdbarch_short_bit (gdbarch, 16); set_gdbarch_int_bit (gdbarch, 32); set_gdbarch_float_bit (gdbarch, 32); set_gdbarch_double_bit (gdbarch, 64); set_gdbarch_long_double_bit (gdbarch, 64); + set_gdbarch_register_raw_size (gdbarch, mips_register_raw_size); tdep->mips_abi = mips_abi; switch (mips_abi)