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

Issue 2646443005: Track async causal stack traces (Closed)

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

Description

Track async causal stack traces 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. - [x] Filter stack traces to remove async machinery. Service protocol changes: - [x] Send causal async stack trace. Observatory changes: - [x] Display causal async stack trace below async functions. Fixes https://github.com/dart-lang/sdk/issues/27661 R=asiva@google.com, rmacnak@google.com Comparisons: https://docs.google.com/a/google.com/document/d/10r6jEqr8OCiDZ4y9SYU_uOimcHiOGAZMly2ghTErALI/edit?usp=sharing Committed: https://github.com/dart-lang/sdk/commit/a0ee5b24db5420d8256f22e89561d13038f3320c

Patch Set 1 #

Patch Set 2 : ... #

Patch Set 3 : Observatory UI support #

Total comments: 65

Patch Set 4 : rmacnak asiva review #

Patch Set 5 : Unit tests and predefined environment variable #

Patch Set 6 : initialize async_causal_stack_trace_ to NULL #

Total comments: 4

Patch Set 7 : Add async* star tests #

Patch Set 8 : Chain stack traces together #

Total comments: 34

Patch Set 9 : Port to other architectures #

Patch Set 10 : rmacnak asiva review #

Patch Set 11 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1634 lines, -174 lines) Patch
M .gitignore View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M runtime/lib/async_patch.dart View 1 2 3 4 5 6 7 8 9 1 chunk +11 lines, -0 lines 0 comments Download
M runtime/lib/stacktrace.h View 2 chunks +4 lines, -0 lines 0 comments Download
M runtime/lib/stacktrace.cc View 1 2 3 4 5 6 7 8 9 5 chunks +127 lines, -10 lines 0 comments Download
M runtime/observatory/lib/src/elements/css/shared.css View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M runtime/observatory/lib/src/elements/debugger.dart View 1 2 3 4 5 6 7 8 9 10 chunks +102 lines, -3 lines 0 comments Download
M runtime/observatory/lib/src/models/objects/frame.dart View 1 2 1 chunk +8 lines, -0 lines 0 comments Download
M runtime/observatory/lib/src/models/repositories/target.dart View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M runtime/observatory/lib/src/repositories/target.dart View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -0 lines 0 comments Download
M runtime/observatory/lib/src/service/object.dart View 1 2 3 4 2 chunks +27 lines, -2 lines 0 comments Download
M runtime/observatory/tests/observatory_ui/mocks/repositories/target.dart View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
A runtime/observatory/tests/service/causal_async_stack_contents_test.dart View 1 2 3 4 5 6 7 8 9 1 chunk +74 lines, -0 lines 0 comments Download
A runtime/observatory/tests/service/causal_async_stack_presence_test.dart View 1 2 3 4 1 chunk +63 lines, -0 lines 0 comments Download
A runtime/observatory/tests/service/causal_async_star_stack_contents_test.dart View 1 2 3 4 5 6 1 chunk +87 lines, -0 lines 0 comments Download
A runtime/observatory/tests/service/causal_async_star_stack_presence_test.dart View 1 2 3 4 5 6 1 chunk +66 lines, -0 lines 0 comments Download
M runtime/vm/bootstrap_natives.h View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -0 lines 0 comments Download
M runtime/vm/dart.cc View 1 2 3 4 5 6 7 8 3 chunks +3 lines, -3 lines 0 comments Download
M runtime/vm/dart_api_impl.cc View 1 2 3 4 5 6 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/debugger.h View 1 2 12 chunks +74 lines, -3 lines 0 comments Download
M runtime/vm/debugger.cc View 1 2 3 4 5 6 7 8 9 10 25 chunks +287 lines, -87 lines 0 comments Download
M runtime/vm/exceptions.cc View 1 2 3 4 5 6 10 3 chunks +4 lines, -12 lines 0 comments Download
M runtime/vm/flag_list.h View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/flow_graph_builder.cc View 1 2 3 4 5 6 7 8 9 2 chunks +43 lines, -0 lines 0 comments Download
M runtime/vm/intrinsifier_arm.cc View 1 2 3 4 5 6 7 8 1 chunk +14 lines, -0 lines 0 comments Download
M runtime/vm/intrinsifier_arm64.cc View 1 2 3 4 5 6 7 8 1 chunk +14 lines, -0 lines 0 comments Download
M runtime/vm/intrinsifier_ia32.cc View 1 2 3 4 5 6 7 8 1 chunk +14 lines, -0 lines 0 comments Download
M runtime/vm/intrinsifier_mips.cc View 1 2 3 4 5 6 7 8 1 chunk +14 lines, -0 lines 0 comments Download
M runtime/vm/intrinsifier_x64.cc View 1 chunk +14 lines, -0 lines 0 comments Download
M runtime/vm/method_recognizer.h View 1 chunk +7 lines, -0 lines 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 5 6 7 8 9 10 2 chunks +15 lines, -4 lines 0 comments Download
M runtime/vm/object.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +85 lines, -44 lines 0 comments Download
M runtime/vm/object_service.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/object_store.h View 1 2 3 2 chunks +16 lines, -0 lines 0 comments Download
M runtime/vm/object_store.cc View 1 2 3 4 5 6 7 8 9 3 chunks +18 lines, -0 lines 0 comments Download
M runtime/vm/parser.cc View 1 2 3 4 5 6 7 8 9 10 chunks +70 lines, -0 lines 0 comments Download
M runtime/vm/raw_object.h View 1 2 3 4 5 6 7 10 1 chunk +2 lines, -1 line 0 comments Download
M runtime/vm/service.cc View 1 2 3 4 5 6 7 8 9 2 chunks +13 lines, -0 lines 0 comments Download
M runtime/vm/simulator_dbc.cc View 1 2 3 4 5 6 7 8 2 chunks +22 lines, -0 lines 0 comments Download
A runtime/vm/stack_trace.h View 1 2 3 4 5 6 7 8 9 1 chunk +55 lines, -0 lines 0 comments Download
A runtime/vm/stack_trace.cc View 1 2 3 4 5 6 7 8 9 1 chunk +117 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_arm.cc View 1 2 3 4 5 6 7 8 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/stub_code_arm64.cc View 1 2 3 4 5 6 7 8 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/stub_code_dbc.cc View 1 2 3 4 5 6 7 8 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/stub_code_ia32.cc View 1 2 3 4 5 6 7 8 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/stub_code_mips.cc View 1 2 3 4 5 6 7 8 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/stub_code_x64.cc View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/symbols.h View 1 2 3 4 2 chunks +6 lines, -1 line 0 comments Download
M runtime/vm/thread.h View 1 2 3 4 5 6 7 8 3 chunks +11 lines, -0 lines 0 comments Download
M runtime/vm/thread.cc View 1 2 3 4 5 6 7 8 3 chunks +23 lines, -0 lines 0 comments Download
M runtime/vm/thread_registry.h View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M runtime/vm/vm_sources.gypi View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M tests/language/vm/async_await_catch_stacktrace_test.dart View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -1 line 0 comments Download
A tests/language/vm/causal_async_exception_stack_test.dart View 1 2 3 4 5 6 7 8 9 1 chunk +41 lines, -0 lines 0 comments Download
A tests/standalone/dart_developer_disabled_env_test.dart View 1 2 3 4 1 chunk +11 lines, -0 lines 0 comments Download
A tests/standalone/dart_developer_env_test.dart View 1 2 3 4 1 chunk +10 lines, -0 lines 0 comments Download

