From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27728 invoked by alias); 3 Dec 2007 18:25:50 -0000 Received: (qmail 27705 invoked by uid 22791); 3 Dec 2007 18:25:49 -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; Mon, 03 Dec 2007 18:25:45 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A0D382A9822; Mon, 3 Dec 2007 13:25:43 -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 HNcwPD7aFtUL; Mon, 3 Dec 2007 13:25:43 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 6A9682A981D; Mon, 3 Dec 2007 13:25:43 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id EC91BE7ACA; Mon, 3 Dec 2007 10:25:40 -0800 (PST) Date: Mon, 03 Dec 2007 18:25: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: <20071203182540.GB14306@adacore.com> References: <47503C57.6010308@portugalmail.pt> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47503C57.6010308@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/msg00049.txt.bz2 > Since gcc 4.1 and later started putting code in the prologue > to realign the stack pointer, the offset on the > parameter stabs changed from being relative to the frame pointer > to being relative to the argument's address. This is somewhat fuzzy because the stabs format has never been really well defined like DWARF is, but IMO this is a GCC bug. > E.g.: > int main (int argc, char **argv, char **envp); > > notice the 0, 4, 8: > > .zero 16 > .text > .stabs "main:F(0,1)",36,0,10,main > .stabs "argc:p(0,1)",160,0,9,0 > .stabs "argv:p(0,16)=*(3,54)",160,0,9,4 > .stabs "envp:p(0,16)",160,0,9,8 > .globl main > .type main, @function Looking at your example above, what would work is if GCC was using N_LSYM (128) symbols instead of N_PSYM symbols (160). I would definitely be interested in what others think on this. -- Joel