This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Detecting and printing 128-bit long double values for PPC
On Mon, Apr 30, 2007 at 02:27:43PM +0200, Ulrich Weigand wrote:
> Luis Machado wrote:
>
> > Isn't GDB currently able to detect the type length in runtime in order
> > to correctly print those values?
>
> No, it isn't. How should GDB recognize the difference?
>
> > With this modification i've noticed that GDB cuts the extra precision
> > bytes for a binary built with -mlong-double-64, while printing the value
> > with the total avaiable precision when it's built with
> > -mlong-double-128.
>
> That's interesting. GDB will always read in 16 bytes after your
> modification -- maybe the binary you're building with -mlong-double-64
> happens to have zeros after the "long double" variable your're reading?
GDB will always read 16 bytes when it uses its built in notion of
"long double". But if it gets the type from DWARF info, then it will
be an eight byte floating point type, and I bet GDB is automatically
handling it as a double.
That means that the patch is still incorrect, but the consequences of
getting this wrong are not the immediately obvious ones. I don't know
if saying (long double) in the command line is going to use the type
from debug info or from the gdbarch; our handling of base types has
always confused me somewhat.
--
Daniel Jacobowitz
CodeSourcery