From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1351 invoked by alias); 11 Feb 2009 22:44:53 -0000 Received: (qmail 1341 invoked by uid 22791); 11 Feb 2009 22:44:52 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Feb 2009 22:44:47 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id n1BMiLPl000500; Wed, 11 Feb 2009 23:44:21 +0100 (CET) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id n1BMiK36012947; Wed, 11 Feb 2009 23:44:21 +0100 (CET) Date: Wed, 11 Feb 2009 22:44:00 -0000 Message-Id: <200902112244.n1BMiK36012947@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: jan.kratochvil@redhat.com CC: drow@false.org, gdb-patches@sourceware.org In-reply-to: <20090211214646.GA22247@host0.dyn.jankratochvil.net> (message from Jan Kratochvil on Wed, 11 Feb 2009 22:46:47 +0100) Subject: Re: [patch] Fix `return' of long/long-long results with no debuginfo References: <20090211194511.GA9324@host0.dyn.jankratochvil.net> <200902112040.n1BKdxb3028188@brahms.sibelius.xs4all.nl> <20090211205045.GB9762@caradoc.them.org> <200902112122.n1BLMf8q000100@brahms.sibelius.xs4all.nl> <20090211214646.GA22247@host0.dyn.jankratochvil.net> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-02/txt/msg00271.txt.bz2 > Date: Wed, 11 Feb 2009 22:46:47 +0100 > From: Jan Kratochvil > > > From: Daniel Jacobowitz > > > Everything we pick will be wrong some of the time, but IMO "long" is > > > maximally useful. "long long" on 32-bit platforms is going to pick > > > up garbage from the next register for int or void * returns. > > Garbage would be seen by caller of a `long long' returning callee where GDB > would return something smaller (like `int'). As GDB writes (not "reads") the > register it just will write zero to one excessive but unused register. This > register must be callee-saved (not caller-saved) by the ABI supporting `long > long' return type and GDB already asserts the return type is > RETURN_VALUE_REGISTER_CONVENTION. Thinking a bit more of this now, things all depend on the calling convention. I'm not convinced casting to `long long' is safe in all cases, especially on 32-bit big-endian machines. It really might do the wrong thing there, exposing garbage or the wrong 32 bits of the 64-bit value. The 'int' case is really special in a sense, very much because of the K&R heritage. It has to work for all types that are sizeof(int) or smaller.