From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18872 invoked by alias); 28 Dec 2007 13:22:19 -0000 Received: (qmail 18862 invoked by uid 22791); 28 Dec 2007 13:22:18 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 28 Dec 2007 13:22:13 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 9A73E2A9670; Fri, 28 Dec 2007 08:22:11 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id fmxMF-wkq42T; Fri, 28 Dec 2007 08:22:11 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 989A02A9661; Fri, 28 Dec 2007 08:22:10 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 61246E7ACB; Fri, 28 Dec 2007 17:22:03 +0400 (RET) Date: Fri, 28 Dec 2007 14:31:00 -0000 From: Joel Brobecker To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [i386/stabs] Arguments of main on gcc >= 4.1 Message-ID: <20071228132203.GF24450@adacore.com> References: <47503C57.6010308@portugalmail.pt> <20071203182540.GB14306@adacore.com> <20071217004444.GA14356@caradoc.them.org> <20071217041159.GB9022@adacore.com> <20071217133121.GA23586@caradoc.them.org> <20071217142204.GI9022@adacore.com> <47744F3A.50005@portugalmail.pt> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47744F3A.50005@portugalmail.pt> User-Agent: Mutt/1.4.2.2i 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: 2007-12/txt/msg00438.txt.bz2 > Hummm, does gcc currently align the stack in functions other than > 'main' ? If so, I'll have to check if this is a 'main' only problem, > or if it happens on other functions. I am not a compiler expert, but I remember a light discussion I was having with Olivier Hainque, and he was mentioning alignment issues when calling C subprograms for Ada subprograms. So this does suggest that this is not a main-only problem. To be confirmed, however... > >I wonder how this all works if GCC < 4.1 is being used. > > > > Gcc 3.4.4-cygwin works ok and doesn't need this patch. My concern at this point is whether GDB still works in this case after you applied your patch. Unless GCC 3.4.4 doesn't emit the stack-alignment code, it should no longer work... The questions at this point are: Can we support both conventions? Do we even want to? The fact that this has nobody before you reported that this is broken since 4.1 shows that this is probably not an extremely important issue. Perhaps it's fine to only support the new convention. To be discussed with the other maintainers, in particular Mark Kettenis, who is the area maintainer on this. > I was fearing that if the bug would be later fixed on > gcc side, we'd have no way to detect it. That too :-). > I see some movement at gcc@/gcc-patches@ about changing the stack > alignment scheme on i386. That may be perfect. If we get the debug > output fixed in the same release the prologue code changes, all will > be fine. OK, so I will consider that this thread is currently on hold, pending discussions in GCC. > * i386-tdep.c (struct i386_frame_cache): Rename saved_sp to > prev_frame_sp. Add saved_sp_regnum field. > (i386_alloc_frame_cache): Update. > (i386_analyze_stack_align): Record which register holds %esp in > saved_sp_regnum. > (i386_analyze_register_saves): Move higher on the file. > (i386_analyze_frame_setup): Account for register saves before > stack adjustment. > (i386_frame_cache): If possible, prefer reading the register that > holds the previous stack pointer from the stack . > (i386_frame_prev_register): Update. > > All these could go in independently of the below hunks, though. I would suggest you ask Mark. (resend him a new patch, I'm sure he'll appreciate not having to sort which parts you want to be included ;-). -- Joel