Dragging the instruction pointer backward while debugging in Visual Studio

余生颓废 提交于 2019-12-10 23:37:27

问题


For a demonstrating, take a look at the following section of this video.

Basically, I know this is possible in Visual Studio Community Edition 2015. I was wondering:

a) Is this related to Intellitrace and "Historic debugging"? b) Will there be any side-effect when I do this? Or is this just moving the instructions backwards and that's it?


回答1:


It is just moving the instruction pointer backwards and that's it, to use your own words.

This means that:

  • Any side-effects already incurred between where you drag it to and where you dragged it from has already incurred and won't be reversed.
  • Any variables changed in the same section of instructions will still be changed, they are not reversed to whatever values they had at the point you you drag the instruction pointer to

So you can use this debugging aid to either force the program to take a path it didn't (for instance by dragging the instruction pointer inside an if-statement it skipped), to skip (by dragging the instruction pointer past some code you don't want to execute), or to rerun some code.

But you must be aware of the above limitations. If the code is not safe to be executed again, then doing so will likely not help you debug.




回答2:


It's been doable for a long while now. Everything that happened to the point from where you are dragging the cursor already happened, so you will essentially be re-doing that bit.

There are no REAL consequences, unless you are processing something or saving to database etc., as writing the same existing data might throw an exception or mess with processing of some data.

All of the variables that have been set (even if you drag the cursor higher than they initialize) will retain the value they had from the spot you've dragged the cursor upward.



来源:https://stackoverflow.com/questions/37919855/dragging-the-instruction-pointer-backward-while-debugging-in-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!