Reputation: 7118
I am using g++ on Solaris. Is there any way internally or externally to know how much stack size aI have used till now while within a function call? This is required to diagnose a suspected stack overflow.
Upvotes: 1
Views: 102
Reputation: 11
static analysis: request the compiler / linker for static analysis if the stack size of your application (check compiler option -fstack-usage ).
dynamic analysis / approach: use the debugger and set a conditional (write access) breakpoint to the end of your stack. If application writes to the end of the stack, the debugger will stop and present you the call stack and the function which leads to the memory violation .
Upvotes: 1