From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3290 invoked by alias); 5 Nov 2003 16:59:44 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3257 invoked from network); 5 Nov 2003 16:59:43 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 5 Nov 2003 16:59:43 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id hA5GxgM22471 for ; Wed, 5 Nov 2003 11:59:42 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id hA5Gxg621049 for ; Wed, 5 Nov 2003 11:59:42 -0500 Received: from localhost.localdomain (vpn50-2.rdu.redhat.com [172.16.50.2]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id hA5GxfJm006547 for ; Wed, 5 Nov 2003 11:59:41 -0500 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id hA5GxaG07029 for gdb-patches@sources.redhat.com; Wed, 5 Nov 2003 09:59:36 -0700 Date: Wed, 05 Nov 2003 16:59:00 -0000 From: Kevin Buettner Message-Id: <1031105165936.ZM7028@localhost.localdomain> To: gdb-patches@sources.redhat.com Subject: [PATCH] frv-tdep.c: More de-deprecation. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-11/txt/msg00060.txt.bz2 The point of this exercise was to eliminate frv_register_byte(). As a side effect, the return value code has been cleaned up somewhat (since it was making calls to frv_register_byte()). Patch committed. Kevin * 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. Index: frv-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/frv-tdep.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -p -r1.58 -r1.59 --- frv-tdep.c 1 Nov 2003 01:42:48 -0000 1.58 +++ frv-tdep.c 5 Nov 2003 16:44:12 -0000 1.59 @@ -43,8 +43,6 @@ static gdbarch_register_name_ftype frv_r 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; @@ -254,12 +252,6 @@ frv_register_type (struct gdbarch *gdbar } static int -frv_register_byte (int reg) -{ - return (reg * 4); -} - -static int frv_register_sim_regno (int reg) { static const int spr_map[] = @@ -822,20 +814,35 @@ frv_frame_unwind_cache (struct frame_inf } 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 *gdb } 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); + int len = TYPE_LENGTH (type); - 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); + 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 in 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 in 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);