Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Eli Zaretskii" <eliz@gnu.org>
To: Daniel THOMPSON <daniel.thompson@st.com>
Cc: drow@false.org, gdb@sources.redhat.com, Reiner.Steib@gmx.de
Subject: Re: Variable "foo" is not available
Date: Mon, 04 Apr 2005 19:28:00 -0000	[thread overview]
Message-ID: <01c5394b$Blat.v2.4$d4951e40@zahav.net.il> (raw)
In-Reply-To: <4250F37B.8090707@st.com> (message from Daniel THOMPSON on Mon, 04 Apr 2005 08:57:47 +0100)

> Date: Mon, 04 Apr 2005 08:57:47 +0100
> From: Daniel THOMPSON <daniel.thompson@st.com>
> Cc: Daniel Jacobowitz <drow@false.org>, gdb@sources.redhat.com,
>         Reiner.Steib@gmx.de
> 
> >>With stack-based argument passing, GCC may be claiming an argument is
> >>unavailable when the function's local copy is dead, when a copy still
> >>exists on the stack somewhere.  I don't know if it will do that or not.
> >>GDB can not assume that the argument is available in the incoming stack
> >>slot, since it could be reused for other data.
> > 
> > 
> > What, if any, would be the expression of this in the machine code?
> > 
> > Also, I don't quite understand how can a stack slot of a function call
> > argument be reused before the function returns.  Isn't that slot
> > outside the function's frame?  Reusing it would be a violation of the
> > ABI, right?
> 
> I doubt it.
> 
> The following C is perfectly valid.
> 
> void foo(int a, int b, int c, int d)
> {
> 	a = b + c;
> 	printf("a+d = %d\n", a, d);
> 	printf("b = %d\n", b);
> }
> 
> On modern architectures with a decent number of registers (including 
> IIRC the x86-64) a, b and c will be passed in registers rather than on 
> the stack.

Please note that, as should be clear from the citations above, my
question was about reusing a stack slot under a stack-based argument
passing scheme, not about passing arguments in registers.


  reply	other threads:[~2005-04-04 19:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-01 16:40 Reiner Steib
2005-04-01 17:19 ` Daniel Jacobowitz
2005-04-02  9:49   ` Eli Zaretskii
2005-04-02 13:53     ` Reiner Steib
2005-04-02 14:27       ` Daniel Jacobowitz
2005-04-06 16:25         ` Reiner Steib
2005-04-02 14:26     ` Daniel Jacobowitz
2005-04-02 18:17       ` Eli Zaretskii
2005-04-02 18:40         ` Daniel Jacobowitz
2005-04-02 20:58           ` Eli Zaretskii
2005-04-02 21:05             ` Daniel Jacobowitz
2005-04-04  5:14               ` Eli Zaretskii
2005-04-04  6:00                 ` Mark Kettenis
2005-04-04  7:58                 ` Daniel THOMPSON
2005-04-04 19:28                   ` Eli Zaretskii [this message]
2005-04-04 13:37                 ` Daniel Jacobowitz
2005-04-04 19:35                   ` Eli Zaretskii
2005-04-04 19:41                     ` Daniel Jacobowitz
2005-04-03 18:16           ` Reiner Steib
2005-04-08 11:05       ` Eli Zaretskii
2005-04-04  9:26     ` Reiner Steib

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='01c5394b$Blat.v2.4$d4951e40@zahav.net.il' \
    --to=eliz@gnu.org \
    --cc=Reiner.Steib@gmx.de \
    --cc=daniel.thompson@st.com \
    --cc=drow@false.org \
    --cc=gdb@sources.redhat.com \
    /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