This is the mail archive of the gdb@sources.redhat.com 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: Variable "foo" is not available


> 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.


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