Call stack location?

OP #1245754
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.
Moderator
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".
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

A question of your own? This thread is over 17 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.