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


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



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