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

Joel Brobecker brobecker@adacore.com
Fri Dec 28 14:31:00 GMT 2007


> 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



More information about the Gdb-patches mailing list