This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFC]: remove inconsistency in printcmd.c: print_scalar_formatted
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Kevin Buettner <kevinb at redhat dot com>
- Cc: Jeff Johnston <jjohnstn at redhat dot com>, gdb-patches at sources dot redhat dot com
- Date: Fri, 12 Dec 2003 18:05:49 -0500
- Subject: Re: [RFC]: remove inconsistency in printcmd.c: print_scalar_formatted
- References: <3FDA26B1.6010704@redhat.com> <1031212221704.ZM22539@localhost.localdomain>
On Fri, Dec 12, 2003 at 03:17:04PM -0700, Kevin Buettner wrote:
> Something that I've wanted from time to time is a way to print the
> bits comprising a value as some other type. E.g, if I have a float,
> I'd like to be be able to print the bits that comprise the float as an
> int (or vice versa). At first, I thought that was the intent of
> print_scalar_formatted(), but I see now that it's not. If the value
> is stored in memory, you can do it with the appropriate cast, e.g,
> if ``val'' is of type float, you can do ``print *(int *)&val'', but
> AFAIK, you can't do this for values stored in registers or convenience
> variables. If we had such a mechanism, then I think we'd need some
> code similar to the chunk that you're deleting.
Personally, I've always thought that this is a more natural
interpretation of print/x on a floating point value. Yes, I realize
it's not what GDB has ever done - I don't know what other people think
about this, or whether it would be a useful change, but since we only
support printing floating point numbers in base 10 it seems more useful
to dump the bit pattern rather than round to nearest integer.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer