9520235bfe
Running all existing tests with/without lazy async stacks ensures that
the existing functionality for --lazy-async-stacks does not regress.
There are still a few smaller things to be done in the debugger for lazy
async stacks.
This CL also ensures:
* The inner closure, i.e. AsyncClosure/AsyncGenClosure, is not
inlined if FLAG_lazy_async_stacks is on.
* Fixes a crash in dartkb mode, when the function of the Bytecode
object is null.
* Does a simple integration of the lazy async stacks in debugger.cc -
to ensure a stack is returned via vm-service.
Issue https://github.com/dart-lang/sdk/issues/37668
Change-Id: Ibc1e887a457e2c456ae65d9ed5fa92434f122a32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131825
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
102 lines
2.3 KiB
Dart
102 lines
2.3 KiB
Dart
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// VMOptions=--causal-async-stacks --no-lazy-async-stacks
|
|
// VMOptions=--no-causal-async-stacks --lazy-async-stacks
|
|
|
|
import 'package:async_helper/async_minitest.dart';
|
|
|
|
import 'causal_async_exception_stack_helper.dart' as h;
|
|
|
|
foo3() async => throw "foo";
|
|
bar3() async => throw "bar";
|
|
|
|
foo2() async => foo3();
|
|
bar2() async => bar3();
|
|
|
|
foo() async => foo2();
|
|
bar() async => bar2();
|
|
|
|
test1() async {
|
|
// test1 -> foo -> foo2 -> foo3
|
|
// test1 -> bar -> bar2 -> bar3
|
|
// These run interleaved, check their stack traces don't become mixed.
|
|
var a = foo();
|
|
var b = bar();
|
|
|
|
try {
|
|
await a;
|
|
} catch (e, st) {
|
|
// st has foo,2,3 and not bar,2,3.
|
|
expect(
|
|
h.stringContainsInOrder(st.toString(), [
|
|
'foo3',
|
|
'foo2',
|
|
'foo',
|
|
'test1',
|
|
]),
|
|
isTrue);
|
|
expect(st.toString().contains('bar'), isFalse);
|
|
}
|
|
|
|
try {
|
|
await b;
|
|
} catch (e, st) {
|
|
// st has bar,2,3 but not foo,2,3
|
|
expect(
|
|
h.stringContainsInOrder(st.toString(), [
|
|
'bar3',
|
|
'bar2',
|
|
'bar',
|
|
'test1',
|
|
]),
|
|
isTrue);
|
|
expect(st.toString().contains('foo'), isFalse);
|
|
}
|
|
}
|
|
|
|
test2() async {
|
|
// test2 -> foo -> foo2 -> foo3
|
|
// test2 -> bar -> bar2 -> bar3
|
|
// These run sequentially, check the former stack trace didn't get linked to
|
|
// from the latter stack trace.
|
|
|
|
try {
|
|
await foo();
|
|
} catch (e, st) {
|
|
// st has foo,2,3 but not bar,2,3
|
|
expect(
|
|
h.stringContainsInOrder(st.toString(), [
|
|
'foo3',
|
|
'foo2',
|
|
'foo',
|
|
'test2',
|
|
]),
|
|
isTrue);
|
|
expect(st.toString().contains('bar'), isFalse);
|
|
}
|
|
|
|
try {
|
|
await bar();
|
|
} catch (e, st) {
|
|
// st has bar,2,3 but not foo,2,3
|
|
expect(
|
|
h.stringContainsInOrder(st.toString(), [
|
|
'bar3',
|
|
'bar2',
|
|
'bar',
|
|
'test2',
|
|
]),
|
|
isTrue);
|
|
expect(st.toString().contains('foo'), isFalse);
|
|
}
|
|
}
|
|
|
|
main() async {
|
|
test('causal async exception stack', () async {
|
|
await test1();
|
|
await test2();
|
|
});
|
|
}
|