Donato
Donato

Reputation: 2777

step back to previous line in script with devtools debugger

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"?

Upvotes: 15

Views: 10392

Answers (3)

Hari Krishan Kushwaha
Hari Krishan Kushwaha

Reputation: 11

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

Steps

Upvotes: 0

Charly.Org
Charly.Org

Reputation: 1082

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.

Upvotes: 71

Rodrigo5244
Rodrigo5244

Reputation: 5535

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.

Upvotes: 0

Related Questions