This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC]: remove inconsistency in printcmd.c: print_scalar_formatted


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]