From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6214 invoked by alias); 28 Dec 2007 01:20:10 -0000 Received: (qmail 6205 invoked by uid 22791); 28 Dec 2007 01:20:10 -0000 X-Spam-Check-By: sourceware.org Received: from fg-out-1718.google.com (HELO fg-out-1718.google.com) (72.14.220.159) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 28 Dec 2007 01:20:04 +0000 Received: by fg-out-1718.google.com with SMTP id e12so1587237fga.0 for ; Thu, 27 Dec 2007 17:20:01 -0800 (PST) Received: by 10.82.134.12 with SMTP id h12mr15661083bud.29.1198804801309; Thu, 27 Dec 2007 17:20:01 -0800 (PST) Received: from ?88.210.77.177? ( [88.210.77.177]) by mx.google.com with ESMTPS id d23sm6571559nfh.24.2007.12.27.17.19.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 27 Dec 2007 17:20:00 -0800 (PST) Message-ID: <47744F3A.50005@portugalmail.pt> Date: Fri, 28 Dec 2007 01:20:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.0 MIME-Version: 1.0 To: Joel Brobecker CC: gdb-patches@sourceware.org Subject: Re: [i386/stabs] Arguments of main on gcc >= 4.1 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> In-Reply-To: <20071217142204.GI9022@adacore.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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/msg00425.txt.bz2 Joel Brobecker wrote: > Daniel Jacobowitz wrote: >> I think that the major difference between a GDB bug and a GCC bug is >> whether we have to get GCC fixed - either way, since it's been in >> several releases, handling it in GDB is at least worth considering. > That was my opinion when I posted the patch, and still is. > That makes sense. > > I put a "patch champion" hat on and had a look at the proposed patch. > If I understand correctly, it looks like the code is detecting stack > alignment code, and if it does, then it considers that the parameters > will be relative to the arguments region address. > That's correct. 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 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. I'll have to build a few gcc's more to check that the problem was introduced when the stack alignment was introduced. I was fearing that if the bug would be later fixed on gcc side, we'd have no way to detect it. 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. * 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. (i386_frame_args_address): New. (i386_frame_base): Set i386_frame_args_address as args method. -- Pedro Alves