Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome DevTools won't let me set breakpoints on certain lines

enter image description here

In the image above, I tried setting breakpoints on every line from line 437 to line 443. However, I cannot set breakpoints on lines 439 and 440. When the function runs, the breakpoints on lines 437, 438, 441, and 442 are ignored. Chrome breaks on line 443. This means that I cannot do some debugging before the first conditional runs.

When I click on lines 439 or 440, the breakpoint appears for half a second and jumps to line 443.

Is this a bug or am I missing something? How do I set a breakpoint at or before line 439?

like image 508
Leo Jiang Avatar asked Feb 08 '16 19:02

Leo Jiang


People also ask

How do I add a conditional breakpoint in DevTools?

Add a conditional breakpoint by right clicking a line number, selecting Add Conditional Breakpoint , and entering an expression. Note: Because the conditional breakpoint simply evaluates an expression, you can add useful logging statements within the expression.

What allows to set breakpoints?

Set breakpoints in source code To set a breakpoint in source code, click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.


5 Answers

If you are using js minification and sourcemaps, ensure that they are up to date with your source code.

like image 107
Danila Shutov Avatar answered Nov 08 '22 10:11

Danila Shutov


I have same problem in chrome dev tool source panel snippets when I write some codes to test my idea.

Only way for me worked is close dev tool panel and refresh page then reopen

This problem happened after I modified codes in debug mode

like image 28
nuclear Avatar answered Nov 08 '22 10:11

nuclear


This was frustrating for me today but I found the problem. I was trying to place a breakpoint inside an orphan function (nothing was calling it). As soon as I fixed it, all was well. Smart - but wish there was even a tiny hint that this was the case.

like image 36
rmasrani Avatar answered Nov 08 '22 11:11

rmasrani


This recently became an issue for me, running System.js and Babel, and with plain ES6 transpiling, I haven't gotten to minifying/mapping yet. A workaround seems to be to add your breakpoint to the !transpiled file, a matching breakpoint will automagically appear in the corresponding line in the raw file.

like image 26
Shukri Adams Avatar answered Nov 08 '22 12:11

Shukri Adams


I think that my classmate and I had this issue as well today. We made our changes and then hit Ctrl + S (or Cmd + S) to save the changes in the debugger and then we were able to add the breakpoints.

like image 25
blindgren Avatar answered Nov 08 '22 11:11

blindgren