From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31352 invoked by alias); 4 Jun 2004 22:50:16 -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 31337 invoked from network); 4 Jun 2004 22:50:15 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 4 Jun 2004 22:50:15 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i54MoFi5030230 for ; Fri, 4 Jun 2004 18:50:15 -0400 Received: from zenia.home.redhat.com (porkchop.devel.redhat.com [172.16.58.2]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i54MoB024904; Fri, 4 Jun 2004 18:50:12 -0400 To: gdb-patches@sources.redhat.com Subject: RFA: rs6000_store_return_value: pitch deprecated_write_register_bytes From: Jim Blandy Date: Fri, 04 Jun 2004 22:50:00 -0000 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-06/txt/msg00087.txt.bz2 This removes the use of a deprecated regcache function, and stops registering a deprecated gdbarch method. 2004-06-04 Jim Blandy * rs6000-tdep.c (rs6000_store_return_value): Use regcache_cooked_write_part instead of deprecated_write_register_bytes. (rs6000_gdbarch_init): Register it for gdbarch_store_return_value, not gdbarch_deprecated_store_return_value. Index: gdb/rs6000-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v retrieving revision 1.211 diff -c -p -r1.211 rs6000-tdep.c *** gdb/rs6000-tdep.c 2 Jun 2004 03:06:23 -0000 1.211 --- gdb/rs6000-tdep.c 4 Jun 2004 22:40:18 -0000 *************** rs6000_dwarf2_reg_to_regnum (int num) *** 1894,1931 **** static void ! rs6000_store_return_value (struct type *type, char *valbuf) { ! struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); /* The calling convention this function implements assumes the processor has floating-point registers. We shouldn't be using it on PPC variants that lack them. */ ! gdb_assert (ppc_floating_point_unit_p (current_gdbarch)); if (TYPE_CODE (type) == TYPE_CODE_FLT) - /* Floating point values are returned starting from FPR1 and up. Say a double_double_double type could be returned in FPR1/FPR2/FPR3 triple. */ ! ! deprecated_write_register_bytes ! (DEPRECATED_REGISTER_BYTE (tdep->ppc_fp0_regnum + 1), ! valbuf, ! TYPE_LENGTH (type)); else if (TYPE_CODE (type) == TYPE_CODE_ARRAY) { if (TYPE_LENGTH (type) == 16 && TYPE_VECTOR (type)) ! deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (tdep->ppc_vr0_regnum + 2), ! valbuf, TYPE_LENGTH (type)); } else /* Everything else is returned in GPR3 and up. */ ! deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (gdbarch_tdep (current_gdbarch)->ppc_gp0_regnum + 3), ! valbuf, TYPE_LENGTH (type)); } /* Extract from an array REGBUF containing the (raw) register state the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ --- 1894,1947 ---- static void ! rs6000_store_return_value (struct type *type, ! struct regcache *regcache, ! const void *valbuf) { ! struct gdbarch *gdbarch = get_regcache_arch (regcache); ! struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ! int regnum = -1; /* The calling convention this function implements assumes the processor has floating-point registers. We shouldn't be using it on PPC variants that lack them. */ ! gdb_assert (ppc_floating_point_unit_p (gdbarch)); if (TYPE_CODE (type) == TYPE_CODE_FLT) /* Floating point values are returned starting from FPR1 and up. Say a double_double_double type could be returned in FPR1/FPR2/FPR3 triple. */ ! regnum = tdep->ppc_fp0_regnum + 1; else if (TYPE_CODE (type) == TYPE_CODE_ARRAY) { if (TYPE_LENGTH (type) == 16 && TYPE_VECTOR (type)) ! regnum = tdep->ppc_vr0_regnum + 2; ! else ! gdb_assert (0); } else /* Everything else is returned in GPR3 and up. */ ! regnum = tdep->ppc_gp0_regnum + 3; ! ! { ! size_t bytes_written = 0; ! ! while (bytes_written < TYPE_LENGTH (type)) ! { ! /* How much of this value can we write to this register? */ ! size_t bytes_to_write = min (TYPE_LENGTH (type) - bytes_written, ! register_size (gdbarch, regnum)); ! regcache_cooked_write_part (regcache, regnum, ! 0, bytes_to_write, ! (char *) valbuf + bytes_written); ! regnum++; ! bytes_written += bytes_to_write; ! } ! } } + /* Extract from an array REGBUF containing the (raw) register state the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ *************** rs6000_gdbarch_init (struct gdbarch_info *** 2885,2891 **** else { set_gdbarch_deprecated_extract_return_value (gdbarch, rs6000_extract_return_value); ! set_gdbarch_deprecated_store_return_value (gdbarch, rs6000_store_return_value); } /* Set lr_frame_offset. */ --- 2901,2907 ---- else { set_gdbarch_deprecated_extract_return_value (gdbarch, rs6000_extract_return_value); ! set_gdbarch_store_return_value (gdbarch, rs6000_store_return_value); } /* Set lr_frame_offset. */