Debugger: provide detailed completion values for generator and async function suspensions
Categories
(Core :: JavaScript Engine, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox69 | --- | fixed |
People
(Reporter: jorendorff, Assigned: jimb)
References
(Blocks 1 open bug)
Details
(Whiteboard: [debugger-mvp])
Attachments
(9 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
When an async function call frame `return`s or `await`s, the debugger currently has no way to tell which. Here's a script to dump the completion value passed to `onPop` when we call a simple async function: ---- let g = newGlobal(); g.eval(` async function f() { await "promise"; return "done"; } `); let dbg = new Debugger(g); dbg.onEnterFrame = frame => { frame.onPop = completion => { print(uneval(completion)); }; }; g.f(); drainJobQueue(); ---- The output is three lines: ---- ({return:{}}) ({return:"promise"}) ({return:"done"}) ---- The first `onPop` fires during the async function's "initial suspend". (I don't understand why we have to do this for async functions.) The return value is a Generator that's an implementation detail of the async function task. The second `onPop` is for the `await`, and the third is for the `return`.
Reporter | ||
Comment 1•6 years ago
|
||
The obvious fix would be to change await completions to look like `{await: <value>}`. It might break some existing code, though. :-\
Reporter | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
Add an assertion.
Assignee | ||
Comment 3•5 years ago
|
||
Our ultimate goal in this bug is to include information about yields and awaits
in the completion value passed to the onPop
handler. This means that detecting
when a frame is being suspended becomes just another step in building a
completion value. That change becomes a little clearer if those two steps happen
next to each other.
Depends on D24995
Assignee | ||
Comment 4•5 years ago
|
||
Depends on D24996
Assignee | ||
Comment 5•5 years ago
|
||
I want to break that last patch up into smaller steps, but comments on the overall approach are welcome.
Assignee | ||
Comment 6•5 years ago
|
||
Depends on D24996
Assignee | ||
Comment 7•5 years ago
|
||
Depends on D24997
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 8•5 years ago
|
||
Rebased patch queue.
Updated•5 years ago
|
Assignee | ||
Comment 9•5 years ago
|
||
Replacing more calls to Debugger::resultToCompletion with uses of the newer API.
Assignee | ||
Comment 10•5 years ago
|
||
DebuggerFrame::eval and DebuggerObject::evalInGlobal are two more invocation
functions that can reasonably use Completion to report the results of the
operation.
Depends on D33076
Assignee | ||
Comment 11•5 years ago
|
||
Depends on D33077
Assignee | ||
Comment 12•5 years ago
|
||
All uses of these have been rewritten to use the Completion type.
Depends on D33078
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 13•5 years ago
|
||
Pushed by jblandy@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1248eb8d570b js::Debugger::slowPathOnLeaveFrame should always get a pc for non-WASM frames. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/69a369e2cdaa Debugger::slowPathOnLeaveFrame: move 'suspending' block a little later. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/bb62c9157f04 js/src/vm/Debugger.h: Move forward declarations to top. r=jorendorff
Comment 14•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1248eb8d570b
https://hg.mozilla.org/mozilla-central/rev/69a369e2cdaa
https://hg.mozilla.org/mozilla-central/rev/bb62c9157f04
Comment 15•5 years ago
|
||
Marking leave-open as there are patches that still need to be land.
Updated•5 years ago
|
Assignee | ||
Comment 16•5 years ago
|
||
Oh dear. Completion
can't be passed directly as a parameter. I'll need to rework some of these interfaces.
Assignee | ||
Comment 17•5 years ago
•
|
||
If we can land bug 1563065, the interfaces can remain unchanged.
Comment 18•5 years ago
|
||
Pushed by jblandy@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c4bae8a5a111 Distinguish yields and awaits in completion values. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/abdfe0ed8ea1 Use Completion type in DebuggerObject::{set,get}Property. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/6791d671e6cc Use Completion type in Debugger::receiveCompletionValue. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/6034237161dc Use Completion type for Debugger eval-related methods. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/ef67e1b47f9c Use Completion in Debugger.Object 'call' and 'apply' methods. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/1a18ccfcdc98 Delete Debugger::{resultToCompletion,newCompletionValue,receiveCompletionValue}. r=jorendorff
Comment 19•5 years ago
|
||
Backed out 6 changesets (bug 1470558) for Build bustage in js/src/vm/Debugger.cpp
Log:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=255140151&repo=autoland&lineNumber=48540
Push with failures:
https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=1a18ccfcdc98eec64d8f76850713f0348cd073e5
Backout:
https://hg.mozilla.org/integration/autoland/rev/6a41c590899802f9636815ad69b14d67318582cf
Comment 20•5 years ago
|
||
Pushed by jblandy@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f0aa53a43409 Distinguish yields and awaits in completion values. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/3f47b78ffdc0 Use Completion type in DebuggerObject::{set,get}Property. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/f82f7c40443d Use Completion type in Debugger::receiveCompletionValue. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/4f26d027343a Use Completion type for Debugger eval-related methods. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/3800d671c64e Use Completion in Debugger.Object 'call' and 'apply' methods. r=jorendorff https://hg.mozilla.org/integration/autoland/rev/483d687212fb Delete Debugger::{resultToCompletion,newCompletionValue,receiveCompletionValue}. r=jorendorff
Comment 21•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/f0aa53a43409
https://hg.mozilla.org/mozilla-central/rev/3f47b78ffdc0
https://hg.mozilla.org/mozilla-central/rev/f82f7c40443d
https://hg.mozilla.org/mozilla-central/rev/4f26d027343a
https://hg.mozilla.org/mozilla-central/rev/3800d671c64e
https://hg.mozilla.org/mozilla-central/rev/483d687212fb
Assignee | ||
Updated•5 years ago
|
Description
•