Messages

Total messages: 24 (7 generated)
Cutch
PTAL
3 years, 11 months ago (2017-01-20 02:17:44 UTC) #6
Cutch
On 2017/01/20 02:17:44, Cutch wrote: > PTAL *ping*
3 years, 11 months ago (2017-01-25 22:57:22 UTC) #7
Cutch
+rmacnak
3 years, 11 months ago (2017-01-25 22:57:37 UTC) #9
rmacnak
Some initial comments https://codereview.chromium.org/2646443005/diff/40001/runtime/lib/async_patch.dart File runtime/lib/async_patch.dart (right): https://codereview.chromium.org/2646443005/diff/40001/runtime/lib/async_patch.dart#newcode198 runtime/lib/async_patch.dart:198: Object _asyncStackTraceHelper() native "StackTrace_forAsyncMethod"; StackTrace _asyncStackTraceHelper() ...
3 years, 11 months ago (2017-01-26 18:05:58 UTC) #10
siva
We should append to the comment in thread_registry.h that the async stack trace mechanism is ...
3 years, 10 months ago (2017-01-26 19:26:23 UTC) #11
siva
As discussed offline, we could consider chaining the stack trace objects instead of concatenating them. ...
3 years, 10 months ago (2017-01-27 00:58:24 UTC) #12
Cutch
Thanks for the reviews. I've done most of the request changes. The following is TODO ...
3 years, 10 months ago (2017-01-31 23:45:31 UTC) #13
Cutch
I've added unit tests and the predefined Dart environment variable. Now would be a good ...
3 years, 10 months ago (2017-02-01 23:26:05 UTC) #14
Cutch
This is ready for final review. PTAL.
3 years, 10 months ago (2017-02-08 00:59:55 UTC) #15
rmacnak
lgtm w/test Also add a non-service test like vm/inline_stack_frame_test so we have test coverage on ...
3 years, 10 months ago (2017-02-08 18:34:19 UTC) #16
siva
LGTM https://codereview.chromium.org/2646443005/diff/100001/runtime/lib/stacktrace.cc File runtime/lib/stacktrace.cc (right): https://codereview.chromium.org/2646443005/diff/100001/runtime/lib/stacktrace.cc#newcode21 runtime/lib/stacktrace.cc:21: "Maximum number of asynchronous stack traces frames remembered ...
3 years, 10 months ago (2017-02-08 18:46:29 UTC) #17
rmacnak
https://codereview.chromium.org/2646443005/diff/140001/runtime/vm/intrinsifier_x64.cc File runtime/vm/intrinsifier_x64.cc (right): https://codereview.chromium.org/2646443005/diff/140001/runtime/vm/intrinsifier_x64.cc#newcode2292 runtime/vm/intrinsifier_x64.cc:2292: __ LoadObject(RAX, Object::null_object()); On 2017/02/08 18:46:29, siva wrote: > ...
3 years, 10 months ago (2017-02-08 18:52:50 UTC) #18
siva
https://codereview.chromium.org/2646443005/diff/140001/runtime/vm/intrinsifier_x64.cc File runtime/vm/intrinsifier_x64.cc (right): https://codereview.chromium.org/2646443005/diff/140001/runtime/vm/intrinsifier_x64.cc#newcode2292 runtime/vm/intrinsifier_x64.cc:2292: __ LoadObject(RAX, Object::null_object()); On 2017/02/08 18:52:49, rmacnak wrote: > ...
3 years, 10 months ago (2017-02-08 18:59:12 UTC) #19
Cutch
On 2017/02/08 18:59:12, siva wrote: > https://codereview.chromium.org/2646443005/diff/140001/runtime/vm/intrinsifier_x64.cc > File runtime/vm/intrinsifier_x64.cc (right): > > https://codereview.chromium.org/2646443005/diff/140001/runtime/vm/intrinsifier_x64.cc#newcode2292 > ...
3 years, 10 months ago (2017-02-09 22:24:04 UTC) #20
Cutch
https://codereview.chromium.org/2646443005/diff/100001/runtime/lib/stacktrace.cc File runtime/lib/stacktrace.cc (right): https://codereview.chromium.org/2646443005/diff/100001/runtime/lib/stacktrace.cc#newcode21 runtime/lib/stacktrace.cc:21: "Maximum number of asynchronous stack traces frames remembered in ...
3 years, 10 months ago (2017-02-09 22:45:51 UTC) #21
Cutch
On 2017/02/08 18:34:19, rmacnak wrote: > lgtm w/test > Test added tests/language/vm/causal_async_exception_stack_test.dart
3 years, 10 months ago (2017-02-09 22:46:34 UTC) #22
Cutch
3 years, 10 months ago (2017-02-09 23:39:54 UTC) #24
Message was sent while issue was closed.
Committed patchset #11 (id:200001) manually as
a0ee5b24db5420d8256f22e89561d13038f3320c.

Powered by Google App Engine
This is Rietveld 408576698