Say I have some JavaScript code like this:
function breakpointInside() { console.log("How do I add a breakpoint here?"); }
breakpointInside();
Assume I can't edit the source file. I would like to debug breakpointInside
, but I cannot figure out how to add a breakpoint in the middle of the line. In this example, it's trivial to step into the function, but assume it's a more complex script where this isn't as practical.
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.
Here are 2 related solutions
You can't put a breakpoint inside a line, but you can (in newer versions of Chrome) right-click on the script, select De-obfuscate Source
, and put a breakpoint on the de-obfuscated version (which will have one statement on each line).
(based on comment by Nicolas)
In later versions of Chromium-based browsers, this function is called "Pretty print" and is available as a button at the left below the source code panel that looks like {}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With