Search code examples
c++cstackstack-overflow

Examining the Stack


I'm having problems with stack overflows and would like to see exactly what the contents on the stack are.

How can I examine the stack frame with GDB? is kind of the same question, however info locals looks fine here (few variables, most of them std::vectors and std::maps), so I wouldn't expect the stack to overflow from this. Moreover, I have set the stack limit to 32MB, so this should be plenty and no recursive functions are used.

Is there a tool that can show the complete contents of the stack, maybe ordered by size?


Solution

  • Stack overflows are better caught by special profilers rather than manually looking at variables in gdb. It is more likely that you have buffer overrun rather than stack overflow. In either case, here is a list of some profilers that can help you to point out the problem:

    Good luck!