From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23665 invoked by alias); 15 Jul 2003 19:13:34 -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 23653 invoked from network); 15 Jul 2003 19:13:34 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 15 Jul 2003 19:13:34 -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 h6FJDYH31580; Tue, 15 Jul 2003 15:13:34 -0400 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 h6FJDXI07956; Tue, 15 Jul 2003 15:13:33 -0400 Received: from localhost.redhat.com (romulus-int.sfbay.redhat.com [172.16.27.46]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h6FJDWP05395; Tue, 15 Jul 2003 15:13:32 -0400 Received: by localhost.redhat.com (Postfix, from userid 469) id 1180E2CA3B; Tue, 15 Jul 2003 15:20:45 -0400 (EDT) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16148.21516.843971.449438@localhost.redhat.com> Date: Tue, 15 Jul 2003 19:13:00 -0000 To: Michael Snyder Cc: gdb-patches@sources.redhat.com, ezannoni Subject: Re: [RFA] Improvements for sh double register display In-Reply-To: <3F031E03.3040206@redhat.com> References: <3F031E03.3040206@redhat.com> X-SW-Source: 2003-07/txt/msg00305.txt.bz2 Michael Snyder writes: > 2003-07-02 Michael Snyder > > * sh-tdep.c (do_dr_register_info): Fix register number output > (0, 2, 4, ... not 0, 1, 2...). Display DP register both in > hex and in floating point (noting when it is not valid FP). > > Index: sh-tdep.c > =================================================================== > RCS file: /cvs/src/src/gdb/sh-tdep.c,v > retrieving revision 1.132 > diff -p -r1.132 sh-tdep.c > *** sh-tdep.c 13 Jun 2003 04:40:34 -0000 1.132 > --- sh-tdep.c 2 Jul 2003 18:00:22 -0000 > *************** static void > *** 3928,3938 **** > do_dr_register_info (int dr_regnum) > { > int first_fp_reg_num = dr_reg_base_num (dr_regnum); > > ! printf_filtered ("dr%d\t0x%08x%08x\n", > ! dr_regnum - gdbarch_tdep (current_gdbarch)->DR0_REGNUM, > ! (int) read_register (first_fp_reg_num), > ! (int) read_register (first_fp_reg_num + 1)); > } > > /* Double precision registers, compact mode. */ > --- 3928,3962 ---- > do_dr_register_info (int dr_regnum) > { > int first_fp_reg_num = dr_reg_base_num (dr_regnum); > + char *raw_buffer; > + double dbl; > + int inv; > > ! /* Allocate space for the float. */ > ! raw_buffer = (char *) alloca (2 * REGISTER_RAW_SIZE (FP0_REGNUM)); Can you use something other than alloca here? Also, this will collide in mid air with Corinna's revamp. Maybe you can revisit this after she is done? Otherwise it's ok. elena > ! > ! /* Get the data in raw format. */ > ! if (!frame_register_read (get_selected_frame (), > ! first_fp_reg_num, raw_buffer) > ! || !frame_register_read (get_selected_frame (), > ! first_fp_reg_num + 1, > ! raw_buffer + REGISTER_RAW_SIZE (FP0_REGNUM))) > ! error ("can't read register %d (%s)", > ! dr_regnum, REGISTER_NAME (dr_regnum)); > ! > ! /* Get the register as a number */ > ! dbl = unpack_double (builtin_type_double, raw_buffer, &inv); > ! > ! dr_regnum = 2 * (dr_regnum - gdbarch_tdep (current_gdbarch)->DR0_REGNUM); > ! printf_filtered ("dr%d\t0x%08x%08x ", > ! dr_regnum, > ! (int) read_register (first_fp_reg_num), > ! (int) read_register (first_fp_reg_num + 1)); > ! > ! if (inv) > ! printf_filtered ("\n"); > ! else > ! printf_filtered ("(%.9g)\n", dbl); > } > > /* Double precision registers, compact mode. */