C
Chris Stankevitz
Hi,
I have some weird behavior in a very large (500,000 line) program that I
boiled down to a few lines:
TCSensorMode:rocessMeasurement()
{
InternalComplicatedFunction(1.0, 2.0);
int a = abs(1);
int b = abs(1);
int c = abs(1);
int d = abs(1);
int e = abs(1);
int f = abs(1);
int g = abs(1);
}
The abs calls were there to "stimulate" the stack frame pointer and try to
get the error to happen. After the call to d=abs(1), all my local variables
address get offset. Including "this". Then after f=abs(1) they go back to
normal. The "original" version of this function did not have these abs
calls, they were more complicated functions related to my application. It
is interesting that the stack pointer (esp) and the "activation frame"
pointer (ebp) do not change while executing (F10 in the debugger) each line
in the above function.
This problem popped up from time to time over the past 6 months. I have
been at a loss to explain it. Just recently I got fed up and started
commenting out massive amounts of code in an attempt to track down the
problem.
I discovered an iterator was going past end and subsequently was
dereferenced and who knows what. However, this happened long before
ProcessMeasurement() was called (not within ProcessMeasurement as I
suspected I would find).
After I fixed the out of bounds iterator, my local variable address problem
went away. Only time will tell if it will return.
My question:
Could the out-of-bounds iterator from a "long time" ago cause this very odd
local variable adress changing problem after d=abs(1)? Could I have finally
fixed my problem?
Thanks for the help,
Chris
PS: My original post regarding this issue: http://tinyurl.com/5urzd
I have some weird behavior in a very large (500,000 line) program that I
boiled down to a few lines:
TCSensorMode:rocessMeasurement()
{
InternalComplicatedFunction(1.0, 2.0);
int a = abs(1);
int b = abs(1);
int c = abs(1);
int d = abs(1);
int e = abs(1);
int f = abs(1);
int g = abs(1);
}
The abs calls were there to "stimulate" the stack frame pointer and try to
get the error to happen. After the call to d=abs(1), all my local variables
address get offset. Including "this". Then after f=abs(1) they go back to
normal. The "original" version of this function did not have these abs
calls, they were more complicated functions related to my application. It
is interesting that the stack pointer (esp) and the "activation frame"
pointer (ebp) do not change while executing (F10 in the debugger) each line
in the above function.
This problem popped up from time to time over the past 6 months. I have
been at a loss to explain it. Just recently I got fed up and started
commenting out massive amounts of code in an attempt to track down the
problem.
I discovered an iterator was going past end and subsequently was
dereferenced and who knows what. However, this happened long before
ProcessMeasurement() was called (not within ProcessMeasurement as I
suspected I would find).
After I fixed the out of bounds iterator, my local variable address problem
went away. Only time will tell if it will return.
My question:
Could the out-of-bounds iterator from a "long time" ago cause this very odd
local variable adress changing problem after d=abs(1)? Could I have finally
fixed my problem?
Thanks for the help,
Chris
PS: My original post regarding this issue: http://tinyurl.com/5urzd