Open Bug 1003428 Opened 11 years ago Updated 2 years ago

Make generators inspectable

Categories

(DevTools :: Debugger, enhancement, P3)

x86_64
Linux
enhancement

Tracking

(Not tracked)

People

(Reporter: benjamin, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [polish-backlog])

I'd like to be able to inspect the state of an ES6 generator which is not currently running. In particular I sometimes get Task.jsm tasks which are "stuck". I'd like to be able to take a generator associated with the task and inspect it in the debugger to see where it got stuck. jimb tells me this involves both backend work in the JS engine as well as work in the debugger, but I should file this bug and he'd help file the blocking bugs as necessary.
Benjamin, would it be useful if `Task.jsm` could be inspected to determine the line of the latest call to `yield`, or at least the number of times the task has called `yield`?
Flags: needinfo?(benjamin)
# of times is probably not useful. The line of the latest yield is useful, especially if it deals with nested functions properly.
Flags: needinfo?(benjamin)
Summary: Allow inspection of non-active generators → Make generators inspectable
Depends on: dbg-inspect
Blocks: dbg-inspect
No longer depends on: dbg-inspect
Whiteboard: [polish-backlog]
Priority: -- → P1
Clearly not a P1 anymore. Moving back to the backlog. Yulia, maybe this is already tracked on GitHub? If not, should it be (and should this bug be closed)?
Severity: normal → enhancement
Flags: needinfo?(ystartsev)
Priority: P1 → P3
We have the ability to step over yield statements now. So, if you are on a generator, when you step you will no longer be taken into unrelated JS, instead you will step over the yield statement like any other line of code. But from the description, it isnt clear to me if this is what is required. Is there more information regarding expected behavior?
Flags: needinfo?(ystartsev)
(In reply to Yulia Startsev [:yulia] from comment #4) > We have the ability to step over yield statements now. So, if you are on a > generator, when you step you will no longer be taken into unrelated JS, > instead you will step over the yield statement like any other line of code. > But from the description, it isnt clear to me if this is what is required. > Is there more information regarding expected behavior? I think the original request is being able to do something like: 1. find a generator (or, now 4 years later now that we have them, async method) in the debugger source panel 2. interact with it somehow (context menu option, button in the UI elsewhere, whatever) to show: 3. where the generator/async function is "up to", so, more specifically: -- for async functions: the current 'await' statement that has been executed but for which the promise result is pending, if any; -- for generator functions: the last yield line from which the generator yielded a value to its caller, if any. Both of these, by implication, indicate where the function would 'resume' either when the currently-awaited-promise resolves or when the generator is called again. Does that help clarify?
Flags: needinfo?(ystartsev)
Ok, I will add this to github to see if this is something we can fit in within the next couple of weeks. jim is right, this would take work on both the backend and the frontend.
Flags: needinfo?(ystartsev)
Product: Firefox → DevTools
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.