14

I am working with devtools debugger provided by google chrome. In terms of execution control, it allows you to add breakpoints anywhere in script and even allows you to attach breakpoints to events. You can step line by line in a script. You can step over functions to remain in the same function or step into functions. And when you go into functions, you can step out of the function to go back to the caller.

One problem I have is sometimes when I step over a function call, I want to go back to it, in order to step into that function call. I read over https://developer.chrome.com/devtools/docs/javascript-debugging and I cannot find a way to do this. Am I overlooking anything or is there a way to "step back"?

Donato
  • 2,727
  • 6
  • 29
  • 59
  • @SantiagoHernández not sure what you mean, when I click on the function I want to go back to in the Sources panel, nothing happens. – Donato Mar 14 '15 at 19:33
  • 1
    I don't think that's possible, you can see a similar question: http://stackoverflow.com/questions/17498159/how-to-go-backwards-while-debugging-javascript-in-chrome-sources-debugging I believe that is possible in (some?) cases with for example Visual Studio with C#. And you have debuggers that record state to make this possible in Java/ C++, i.e. "UndoDB". Edit: I don't think a similar feature exists for any modern browser at this moment. – Ray Burgemeestre Mar 14 '15 at 19:34
  • I agree it cannot do it, but there are still a lot of cool things it can do http://superuser.com/questions/395919/where-is-the-post-tab-in-chrome-developer-tools-network and http://www.briangrinstead.com/blog/chrome-developer-tools-monitorevents – Donato Mar 17 '15 at 01:32

3 Answers3

71

Old question, but with "new" info:

Recently the Chrome DevTools got a boost, and now you can "restart" the function that you are debugging. This allows you to set a breakpoint in the previous line, so it looks like a "backwards" button. This can be done by right-clicking on the call stack and select the "Restart frame"

enter image description here

Even being an old question, I think this worths spreading.

I hope this is useful for someone.

Charly.Org
  • 1,084
  • 10
  • 9
0

After you step over a function, the code in the function runs immediately. Although some debuggers can undo or save the stare before the function execution, currently, debuggers in browsers do not do this.

You can set a break point inside the function so you won't miss it by accident the next time it is called.

Rodrigo5244
  • 5,145
  • 2
  • 25
  • 36
0

Right click on previous any break point you will see some options select continue to here option (Orange highlighted).

Steps

Martin Brisiak
  • 3,872
  • 12
  • 37
  • 51