From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13158 invoked by alias); 21 Sep 2003 19:11:55 -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 13151 invoked from network); 21 Sep 2003 19:11:54 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 21 Sep 2003 19:11:54 -0000 Received: from drow by nevyn.them.org with local (Exim 4.22 #1 (Debian)) id 1A19cf-000371-OI for ; Sun, 21 Sep 2003 15:11:53 -0400 Date: Sun, 21 Sep 2003 19:11:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Re: [libiberty and gdb] floatformat_is_valid Message-ID: <20030921191153.GA11900@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20030915143933.GA22129@nevyn.them.org> <20030918203059.GA21339@nevyn.them.org> <3F6A38D9.6050603@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F6A38D9.6050603@redhat.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-09/txt/msg00447.txt.bz2 On Thu, Sep 18, 2003 at 06:59:37PM -0400, Andrew Cagney wrote: > >On Mon, Sep 15, 2003 at 10:39:33AM -0400, Daniel Jacobowitz wrote: > > > >>GDB's "struct value" has a union in it. This union, named "aligner", has > >>a > >>long double member as well as several others; its goal is to be a cheap > >>way > >>to ensure that we can load all sorts of values straight from the value > >>structure, without alignment problems. Unfortunately, this means that > >>when > >>debugging GDB we tend to feed random bytes to printf ("%.35Lg"). That's > >>not > >>kosher, and on i386 I've found a whole bunch of numbers which can crash > >>it - > >>the gist is that GMP shifts normalized numbers over until it hits a one > >>bit, > >>and if the explicit integer bit isn't set it walks right out of the > >>number. > >> > >>This could show up in other places too. Anywhere you print floating-point > >>data from the inferior, really. > >> > >>So here's a patch which checks for the problem. I added > >>floatformat_is_valid to libiberty/floatformat.c. Is this OK? > >>[Do I need approval? Floatformat.c is in libiberty, but marked as part of > >>GDB.] > >> > >>Oh, this patch misses some copyright year updates. I'll get them before > >>checking in. > > > > > >This patch fixes a really annoyin problem when debugging GDB. It > >doesn't generally come up debugging anything else, though. > > For the record, I don't care :-) It appears to work (I guess my > revision should go in?), and fixes a bug. I asked myself, "Dan, are you going to add this patch to all your GDB packages anyway?" The answer was yes, so I'm checking it in. +2003-09-19 Daniel Jacobowitz + + Merge from mainline: + 2003-09-15 Daniel Jacobowitz + + * values.c (unpack_double): Call floatformat_is_valid. +2003-09-15 Andrew Cagney + + * floatformat.h (floatformat_to_double): Make input buffer constant. + (floatformat_from_double, floatformat_is_valid): Ditto. + +2003-09-15 Daniel Jacobowitz + + * floatformat.h (floatformat_is_valid): Add prototype. + +2003-09-15 Andrew Cagney + + * floatformat.c (get_field): Make "data" constant. + (floatformat_is_valid, floatformat_to_double): Make "from" + constant, fix casts. + (floatformat_from_double): Make "from" constant. + +2003-09-15 Daniel Jacobowitz + + * floatformat.c (floatformat_is_valid): New function. + (get_field, put_field): Correct comments. + -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer