Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Going back to previous line while debugging on visual studio

I am debugging a piece of code on visual studio and I forgot to note down the values I have kept a watch on. Can I go to previous line without rerunning the entire code? There are similar questions asked on SO but in my case i haven't run through any error or exception. The code is running normally.

like image 513
Srujan Barai Avatar asked Feb 19 '14 07:02

Srujan Barai


2 Answers

After pausing on a break point, right click on the line you want to "go back" to. From the menu that pops up, select "set next statement".

This will adjust the instruction pointer to continue from the specified line of code, but it will not roll back any variables or memory addresses to the values they were at before that line of code was originally executed.

like image 116
selbie Avatar answered Oct 25 '22 00:10

selbie


It sounds like what you want to do is rewind / replay your code rather than just move to a specific line. You can move to a specific line, you can just right click and choose set next statement. Unfortunately, this won't rewind the state of the program to some past point (beyond setting the stack and doing a bit of unwinding).

To rewind/replay you need to be a bit trickier. Some options are: -

  • VMWare replay which will allow you to record and then go back to a certain point in time.
  • Intellitrace. I haven't tried it, but it allows you to replay to a point.

Which is a bit heavyweight and wont help you right now.

like image 42
acarlon Avatar answered Oct 25 '22 00:10

acarlon