3 ms·
Here's something which is still missing from both Firefox and Chrome debuggers: "tracing" breakpoints. That's one of the few nice/advanced features from Xcode
by masklinn 9y ago
Here's something which is still missing from both Firefox and Chrome debuggers: "tracing" breakpoints.
That's one of the few nice/advanced features from Xcode and Safari, aside from making a breakpoint conditional you can:
* skip it the first n times (default: 0)
* make it non-breaking
* associate various actions which are executed if the breakpoint "triggers" (the condition matches) even if the breakpoint is non-breaking, in Safari these actions are "Log Message" (formatted plain text), "Evaluate" (arbitrary javascript code), "Play Sound" (beep on every tripping of the breakpoint) and "Probe Expression"[0]: https://webkit.org/blog/5435/breakpoint-options/ https://webkit.org/blog/5435/breakpoint-options/
[0] a special kind of table logging which integrates with the debugger rather than the (separate) console tab
- 10000100001010 9y agoYou can at least both "Log Message" and "Evaluate" in Chrome with conditional break points. Calling console.log is falsy, so calling it from conditional break points just causes it to log the message (you also have access to any variables in scope of the breakpoint that you can use to build the message). You can do the same thing with executing random JavaScript. Just put the statement and add && false to make sure it always returns false.
- masklinn 9y ago> You can at least both "Log Message" and "Evaluate" in Chrome with conditional break points. You can obviously do that in any browser, it's just inflexible, ugly, error-prone and inconvenient.
- 10000100001010 9y ago¯\_(ツ)_/¯ I rarely have issues with it
- Vinnl 9y agoIn fact, the linked tutorial addresses how to do exactly that in Firefox: https://mozilladevelopers.github.io/playground/debugger/04-conditional-breakpoints https://mozilladevelopers.github.io/playground/debugger/04-c...
- ChrisSD 9y agoI get your point but a non-breaking breakpoint sounds like a contradiction. Maybe it should be called a tracepoint?
- masklinn 9y agoTechnically sure, but that makes it less discoverable as developers tend to look for breakpoints rather than tracepoints. So UX/discovery-wise adding these features as advanced extensions of breakpoints is more sensible than breakpoints being a special case of tracepoints.
- arnoooooo 9y agoAs a Lisper, tracing is something I also often miss on other platforms. It's really powerful, particularly when debugging "functionnal" code.
- Groxx 9y agoConditional breakpoints have been around for years, which solve all of those via arbitrary javascript. You just make the condition falsey if you don't want it to break (or `doAnything() && false`). Skip-counters are just a global counter and `x++ > N`. "Probe Expression" does look pretty neat though, that'd be a bit of a pain to do by hand (probably just viewing logs, which does provide rich objects in recent-ish years). Granted, the UI isn't as clear about the capabilities, but I generally prefer "run JS, return true" over "choose one of N kinds of things to do", even if one of the N is "run JS, return true". Minus skip counters, those are a bit annoying by hand (needing globally unique var names and all). I'm not sure when Firefox's built-in debugger got it, but I see search results implying they've been part of FireBug since 2007 at the very least. And I don't remember Chrome's debugger ever not having it (once they got their current-gen-like one, iirc it launched with extremely limited devtools?), though I could easily be forgetting the early days.