The question says it all. Basically, I am looking for the opposite button to the Step over button in VS code debugger (more precisely, the opposite button to the underlined button).
-
5There is NONE of such functionrioV8– rioV82021-05-02 11:27:43 +00:00Commented May 2, 2021 at 11:27
-
4I wish this was a thing you could do.a1cd– a1cd2021-05-02 13:57:38 +00:00Commented May 2, 2021 at 13:57
-
1Not even theoretically possible without something like VM snapshot integration. And even then whether it worked would depend on whether all IO stayed inside the VM bounds (code doing networking would get out of sync with services outside the host).Charles Duffy– Charles Duffy2021-05-02 17:18:50 +00:00Commented May 2, 2021 at 17:18
-
1That would be a really cool feature, but it would require something that cached the program and computer state and let you rollback to it on request. Quite expensive if even possible. However, my approach is to put a break point on that previous line and run from the beginning again. Not the same, I know, but sometimes it lets me figure out what I wanted.joanis– joanis2021-05-02 21:14:31 +00:00Commented May 2, 2021 at 21:14
-
1@joanis, definitely possible; every major virtualization tool out there (qemu, VirtualBox, VMware) supports snapshots/rollback, so it's just a question of debugger integration. But expensive to be sure. (OTOH, if the error being debugged happens hours into runtime, maybe it would be less expensive than starting from the beginning).Charles Duffy– Charles Duffy2021-05-03 14:57:36 +00:00Commented May 3, 2021 at 14:57
Add a comment
|
2 Answers
You can change next executing line with Debug: Jump to Cursor command.
- Set breakpoint
- Wait for code to stop
- Click on desired line
- Open command list (default is
ctrl + shift + p) - Use
Debug: Jump to Cursor - Enjoy

Note: you can bind this action to some hotkey like (ctrl + f8) doc
5 Comments
a1cd
This does not solve the problem. If you change a variable then step to a line of code before you changed this variable, this variable is still changed and will act this way.
JL0PD
@Evergreen you cannot undo such things because debugger cannot travel in time, but you can change value of variable with
watch panel at right sidea1cd
yes... that is what i mean, if you have a function, and you step over the function and it changes the value of a long list, you have no way to know what the value of the list was before it was changed unless you have superhuman memory. Dont get me wrong, this is a good answer but it does not help in the case where you are debugging complicated code or handling gigantic arrays.
Charles Duffy
@JL0PD, ...but time travel is what the OP is asking to do here, so the proper answer if "no that's not possible" instead of showing them something that looks similar but doesn't actually do what they want.
Saber
It is a decent way and good use of a debugger. You can go back a few lines to reset variable values and re-examine the steps you fast-forwarded. Sometimes re-running the debugger is costly because of huge data loads and other IO tasks.
if it is possible to run you code in a [.ipynb]jupyter notebook file, there is such a functionality in the google colab.
- use
%%debugmagic command and commandupin the debugger prompt.
1 Comment
Charles Duffy
up goes to the outer stack frame. It does not go back in time; when that stack frame has references to data mutated by the last operation, the effect of those mutations is not undone.