Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro_alves@portugalmail.pt>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [i386/stabs] Arguments of main on gcc >= 4.1
Date: Fri, 28 Dec 2007 01:20:00 -0000	[thread overview]
Message-ID: <47744F3A.50005@portugalmail.pt> (raw)
In-Reply-To: <20071217142204.GI9022@adacore.com>

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



  reply	other threads:[~2007-12-28  1:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-30 16:40 Pedro Alves
2007-12-03 18:25 ` Joel Brobecker
2007-12-17  0:47   ` Daniel Jacobowitz
2007-12-17  6:42     ` Joel Brobecker
2007-12-17 13:33       ` Daniel Jacobowitz
2007-12-17 15:06         ` Joel Brobecker
2007-12-28  1:20           ` Pedro Alves [this message]
2007-12-28 14:31             ` Joel Brobecker
2007-12-28 22:36               ` Pedro Alves
2007-12-29  3:42                 ` Joel Brobecker
2007-12-30  4:38             ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47744F3A.50005@portugalmail.pt \
    --to=pedro_alves@portugalmail.pt \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox