This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [libiberty and gdb] floatformat_is_valid
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 18 Sep 2003 16:31:00 -0400
- Subject: Re: [libiberty and gdb] floatformat_is_valid
- References: <20030915143933.GA22129@nevyn.them.org>
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.
I'm planning to leave the patch for 6.0.1. Does anyone believe it
should be in 6.0 instead?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer