EmbDev.net

Forum: ARM programming with GCC/GNU tools Call stack location?


von Joe D. (jdupre)


Rate this post
useful
not useful
What defines where the call stack is located?

I'm debugging in Eclipse and I see that the the bottom of the call stack 
is getting corrupted. (i.e the initiating call of the chain is ending up 
with an bad memory address.)  But I can't find where these addresses are 
in memory.

my boot.s and linker script define the ARM7 mode stack areas at the top 
of RAM.  But when I look in there I do not see anything remotely near 
the return addresses that are displayed in Eclipse.

All this on LPC2368 using yagato toolchain.

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
Joe Dupre wrote:
> What defines where the call stack is located?
> I'm debugging in Eclipse and I see that the the bottom of the call stack
> is getting corrupted. (i.e the initiating call of the chain is ending up
> with an bad memory address.)  But I can't find where these addresses are
> in memory.
>
> my boot.s and linker script define the ARM7 mode stack areas at the top
> of RAM.

Show your boot.s and linker-script.

> But when I look in there I do not see anything remotely near
> the return addresses that are displayed in Eclipse.

Please explain what you mean by "I do not see anything remotely near the 
return addresses that are displayed in Eclipse".

von Clifford S. (clifford)


Rate this post
useful
not useful
Joe Dupre wrote:
> What defines where the call stack is located?
>
> But I can't find where these addresses are
> in memory.
>

There is no separate call stack; the return addresses, function 
arguments, and local variables share the same stack. Each function For 
that reason, the most common cause of call stack corruption is a buffer 
overrun or similar on a local variable or pointer argument to a caller's 
local variable.

The call stack in the debugger filters the system stack to show just 
calls.

The simplest way to find the error is to step your code observing the 
call stack until it corrupts - then you have located the offending line. 
If teh code is long you will need to to a divide an conquer approach and 
run the code repeatedly to narrow it down.

Clifford

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.