From 7a5ea0d4f115edf01ba0d65f52b2a3769a0859cd Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Thu, 25 Mar 2004 16:52:42 +0000 Subject: [PATCH] * arm-linux-tdep.c (ARM_LINUX_JB_ELEMENT_SIZE): Define to INT_REGISTER_SIZE. (arm_linux_push_arguments): Use TARGET_DOUBLE_BIT instead of FP_REGISTER_VIRTUAL_SIZE. * arm-tdep.c (arm_make_sigtramp_cache): Use register_size instead of DEPRECATED_REGISTER_RAW_SIZE. (arm_register_type): Add gdbarch argument. (arm_register_raw_size, arm_register_virtual_size): Delete. (arm_register_byte, arm_extract_return_value) (arm_store_return_value, arm_get_longjmp_target): Update references to INT_REGISTER_RAW_SIZE and FP_REGISTER_RAW_SIZE. (arm_gdbarch_init): Likewise. Don't set deprecated_register_raw_size, deprecated_register_virtual_size, deprecated_max_register_raw_size, deprecated_max_register_virtual_size, or deprecated_max_register_virtual_type. Do set register_type. * arm-tdep.h (ARM_MAX_REGISTER_RAW_SIZE) (ARM_MAX_REGISTER_VIRTUAL_SIZE, INT_REGISTER_VIRTUAL_SIZE) (FP_REGISTER_VIRTUAL_SIZE): Delete. (INT_REGISTER_RAW_SIZE): Rename to INT_REGISTER_SIZE. (FP_REGISTER_RAW_SIZE): Rename to FP_REGISTER_SIZE. * arm-linux-tdep.c (ARM_NBSD_JB_ELEMENT_SIZE): Define to INT_REGISTER_SIZE. * remote-rdp.c (remote_rdp_fetch_register): Use MAX_REGISTER_SIZE. (remote_rdp_store_register): Likewise. --- gdb/ChangeLog | 28 +++++++++++++ gdb/arm-linux-tdep.c | 4 +- gdb/arm-tdep.c | 98 +++++++++++++++----------------------------- gdb/arm-tdep.h | 15 +------ gdb/armnbsd-tdep.c | 2 +- gdb/remote-rdp.c | 4 +- 6 files changed, 68 insertions(+), 83 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 59ad58a24d8..d998cff289a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,31 @@ +2004-03-25 Daniel Jacobowitz + + * arm-linux-tdep.c (ARM_LINUX_JB_ELEMENT_SIZE): Define to + INT_REGISTER_SIZE. + (arm_linux_push_arguments): Use TARGET_DOUBLE_BIT instead of + FP_REGISTER_VIRTUAL_SIZE. + * arm-tdep.c (arm_make_sigtramp_cache): Use register_size instead + of DEPRECATED_REGISTER_RAW_SIZE. + (arm_register_type): Add gdbarch argument. + (arm_register_raw_size, arm_register_virtual_size): Delete. + (arm_register_byte, arm_extract_return_value) + (arm_store_return_value, arm_get_longjmp_target): Update references + to INT_REGISTER_RAW_SIZE and FP_REGISTER_RAW_SIZE. + (arm_gdbarch_init): Likewise. Don't set + deprecated_register_raw_size, deprecated_register_virtual_size, + deprecated_max_register_raw_size, + deprecated_max_register_virtual_size, or + deprecated_max_register_virtual_type. Do set register_type. + * arm-tdep.h (ARM_MAX_REGISTER_RAW_SIZE) + (ARM_MAX_REGISTER_VIRTUAL_SIZE, INT_REGISTER_VIRTUAL_SIZE) + (FP_REGISTER_VIRTUAL_SIZE): Delete. + (INT_REGISTER_RAW_SIZE): Rename to INT_REGISTER_SIZE. + (FP_REGISTER_RAW_SIZE): Rename to FP_REGISTER_SIZE. + * arm-linux-tdep.c (ARM_NBSD_JB_ELEMENT_SIZE): Define to + INT_REGISTER_SIZE. + * remote-rdp.c (remote_rdp_fetch_register): Use MAX_REGISTER_SIZE. + (remote_rdp_store_register): Likewise. + 2004-03-24 Daniel Jacobowitz * Makefile.in (mips-linux-tdep.o): Update dependencies. diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 42d4438d55d..26b1a173320 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -59,7 +59,7 @@ LONGEST arm_linux_call_dummy_words[] = }; /* Description of the longjmp buffer. */ -#define ARM_LINUX_JB_ELEMENT_SIZE INT_REGISTER_RAW_SIZE +#define ARM_LINUX_JB_ELEMENT_SIZE INT_REGISTER_SIZE #define ARM_LINUX_JB_PC 21 /* Extract from an array REGBUF containing the (raw) register state @@ -130,7 +130,7 @@ arm_linux_push_arguments (int nargs, struct value **args, CORE_ADDR sp, /* ANSI C code passes float arguments as integers, K&R code passes float arguments as doubles. Correct for this here. */ if (TYPE_CODE_FLT == TYPE_CODE (arg_type) && DEPRECATED_REGISTER_SIZE == len) - nstack_size += FP_REGISTER_VIRTUAL_SIZE; + nstack_size += TARGET_DOUBLE_BIT / TARGET_CHAR_BIT; else nstack_size += len; } diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 91a200d77c7..3fa37c9a88e 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1094,7 +1094,7 @@ arm_make_sigtramp_cache (struct frame_info *next_frame) cache->framereg = ARM_SP_REGNUM; cache->prev_sp = read_memory_integer (cache->saved_regs[cache->framereg].addr, - DEPRECATED_REGISTER_RAW_SIZE (cache->framereg)); + register_size (current_gdbarch, cache->framereg)); return cache; } @@ -1396,7 +1396,7 @@ arm_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, register N. */ static struct type * -arm_register_type (int regnum) +arm_register_type (struct gdbarch *gdbarch, int regnum) { if (regnum >= ARM_F0_REGNUM && regnum < ARM_F0_REGNUM + NUM_FREGS) { @@ -1416,44 +1416,16 @@ static int arm_register_byte (int regnum) { if (regnum < ARM_F0_REGNUM) - return regnum * INT_REGISTER_RAW_SIZE; + return regnum * INT_REGISTER_SIZE; else if (regnum < ARM_PS_REGNUM) - return (NUM_GREGS * INT_REGISTER_RAW_SIZE - + (regnum - ARM_F0_REGNUM) * FP_REGISTER_RAW_SIZE); + return (NUM_GREGS * INT_REGISTER_SIZE + + (regnum - ARM_F0_REGNUM) * FP_REGISTER_SIZE); else - return (NUM_GREGS * INT_REGISTER_RAW_SIZE - + NUM_FREGS * FP_REGISTER_RAW_SIZE + return (NUM_GREGS * INT_REGISTER_SIZE + + NUM_FREGS * FP_REGISTER_SIZE + (regnum - ARM_FPS_REGNUM) * STATUS_REGISTER_SIZE); } -/* Number of bytes of storage in the actual machine representation for - register N. All registers are 4 bytes, except fp0 - fp7, which are - 12 bytes in length. */ - -static int -arm_register_raw_size (int regnum) -{ - if (regnum < ARM_F0_REGNUM) - return INT_REGISTER_RAW_SIZE; - else if (regnum < ARM_FPS_REGNUM) - return FP_REGISTER_RAW_SIZE; - else - return STATUS_REGISTER_SIZE; -} - -/* Number of bytes of storage in a program's representation - for register N. */ -static int -arm_register_virtual_size (int regnum) -{ - if (regnum < ARM_F0_REGNUM) - return INT_REGISTER_VIRTUAL_SIZE; - else if (regnum < ARM_FPS_REGNUM) - return FP_REGISTER_VIRTUAL_SIZE; - else - return STATUS_REGISTER_SIZE; -} - /* Map GDB internal REGNUM onto the Arm simulator register numbers. */ static int arm_register_sim_regno (int regnum) @@ -2082,7 +2054,7 @@ arm_extract_return_value (struct type *type, /* The value is in register F0 in internal format. We need to extract the raw value and then convert it to the desired internal type. */ - bfd_byte tmpbuf[FP_REGISTER_RAW_SIZE]; + bfd_byte tmpbuf[FP_REGISTER_SIZE]; regcache_cooked_read (regs, ARM_F0_REGNUM, tmpbuf); convert_from_extended (floatformat_from_type (type), tmpbuf, @@ -2095,7 +2067,7 @@ arm_extract_return_value (struct type *type, regcache_cooked_read (regs, ARM_A1_REGNUM, valbuf); if (TYPE_LENGTH (type) > 4) regcache_cooked_read (regs, ARM_A1_REGNUM + 1, - valbuf + INT_REGISTER_RAW_SIZE); + valbuf + INT_REGISTER_SIZE); break; default: @@ -2124,11 +2096,11 @@ arm_extract_return_value (struct type *type, anything special for small big-endian values. */ regcache_cooked_read_unsigned (regs, regno++, &tmp); store_unsigned_integer (valbuf, - (len > INT_REGISTER_RAW_SIZE - ? INT_REGISTER_RAW_SIZE : len), + (len > INT_REGISTER_SIZE + ? INT_REGISTER_SIZE : len), tmp); - len -= INT_REGISTER_RAW_SIZE; - valbuf += INT_REGISTER_RAW_SIZE; + len -= INT_REGISTER_SIZE; + valbuf += INT_REGISTER_SIZE; } } else @@ -2138,15 +2110,15 @@ arm_extract_return_value (struct type *type, registers with 32-bit load instruction(s). */ int len = TYPE_LENGTH (type); int regno = ARM_A1_REGNUM; - bfd_byte tmpbuf[INT_REGISTER_RAW_SIZE]; + bfd_byte tmpbuf[INT_REGISTER_SIZE]; while (len > 0) { regcache_cooked_read (regs, regno++, tmpbuf); memcpy (valbuf, tmpbuf, - len > INT_REGISTER_RAW_SIZE ? INT_REGISTER_RAW_SIZE : len); - len -= INT_REGISTER_RAW_SIZE; - valbuf += INT_REGISTER_RAW_SIZE; + len > INT_REGISTER_SIZE ? INT_REGISTER_SIZE : len); + len -= INT_REGISTER_SIZE; + valbuf += INT_REGISTER_SIZE; } } } @@ -2270,7 +2242,7 @@ arm_store_return_value (struct type *type, struct regcache *regs, if (TYPE_CODE (type) == TYPE_CODE_FLT) { - char buf[ARM_MAX_REGISTER_RAW_SIZE]; + char buf[MAX_REGISTER_SIZE]; switch (arm_get_fp_model (current_gdbarch)) { @@ -2285,7 +2257,7 @@ arm_store_return_value (struct type *type, struct regcache *regs, regcache_cooked_write (regs, ARM_A1_REGNUM, valbuf); if (TYPE_LENGTH (type) > 4) regcache_cooked_write (regs, ARM_A1_REGNUM + 1, - valbuf + INT_REGISTER_RAW_SIZE); + valbuf + INT_REGISTER_SIZE); break; default: @@ -2306,10 +2278,10 @@ arm_store_return_value (struct type *type, struct regcache *regs, { /* Values of one word or less are zero/sign-extended and returned in r0. */ - bfd_byte tmpbuf[INT_REGISTER_RAW_SIZE]; + bfd_byte tmpbuf[INT_REGISTER_SIZE]; LONGEST val = unpack_long (type, valbuf); - store_signed_integer (tmpbuf, INT_REGISTER_RAW_SIZE, val); + store_signed_integer (tmpbuf, INT_REGISTER_SIZE, val); regcache_cooked_write (regs, ARM_A1_REGNUM, tmpbuf); } else @@ -2323,8 +2295,8 @@ arm_store_return_value (struct type *type, struct regcache *regs, while (len > 0) { regcache_cooked_write (regs, regno++, valbuf); - len -= INT_REGISTER_RAW_SIZE; - valbuf += INT_REGISTER_RAW_SIZE; + len -= INT_REGISTER_SIZE; + valbuf += INT_REGISTER_SIZE; } } } @@ -2335,15 +2307,15 @@ arm_store_return_value (struct type *type, struct regcache *regs, registers with 32-bit load instruction(s). */ int len = TYPE_LENGTH (type); int regno = ARM_A1_REGNUM; - bfd_byte tmpbuf[INT_REGISTER_RAW_SIZE]; + bfd_byte tmpbuf[INT_REGISTER_SIZE]; while (len > 0) { memcpy (tmpbuf, valbuf, - len > INT_REGISTER_RAW_SIZE ? INT_REGISTER_RAW_SIZE : len); + len > INT_REGISTER_SIZE ? INT_REGISTER_SIZE : len); regcache_cooked_write (regs, regno++, tmpbuf); - len -= INT_REGISTER_RAW_SIZE; - valbuf += INT_REGISTER_RAW_SIZE; + len -= INT_REGISTER_SIZE; + valbuf += INT_REGISTER_SIZE; } } } @@ -2352,16 +2324,16 @@ static int arm_get_longjmp_target (CORE_ADDR *pc) { CORE_ADDR jb_addr; - char buf[INT_REGISTER_RAW_SIZE]; + char buf[INT_REGISTER_SIZE]; struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); jb_addr = read_register (ARM_A1_REGNUM); if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf, - INT_REGISTER_RAW_SIZE)) + INT_REGISTER_SIZE)) return 0; - *pc = extract_unsigned_integer (buf, INT_REGISTER_RAW_SIZE); + *pc = extract_unsigned_integer (buf, INT_REGISTER_SIZE); return 1; } @@ -2805,15 +2777,11 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pc_regnum (gdbarch, ARM_PC_REGNUM); set_gdbarch_deprecated_register_byte (gdbarch, arm_register_byte); set_gdbarch_deprecated_register_bytes (gdbarch, - (NUM_GREGS * INT_REGISTER_RAW_SIZE - + NUM_FREGS * FP_REGISTER_RAW_SIZE + (NUM_GREGS * INT_REGISTER_SIZE + + NUM_FREGS * FP_REGISTER_SIZE + NUM_SREGS * STATUS_REGISTER_SIZE)); set_gdbarch_num_regs (gdbarch, NUM_GREGS + NUM_FREGS + NUM_SREGS); - set_gdbarch_deprecated_register_raw_size (gdbarch, arm_register_raw_size); - set_gdbarch_deprecated_register_virtual_size (gdbarch, arm_register_virtual_size); - set_gdbarch_deprecated_max_register_raw_size (gdbarch, FP_REGISTER_RAW_SIZE); - set_gdbarch_deprecated_max_register_virtual_size (gdbarch, FP_REGISTER_VIRTUAL_SIZE); - set_gdbarch_deprecated_register_virtual_type (gdbarch, arm_register_type); + set_gdbarch_register_type (gdbarch, arm_register_type); /* Internal <-> external register number maps. */ set_gdbarch_register_sim_regno (gdbarch, arm_register_sim_regno); diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h index 26f3a83a973..bb30455a314 100644 --- a/gdb/arm-tdep.h +++ b/gdb/arm-tdep.h @@ -45,24 +45,13 @@ enum gdb_regnum { ARM_LAST_FP_ARG_REGNUM = ARM_F3_REGNUM }; -/* Used in target-specific code when we need to know the size of the - largest type of register we need to handle. */ -#define ARM_MAX_REGISTER_RAW_SIZE 12 -#define ARM_MAX_REGISTER_VIRTUAL_SIZE 8 - /* Size of integer registers. */ -#define INT_REGISTER_RAW_SIZE 4 -#define INT_REGISTER_VIRTUAL_SIZE 4 +#define INT_REGISTER_SIZE 4 /* Say how long FP registers are. Used for documentation purposes and code readability in this header. IEEE extended doubles are 80 bits. DWORD aligned they use 96 bits. */ -#define FP_REGISTER_RAW_SIZE 12 - -/* GCC doesn't support long doubles (extended IEEE values). The FP - register virtual size is therefore 64 bits. Used for documentation - purposes and code readability in this header. */ -#define FP_REGISTER_VIRTUAL_SIZE 8 +#define FP_REGISTER_SIZE 12 /* Status registers are the same size as general purpose registers. Used for documentation purposes and code readability in this diff --git a/gdb/armnbsd-tdep.c b/gdb/armnbsd-tdep.c index 88cf2e52797..0ce46e653df 100644 --- a/gdb/armnbsd-tdep.c +++ b/gdb/armnbsd-tdep.c @@ -27,7 +27,7 @@ /* Description of the longjmp buffer. */ #define ARM_NBSD_JB_PC 24 -#define ARM_NBSD_JB_ELEMENT_SIZE INT_REGISTER_RAW_SIZE +#define ARM_NBSD_JB_ELEMENT_SIZE INT_REGISTER_SIZE /* For compatibility with previous implemenations of GDB on arm/NetBSD, override the default little-endian breakpoint. */ diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c index 2db0a910d83..eab68eaf9e4 100644 --- a/gdb/remote-rdp.c +++ b/gdb/remote-rdp.c @@ -630,7 +630,7 @@ remote_rdp_fetch_register (int regno) } else { - char buf[ARM_MAX_REGISTER_RAW_SIZE]; + char buf[MAX_REGISTER_SIZE]; if (regno < 15) rdp_fetch_one_register (1 << regno, buf); else if (regno == ARM_PC_REGNUM) @@ -660,7 +660,7 @@ remote_rdp_store_register (int regno) } else { - char tmp[ARM_MAX_REGISTER_RAW_SIZE]; + char tmp[MAX_REGISTER_SIZE]; deprecated_read_register_gen (regno, tmp); if (regno < 15) rdp_store_one_register (1 << regno, tmp); -- 2.30.2