Chrome sources debugging has buttons for step over, step into, and step out. There is no stepping backwards in time to see what were the previous functions.
-
3There is no such concept in the [Chrome] debugger - this would be "non-trivial" to implement in a non-pure language: how would one "go backwards" over arbitrary side-effects? I don't know of any debuggers that support this feature.– user2246674Jul 5, 2013 at 23:47
-
1Just bookkeeping everything is an option, just as Ollydbg debugger does for assembly.– HLLFeb 7, 2015 at 23:05
-
3Internet Explorer supports this– SandyMay 30, 2016 at 6:59
5 Answers
You can sort of go backwards if you click through in the "Call Stack" on the right side to see the parent functions.
-
There is also a setting in Chrome that let's you see an un-truncated call stack Dec 8, 2017 at 14:04
-
2Just to be clear, you are correct in saying you can only "sort of go backwards" using this approach-- while it allows you to move into callers and see the context that led you to the line the debugger is actually paused on, it isn't actually undoing any of the previous executions. Oct 1, 2019 at 19:25
As I said on this answer, you can step back by placing a new breakpoint and restarting the actual function. Hope this makes the trick.
-
1This is indeed correct, but instead of saying "restarting the actual function" which implies simply re-trying the whole debug session, you should have used the actual Chrome language "restart the current frame" Feb 15, 2021 at 22:17
-
1This answer is obsolete now, since Restart Frame has been ruthlessly burninated by the Devtools team. Sep 29, 2021 at 14:44
What I needed is in right side bar, right-click on an item in Call stack -> Restart frame. That restarts the selected function from the first line.
-
1This answer is obsolete now, since Restart Frame has been ruthlessly burninated by the Devtools team. Sep 29, 2021 at 14:44
One quick workaround I found out is to make a small change to the source file any change is fine (space, comment, whatever) while you are in the middle of the breakpoint then press Ctrl+s (save the file) and it will jump back to the first break point in that source. Then you can check your changes (F10 'step-in') then make another change if needed, Save it and it will restart. This is the fastest approach I have so far.
This is what I was looking for and found this link first. It is a more advanced version of the question I suppose..
The correct keyword to help search this is "Time Travel Debugging"
First noted here in this version of nodejs called, "Node-ChakraCore".
https://github.com/nodejs/node-chakracore/blob/master/TTD-README.md
-
2"Time-travel debugging" is a different and more advanced concept from "reverse debugging" or "historical debugging". OP is asking about reverse debugging -- the ability to move backwards in the execution in a "step back" fashion. Time travel debugging also, additionally, allows users to edit the history if desired. See reverse debugging and time travel debugging for comparison.– dionyzizOct 6, 2018 at 6:31