From: Kevin Buettner Date: Wed, 5 Nov 2003 16:44:12 +0000 (+0000) Subject: * frv-tdep.c (frv_register_byte): Delete. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cd31fb03d2d6280f1fbfc6eb21be3929c8aafcbb;p=binutils-gdb.git * frv-tdep.c (frv_register_byte): Delete. (frv_extract_return_value, frv_store_return_value) (frv_extract_struct_value_address): Don't call frv_register_byte(). Convert to non-deprecated form. (frv_gdbarch_init): Don't call set_gdbarch_deprecated_register_byte(). Convert calls to set_gdbarch_deprecated_extract_return_value(), set_gdbarch_deprecated_store_return_value(), and set_gdbarch_deprecated_extract_struct_value_address() into non-deprecated forms. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2dc6272a66b..cc820940f7e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2003-11-05 Kevin Buettner + + * frv-tdep.c (frv_register_byte): Delete. + (frv_extract_return_value, frv_store_return_value) + (frv_extract_struct_value_address): Don't call frv_register_byte(). + Convert to non-deprecated form. + (frv_gdbarch_init): Don't call set_gdbarch_deprecated_register_byte(). + Convert calls to set_gdbarch_deprecated_extract_return_value(), + set_gdbarch_deprecated_store_return_value(), and + set_gdbarch_deprecated_extract_struct_value_address() into + non-deprecated forms. + 2003-11-05 Andrew Cagney * mips-tdep.c (mips_dump_tdep): Do not print diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index c110062586d..e184f4de8a5 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -43,8 +43,6 @@ static gdbarch_register_name_ftype frv_register_name; static gdbarch_breakpoint_from_pc_ftype frv_breakpoint_from_pc; static gdbarch_adjust_breakpoint_address_ftype frv_gdbarch_adjust_breakpoint_address; static gdbarch_skip_prologue_ftype frv_skip_prologue; -static gdbarch_deprecated_extract_return_value_ftype frv_extract_return_value; -static gdbarch_deprecated_extract_struct_value_address_ftype frv_extract_struct_value_address; static gdbarch_frameless_function_invocation_ftype frv_frameless_function_invocation; static gdbarch_deprecated_push_arguments_ftype frv_push_arguments; static gdbarch_deprecated_saved_pc_after_call_ftype frv_saved_pc_after_call; @@ -253,12 +251,6 @@ frv_register_type (struct gdbarch *gdbarch, int reg) return builtin_type_int32; } -static int -frv_register_byte (int reg) -{ - return (reg * 4); -} - static int frv_register_sim_regno (int reg) { @@ -822,20 +814,35 @@ frv_frame_unwind_cache (struct frame_info *next_frame, } static void -frv_extract_return_value (struct type *type, char *regbuf, char *valbuf) +frv_extract_return_value (struct type *type, struct regcache *regcache, + void *valbuf) { - memcpy (valbuf, (regbuf - + frv_register_byte (8) - + (TYPE_LENGTH (type) < 4 ? 4 - TYPE_LENGTH (type) : 0)), - TYPE_LENGTH (type)); + int len = TYPE_LENGTH (type); + + if (len <= 4) + { + ULONGEST gpr8_val; + regcache_cooked_read_unsigned (regcache, 8, &gpr8_val); + store_unsigned_integer (valbuf, len, gpr8_val); + } + else if (len == 8) + { + ULONGEST regval; + regcache_cooked_read_unsigned (regcache, 8, ®val); + store_unsigned_integer (valbuf, 4, regval); + regcache_cooked_read_unsigned (regcache, 9, ®val); + store_unsigned_integer ((bfd_byte *) valbuf + 4, 4, regval); + } + else + internal_error (__FILE__, __LINE__, "Illegal return value length: %d", len); } static CORE_ADDR -frv_extract_struct_value_address (char *regbuf) +frv_extract_struct_value_address (struct regcache *regcache) { - return extract_unsigned_integer (regbuf + - frv_register_byte (struct_return_regnum), - 4); + ULONGEST addr; + regcache_cooked_read_unsigned (regcache, struct_return_regnum, &addr); + return addr; } static void @@ -957,19 +964,26 @@ frv_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, } static void -frv_store_return_value (struct type *type, char *valbuf) +frv_store_return_value (struct type *type, struct regcache *regcache, + const void *valbuf) { - int length = TYPE_LENGTH (type); - int reg8_offset = frv_register_byte (8); - - if (length <= 4) - deprecated_write_register_bytes (reg8_offset + (4 - length), valbuf, - length); - else if (length == 8) - deprecated_write_register_bytes (reg8_offset, valbuf, length); + int len = TYPE_LENGTH (type); + + if (len <= 4) + { + bfd_byte val[4]; + memset (val, 0, sizeof (val)); + memcpy (val + (4 - len), valbuf, len); + regcache_cooked_write (regcache, 8, val); + } + else if (len == 8) + { + regcache_cooked_write (regcache, 8, valbuf); + regcache_cooked_write (regcache, 9, (bfd_byte *) valbuf + 4); + } else internal_error (__FILE__, __LINE__, - "Don't know how to return a %d-byte value.", length); + "Don't know how to return a %d-byte value.", len); } @@ -1193,7 +1207,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pc_regnum (gdbarch, pc_regnum); set_gdbarch_register_name (gdbarch, frv_register_name); - set_gdbarch_deprecated_register_byte (gdbarch, frv_register_byte); set_gdbarch_register_type (gdbarch, frv_register_type); set_gdbarch_register_sim_regno (gdbarch, frv_register_sim_regno); @@ -1205,11 +1218,11 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frameless_function_invocation (gdbarch, frv_frameless_function_invocation); set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention); - set_gdbarch_deprecated_extract_return_value (gdbarch, frv_extract_return_value); + set_gdbarch_extract_return_value (gdbarch, frv_extract_return_value); set_gdbarch_deprecated_store_struct_return (gdbarch, frv_store_struct_return); - set_gdbarch_deprecated_store_return_value (gdbarch, frv_store_return_value); - set_gdbarch_deprecated_extract_struct_value_address (gdbarch, frv_extract_struct_value_address); + set_gdbarch_store_return_value (gdbarch, frv_store_return_value); + set_gdbarch_extract_struct_value_address (gdbarch, frv_extract_struct_value_address); /* Frame stuff. */ set_gdbarch_unwind_pc (gdbarch, frv_unwind_pc);