From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9509 invoked by alias); 10 Mar 2002 02:05:23 -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 9450 invoked from network); 10 Mar 2002 02:05:16 -0000 Received: from unknown (HELO localhost.redhat.com) (24.112.135.44) by sources.redhat.com with SMTP; 10 Mar 2002 02:05:16 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id D49563E0B; Sat, 9 Mar 2002 21:05:13 -0500 (EST) Message-ID: <3C8ABF59.7080908@cygnus.com> Date: Sat, 09 Mar 2002 18:05:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:0.9.8) Gecko/20020210 X-Accept-Language: en-us MIME-Version: 1.0 To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] mips: Fix "info registers" output References: <20010619225007.A10141@nevyn.them.org> <20020307165956.A22042@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-03/txt/msg00127.txt.bz2 > Meanwhile, Andrew, is this trivial fix OK? It just makes us decode the > actual register values instead of two host pointers in our call to > unpack_double. I suspect the code was more broken then you thought! If my memory is correct, the value is always stored LE in the register pair. The code manages to do a double swap and consequently doesn't correctly re-order the registers in the dbl_buffer. It is also really broken when a 32 bit ABI is on a 64 bit ISA. (It very nearly corrupts the stack). > /* copy the two floats into one double, and unpack both */ > - memcpy (dbl_buffer, raw_buffer, 2 * REGISTER_RAW_SIZE (FP0_REGNUM)); > flt1 = unpack_double (builtin_type_float, raw_buffer[HI], &inv1); > flt2 = unpack_double (builtin_type_float, raw_buffer[LO], &inv2); > + memcpy (dbl_buffer, raw_buffer[HI], REGISTER_RAW_SIZE (FP0_REGNUM)); > + memcpy (dbl_buffer + REGISTER_RAW_SIZE (FP0_REGNUM), > + raw_buffer[LO], REGISTER_RAW_SIZE (FP0_REGNUM)); > doub = unpack_double (builtin_type_double, dbl_buffer, &inv3); > I suspect a bigger improvement would look something like (I'm still not 100% sure of what goes where with BE/LE though :-) if (!FP_REGISTER_DOUBLE) char *raw_buffer[2]; char *dbl_buffer; raw_buffer[0] = alloca; [1] = alloca; dbl_buffer = alloca; read_relative_register(regnum+0, raw_buffer[0]) read_relative_register(regnum+1, raw_buffer[1]) if (BE) reg_offset = (REGISTER_RAW_SIZE() == 8) ? 4 : 0; type_float = builtin_type_ieee_single_big type_double = builtin_type_ieee_double_big memcpy dbl_buffer+4, raw_buffer[0] + reg_offset, 4); memcpy dbl_buffer+0, raw_buffer[1] + reg_offset, 4); else reg_offset = 0 type_float = builtin_type_ieee_single_little type_double = builtin_type_ieee_double_little memcpy dbl_buffer+0, raw_buffer[0] + reg_offset, 4); memcpy dbl_buffer+4, raw_buffer[1] + reg_offset, 4); flt0 = unpack_double (type_float, raw_buffer[0] + reg_offset, &inv) flt1 = unpack_double (type_float, raw_buffer[1] + reg_offset, &inv) doub = unpack_double (type_double, dbl_buffer, &inv3) Andrew