|
From: Nicholas N. <nj...@cs...> - 2005-12-24 22:29:02
|
Hi,
I noticed that this check in coregrind/m_stacks.c:VG_(unknown_SP_update)()
is being triggered a lot in programs that don't do any stack switching:
/* Check if the stack pointer is still in the same stack as before. */
if (current_stack == NULL ||
new_SP < current_stack->start || new_SP > current_stack->end) {
VG_(printf)("new_SP = %p, curr->start = %p, curr->end = %p\n",
new_SP, current_stack->start, current_stack->end);
Stack* new_stack = find_stack_by_addr(new_SP);
if (new_stack && new_stack->id != current_stack->id) {
/* The stack pointer is now in another stack. Update the current
stack information and return without doing anything else. */
current_stack = new_stack;
return;
}
}
The problem is that in m_main.c the main stack is registered at a minimal
size, on my machine it's 0xBEFFF000--0xBEFFFFFF. And then it extends
beyond that, so the above "out of range" case matches for values like
0xBEFFEFE4, 0xBEFFEF64, 0xBEFFEF1C, etc. But the calls to
find_stack_by_addr() fail -- because there are no other stacks -- and so
it doesn't get changed. And then the cycle repeats.
This only occurs on the non-common SP changes -- for the common ones (eg.
increment/decrement by 4) stack membership is not tested for.
Basically the problem is that registered stacks cannot be extended. Or
perhaps that the main stack is not setup with a big enough range.
Perhaps we should make it 8MB to begin with (or whatever ulimit says it
can be)?
Thoughts?
Nick
|