-
October 27th, 2009, 10:18 AM
#1
Visual Studio 2005: "step back"
Hi,
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?
thanks
-
October 27th, 2009, 10:23 AM
#2
Re: Visual Studio 2005: "step back"
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.
Results can be unpredictable.
-
October 27th, 2009, 06:12 PM
#3
Re: Visual Studio 2005: "step back"
thanks for the reply.
I noticed my call stack window only displays the current line being processed. I do not get a listing of processed calls to pop back to.
I viewed the options for the stack windows and did not see anything that hints to listing all calls in a function. what am I missing?
-
October 27th, 2009, 07:00 PM
#4
Re: Visual Studio 2005: "step back"
Originally Posted by Momentum
...what am I missing?
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:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
October 27th, 2009, 07:16 PM
#5
Re: Visual Studio 2005: "step back"
Originally Posted by Momentum
thanks for the reply.
I noticed my call stack window only displays the current line being processed. I do not get a listing of processed calls to pop back to.
I viewed the options for the stack windows and did not see anything that hints to listing all calls in a function. what am I missing?
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.
-
October 27th, 2009, 07:24 PM
#6
Re: Visual Studio 2005: "step back"
Originally Posted by GCDEF
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:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
October 27th, 2009, 07:25 PM
#7
Re: Visual Studio 2005: "step back"
Originally Posted by VladimirF
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?
I don't think anything's corrupted, I'm currently able to step forward and into functions without any problems.
-
October 27th, 2009, 07:29 PM
#8
Re: Visual Studio 2005: "step back"
Originally Posted by GCDEF
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?
-
October 27th, 2009, 07:32 PM
#9
Re: Visual Studio 2005: "step back"
Originally Posted by VladimirF
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?
-
October 27th, 2009, 07:39 PM
#10
Re: Visual Studio 2005: "step back"
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.
-
October 27th, 2009, 07:54 PM
#11
Re: Visual Studio 2005: "step back"
Originally Posted by GCDEF
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.
bingo! thanks for the explanation.
also thanks VladimirF.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|