During debugging of code, you are able to step forward each line, and into a function, but are you able to "step back" a line with all varables and application state resetting to previous values?
Sort of. You can set the current instruction pointer anywhere you want, but the variables won't be restored.
You can also use the call stack to pop back to the previous place on the stack. When you do that, your variables will be restored and you can set the instruction pointer anywhere you like.
Your stack frame, obviously
Seriously: is it a regular Debug session or are you at the scene of a crash? Is your stack pointer corrupted by chance?
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio: FeinViewer - an integrated GDI objects viewer for Visual C++ Debugger, and more...
You'll only get a call stack if you've actually made calls. If it's a simple program without any function calls, that's to be expected.
Debugging this code (breakpoint is on "return 0;")
Code:
#include "stdafx.h"
int main()
{
return 0;
}
I have this much in my Call Stack:
Code:
> ConsTest.exe!main() Line 5 C++
ConsTest.exe!__tmainCRTStartup() Line 597 + 0x19 bytes C
ConsTest.exe!mainCRTStartup() Line 414 C
kernel32.dll!7c817077()
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio: FeinViewer - an integrated GDI objects viewer for Visual C++ Debugger, and more...
You'll only get a call stack if you've actually made calls. If it's a simple program without any function calls, that's to be expected.
I only have a simple class, with member functions.
in the main, I'm just calling the constructor and the member functions.
I understood your suggestion to be, use the call stack window, which will list all calls made to a function.
So when I step into a function or step forward within main, I thougt I'll see the listing of pass calls to the stack in the call stack window?
Debugging this code (breakpoint is on "return 0;")
Code:
#include "stdafx.h"
int main()
{
return 0;
}
I have this much in my Call Stack:
Code:
> ConsTest.exe!main() Line 5 C++
ConsTest.exe!__tmainCRTStartup() Line 597 + 0x19 bytes C
ConsTest.exe!mainCRTStartup() Line 414 C
kernel32.dll!7c817077()
ok, so if you were to add 3 other functions within main, I thought each call will be logged in the call stack window so u could step back to the first function if need be, with varables set to previous value?
If you're inside a function, the call stack will show you how you got there and the debugger will let you move around the current stack. Once you return from a function, it's popped from the stack and you can't get there again through the debugger unless you can place the instruction pointer at the place where the function was called and step into it again.
If you're inside a function, the call stack will show you how you got there and the debugger will let you move around the current stack. Once you return from a function, it's popped from the stack and you can't get there again through the debugger unless you can place the instruction pointer at the place where the function was called and step into it again.
Bookmarks