From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6747 invoked by alias); 10 Aug 2012 14:32:14 -0000 Received: (qmail 6732 invoked by uid 22791); 10 Aug 2012 14:32:13 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Aug 2012 14:32:00 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id q7AEVnMj026057; Fri, 10 Aug 2012 16:31:49 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id q7AEVlMM027471; Fri, 10 Aug 2012 16:31:47 +0200 (CEST) Date: Fri, 10 Aug 2012 14:32:00 -0000 Message-Id: <201208101431.q7AEVlMM027471@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: uweigand@de.ibm.com CC: yao@codesourcery.com, gdb-patches@sourceware.org, thomas@codesourcery.com, gdb@sourceware.org In-reply-to: <201208101256.q7ACukE5013146@d06av02.portsmouth.uk.ibm.com> (uweigand@de.ibm.com) Subject: Re: Memory corruption for host double format different from target double format References: <201208101256.q7ACukE5013146@d06av02.portsmouth.uk.ibm.com> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-08/txt/msg00032.txt.bz2 > Date: Fri, 10 Aug 2012 14:56:46 +0200 (CEST) > From: "Ulrich Weigand" > > 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 ... Initializing _bit based on _format by default makes sense, but I don't think this is easy to implement given the way how the gdbarch.c code is generated. Making _format mandatory doesn't make sense to me though. I'd say that ieee_single and ieee_double are perfectly reasonable defaults for float_format and double_format. > [ 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. ] I don't think that's possible. Many (all?) debug formats only encode the size of floating-point variables.