This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Memory corruption for host double format different from target double format
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: yao at codesourcery dot com (Yao Qi)
- Cc: gdb-patches at sourceware dot org, thomas at codesourcery dot com (Thomas Schwinge), gdb at sourceware dot org
- Date: Fri, 10 Aug 2012 14:56:46 +0200 (CEST)
- Subject: Re: Memory corruption for host double format different from target double format
Yao Qi wrote:
> On Friday, August 10, 2012 11:32:53 AM Thomas Schwinge wrote:
> > That is, if set_gdbarch_double_format has not been called, it will
> > default to floatformats_ieee_double -- even though set_gdbarch_double_bit
> > may have been called setting it unequal to the 64-bit double format.
> > Hmm, and gdbarch.c:verify_gdbarch has the following comment on top of it:
> > Ensure that all values in a GDBARCH are reasonable. ;-)
>
> Looks like some checking like this is missing?
>
> gdbarch->float_format->totalsize <= gdbarch->float_bit
> gdbarch->double_format->totalsize <= gdbarch->double_bit
In fact, I'd prefer to make gdbarch_double_format etc. *mandatory*
and gdbarch_double_bit etc. optional, defaulting to the format size.
(Currently, _bit is mandatory and _format is optional.)
This would mean that nearly all calls to set_gdbarch_double_bit
could go away, with the exception of special cases like "long double"
on i386 ...
[ I guess we could also hunt down and remove the final few places
that still create a TYPE_CODE_FLT with no format set; then the
floatflormat_from_length routine could go away completely. ]
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com