Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine the size of the stack at each frame in the Visual Studio 2015 debugger

I am looking at the stack frames for a C++ program stopped in the Visual Studio debugger. What I would like to know is the stack depth associated with each frame. Is there any way to do that in Visual Studio 2015? Does the stack depth correspond to some register value?

The motivation for this is that I am having a problem with a stack overflow exception in C++ code that is called from Python. The stack exception is not in a recursively called function; it is about 10 levels deep in the C++ code on top of the code from Python. It is scientific code that does allocate some arrays on the stack, but I don't think they are too big. I would like to see if the stack is actually getting anywhere near the 1 MB limit in this or its callers.

like image 561
antlersoft Avatar asked Oct 30 '22 07:10

antlersoft


1 Answers

Debug -> Window -> Registers to look at the registers.

Stack pointer is the ESP register or RSP for 64-bit processes.

The stack (on NT, 64-bit at least) grows "down", so the register value will be smaller at the top of the stack.

I did have a method that was allocating a nearly-1MB array on the stack...

like image 130
antlersoft Avatar answered Nov 15 '22 05:11

antlersoft