Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Issue 2603383004: Sane asynchronous debugging and stack traces (Closed)

Created:
3 years, 11 months ago by Cutch
Modified:
3 years, 8 months ago
Reviewers:
turnidge, siva
CC:
reviews_dartlang.org, turnidge, rmacnak, vm-dev_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Sane asynchronous debugging and stack traces **Debugging** This CL provides a sane asynchronous debugging experience by tracking the 'async return call stack' between async functions and awaiters. By knowing where execution will resume after an async function completes, we can provide a debugger experience that matches the synchronous experience. Stepping-in and stepping-out of async functions is now supported. TODO: Stopping on uncaught exceptions. Tracking the 'async return call stack' works by adding linkage between asynchronous methods and their awaiters. *How does return call stack linkage work?* Each async and async* function activation returns a Future. When that Future is awaited on the awaiter sets a field which can be seen from the async/async* function's closure activation. If you await on the same future multiple times, the last awaiter wins. When reconstructing the return call stack, we only look at the immediate Future returned by the async/async* function. *Non-linear forking and joining* Dart allows for forking and joining with Futures. This CL does not handle this problem. We will still present the illusion that the return call stack is always linear when it might not actually be. **Causal stack traces and exceptions** This CL improves the stack traces that accompany exceptions. Whenever an async function is entered, we remember how we got there. This is similar in spirit to package:stack_trace but the implementation is more efficient and memory usage can be more easily reasoned about. --- Tracking causal stack traces: - [x] Upon entry to an async function, capture the synchronous stack trace prefix and store it into the closure. - [x] Upon entry to an async* function, capture the synchronous stack trace prefix and store it into the closure. - [x] Before returning from an async function, clear the Thread's asynchronous stack trace. - [x] After resuming an async function, load the sychronous stack trace prefix into the Thread. Tracking the async return call stack: - [x] Each async function closure now knows who is awaiting on their return. This is effectively the asynchronous equivalent of the 'frame pointer'. - [x] Each async* function closure now knows how is listening on their stream. This is effectively the asynchronous equivalent of the 'frame pointer'. - [x] Filter stack traces to remove async machinery. Service Protocol changes: - [x] Send the async call stack along side the sync call stack. Observatory changes: - [x] Toggle between async and sync call stack. Stepping changes: - [x] Step into support for asynchronous methods. - [x] Step out support for asynchronous methods. Debugger changes: - [x] Refactoring and cleanups in debugger BUG=

Patch Set 1 #

Patch Set 2 : await for / async* stepping support #

Patch Set 3 : awaiter token position mappings #

Patch Set 4 : rebase #

Patch Set 5 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1956 lines, -186 lines) Patch
M runtime/lib/async_patch.dart View 1 4 chunks +60 lines, -2 lines 0 comments Download
M runtime/lib/stacktrace.cc View 1 5 chunks +179 lines, -10 lines 0 comments Download
M runtime/observatory/lib/src/elements/debugger.dart View 12 chunks +84 lines, -6 lines 0 comments Download
M runtime/observatory/lib/src/models/objects/frame.dart View 1 chunk +9 lines, -0 lines 0 comments Download
M runtime/observatory/lib/src/models/repositories/target.dart View 1 chunk +1 line, -0 lines 0 comments Download
M runtime/observatory/lib/src/repositories/target.dart View 1 chunk +3 lines, -0 lines 0 comments Download
M runtime/observatory/lib/src/service/object.dart View 1 3 chunks +21 lines, -2 lines 0 comments Download
M runtime/observatory/tests/observatory_ui/mocks/repositories/target.dart View 1 chunk +4 lines, -0 lines 0 comments Download
M runtime/vm/ast_transformer.cc View 1 2 3 chunks +9 lines, -2 lines 0 comments Download
M runtime/vm/bootstrap_natives.h View 1 2 2 chunks +4 lines, -0 lines 0 comments Download
M runtime/vm/compiler.cc View 1 2 1 chunk +24 lines, -0 lines 0 comments Download
M runtime/vm/debugger.h View 1 2 18 chunks +144 lines, -9 lines 0 comments Download
M runtime/vm/debugger.cc View 1 2 3 4 40 chunks +836 lines, -134 lines 0 comments Download
M runtime/vm/flag_list.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/flow_graph.h View 1 2 2 chunks +10 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph.cc View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/flow_graph_builder.h View 1 2 2 chunks +7 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_builder.cc View 1 2 7 chunks +84 lines, -4 lines 0 comments Download
M runtime/vm/intrinsifier_x64.cc View 1 chunk +14 lines, -0 lines 0 comments Download
M runtime/vm/isolate.cc View 1 2 3 4 1 chunk +4 lines, -2 lines 0 comments Download
M runtime/vm/method_recognizer.h View 1 2 3 2 chunks +7 lines, -1 line 0 comments Download
M runtime/vm/method_recognizer.cc View 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/object.h View 1 2 3 4 2 chunks +12 lines, -0 lines 0 comments Download
M runtime/vm/object.cc View 1 2 3 4 4 chunks +30 lines, -3 lines 0 comments Download
M runtime/vm/parser.cc View 1 2 3 4 18 chunks +140 lines, -8 lines 0 comments Download
M runtime/vm/raw_object.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/scopes.cc View 1 2 1 chunk +13 lines, -1 line 0 comments Download
M runtime/vm/service.cc View 2 chunks +15 lines, -0 lines 0 comments Download
M runtime/vm/service/service.md View 1 2 3 4 2 chunks +21 lines, -0 lines 0 comments Download
A runtime/vm/stack_trace.h View 1 chunk +52 lines, -0 lines 0 comments Download
A runtime/vm/stack_trace.cc View 1 chunk +113 lines, -0 lines 0 comments Download
M runtime/vm/stub_code.h View 2 chunks +4 lines, -2 lines 0 comments Download
M runtime/vm/stub_code_x64.cc View 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/symbols.h View 1 2 3 4 4 chunks +13 lines, -0 lines 0 comments Download
M runtime/vm/thread.h View 1 3 chunks +10 lines, -0 lines 0 comments Download
M runtime/vm/thread.cc View 1 3 chunks +18 lines, -0 lines 0 comments Download
M runtime/vm/vm_sources.gypi View 1 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (2 generated)
Cutch
3 years, 8 months ago (2017-03-31 17:16:37 UTC) #3
I've now landed this larger CL as many small CLs.

Closing.

Powered by Google App Engine
This is Rietveld 408576698