EmbDev.net

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


Author: Joe Dupre (jdupre)
Posted on:

Rate this post
0 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.

Author: Martin Thomas (mthomas) (Moderator)
Posted on:

Rate this post
0 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".

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 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

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.