This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [i386/stabs] Arguments of main on gcc >= 4.1
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Pedro Alves <pedro_alves at portugalmail dot pt>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 3 Dec 2007 10:25:40 -0800
- Subject: Re: [i386/stabs] Arguments of main on gcc >= 4.1
- References: <47503C57.6010308@portugalmail.pt>
> 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