Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to pause a stuck script in the chrome debugger?

Occasionally, while programming JavaScript, I will make a bone headed mistake and can get the page stuck in an infinite loop while it is loading. I typically will use Chrome for this and, when I get in this state, I cannot do anything with the javascript developer tools. What I would really like is a break command similar to what can be done within Visual Studio's debugger that will pause the interpreter and display the current line being executed along with the call stack. Is there any such functionality available.

As an alternative to this, I would be handy to set break points in the code. Regardless, I need some way to interrupt the process so that I can determine the cause of the lock-up.

like image 445
Jon Trauntvein Avatar asked May 05 '11 16:05

Jon Trauntvein


People also ask

How do I pause browser debugging?

You can turn on the "pause on exceptions" debugging feature by clicking on the Sources tab within the DevTools, and then clicking the button on the top right that looks like an octagon with a pause button. (The octagon will turn blue after you click it.)

Can you step back in chrome debugger?

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.


1 Answers

you can add a debugger; statement somewhere in your code where you want to break execution and continue stepping from there on with the Step Next, Step Over, etc

like image 139
TheBrain Avatar answered Sep 21 '22 20:09

TheBrain