Segmentation fault accessing local variables
Posted on 2013-05-17
Hello There Experts,
I'm seeing a very strange problem with my multi-threaded C++ application. After calling a certain function (in main()) I can no longer access any local (stack) variables without getting a segmentation fault. Also, calling return() produces the same results. Moving the variables to the heap makes it run. The function called is not passed any of the local variables, but it does create several new threads. I'm suspecting stack corruption, so got the stack pointer using 'register int stackp asm("r1")' and printed out 50 nearest dwords with addresses higher than the stack pointer, but its the same. I set a local variable to a specific value and was able to see it in the print-out, so my method looks like its right.
I'm a C-guy so I'm not sure if I'm missing some C++ thing here or what's going on.
Any advice or help is appreciated,
Btw, I'm using the following