This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [i386/stabs] Arguments of main on gcc >= 4.1


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]