New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 630727 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 451015
Owner:
Last visit > 30 days ago
Closed: Jul 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocked on:
issue 451015



Sign in to add a comment

Debugger: Breakpoints need statement level precision

Reported by nat...@nlwillia.net, Jul 22 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36

Steps to reproduce the problem:
The conventional pattern for a breakpoint is to click in the gutter beside a code line which stops at the first statement on that line.  But it's not uncommon in JavaScript to have multiple statements on the same line, and in such cases the default breakpoint behavior is often the least desirable.

Example 1: foo(a(), b(), c());

The desired breakpoint is often on the call to "foo", but to step into it, I have to step past the evaluation of each parameter first.  Or I might be interested in one of the parameters, but unless it's the first one I have to do extra stepping to reach the place I really wanted to break.

Example 2: addListener(new function(e) { doSomething(); });

For a callback, I'm probably more interested in the callback than in the registration.  Arrow functions and functional programming idioms make one-liners like this increasingly common.

What is the expected behavior?

What went wrong?
This is admittedly more of a general gripe than a specific recommendation, but it's something that I think most programmers who have worked with debuggers (even the excellent debugger in Chrome) can probably identify with.  The pretty printer sometimes helps expand code in a way that makes line-level breakpoints sufficiently precise, but there are still a lot of cases where I find myself wishing for the ability to indicate a specific statement or quickly step from where I am into a specific function.

This is a hard problem from both a UI and a runtime perspective.  A UI pattern implemented beside the line is a lot simpler than one within the line, and then you have transpiled language semantics and source maps to consider.  Ultimately it would be ideal if there were a way to explode a line into a format that revealed its chronological execution order and set the breakpoint at that level.  This would necessarily be more of a VM perspective than a source perspective.  I'm speaking in ignorance of the platform internals here, but hopefully the usage problem is clear.  I think that something that could address this use case would be an enormously helpful addition.

Did this work before? N/A 

Chrome version: 52.0.2743.82  Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 22.0 r0
 

Comment 1 by caseq@chromium.org, Jul 22 2016

Components: -Platform>DevTools Platform>DevTools>JavaScript
Labels: -Arch-x86_64
Mergedinto: 566801
Owner: kozyatinskiy@chromium.org
Status: Duplicate (was: Unconfirmed)

Comment 2 by nat...@nlwillia.net, Jul 22 2016

Thanks for the link.  I did find that issue, but I see this as a more general problem than just arrow functions.  It affects any kind of inlined callback or lengthy argument list.  Properties with getters can make stepping a real minefield.  You have to step-over to avoid descending into a different function but remember to step-into at the end or you'll blow past where you wanted to get to.  It all comes back to "line" by itself not being a very good indicator of where you need to stop.
Blockedon: 451015
Labels: -OS-Windows OS-All
Status: Assigned (was: Duplicate)
Mergedinto: -566801 451015
Status: Duplicate (was: Assigned)

Sign in to add a comment