Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

step back to previous line in script with devtools debugger

Tags:

javascript

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

like image 968
Donato Avatar asked Mar 14 '15 19:03

Donato


People also ask

Can you go backwards in debugger?

When you are debugging a program, it is not unusual to realize that you have gone too far, and some event of interest has already happened. If the target environment supports it, gdb can allow you to “rewind” the program by running it backward.

How do I go to the next line in debugging in Chrome?

Chrome DevTools: Quickly jump to other code while debugging JavaScript. You can easily jump, via the debugger, to new JavaScript destinations when you are paused at a breakpoint. To do this, hold the Cmd/Ctrl key while you are paused at a breakpoint. DevTools displays jumpable destinations.


1 Answers

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.

like image 181
Charly.Org Avatar answered Oct 14 '22 19:10

Charly.Org