Skip to content

Commit 0004589

Browse files
Clement Skaucommit-bot@chromium.org
authored andcommitted
[VM] Removes extra frames from debug lazy async stacks.
This adds a debugger mechanism to replace part of --causal-async-stack's _asyncStackTraceHelper runtime entry. It recognises async and async* functions and adds a synthetic breakpoint on entry into the wrapped async_op, making sure we don't get "synthetic" frames as we're stepping in and out of the async code. Change-Id: I1df6e6874de2fa9185f27a1a8873ad0071ad9fb6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157480 Commit-Queue: Clement Skau <[email protected]> Reviewed-by: Vyacheslav Egorov <[email protected]>
1 parent e403e6a commit 0004589

19 files changed

+78
-110
lines changed

pkg/vm_service/test/async_single_step_exception_test.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ var tests = <IsolateTest>[
4545
stoppedAtLine(LINE_D), // await helper
4646
stepInto,
4747

48-
...ifLazyAsyncStacks(<IsolateTest>[
49-
hasStoppedAtBreakpoint,
50-
stoppedAtLine(19), // helper() async { ... }
51-
stepInto,
52-
]),
53-
5448
hasStoppedAtBreakpoint,
5549
stoppedAtLine(LINE_A), // print helper
5650
smartNext,

pkg/vm_service/test/async_single_step_into_test.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ var tests = <IsolateTest>[
3434
stoppedAtLine(LINE_D),
3535
stepInto,
3636

37-
...ifLazyAsyncStacks(<IsolateTest>[
38-
hasStoppedAtBreakpoint,
39-
stoppedAtLine(16), // helper() async { ... }
40-
stepInto,
41-
]),
42-
4337
hasStoppedAtBreakpoint,
4438
stoppedAtLine(LINE_A),
4539
stepOver, // print.

pkg/vm_service/test/async_single_step_out_test.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ var tests = <IsolateTest>[
3535
stoppedAtLine(LINE_D), // await helper
3636
stepInto,
3737

38-
...ifLazyAsyncStacks(<IsolateTest>[
39-
hasStoppedAtBreakpoint,
40-
stoppedAtLine(17), // helper() async { ... }
41-
stepInto,
42-
]),
43-
4438
hasStoppedAtBreakpoint,
4539
stoppedAtLine(LINE_A), // print.
4640
stepOver,

pkg/vm_service/test/async_star_single_step_into_test.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,13 @@ var tests = <IsolateTest>[
4545
stoppedAtLine(LINE_F),
4646
stepInto,
4747

48-
...ifLazyAsyncStacks(<IsolateTest>[
49-
hasStoppedAtBreakpoint,
50-
stoppedAtLine(23), // helper() async { ... }
51-
stepInto,
52-
]),
53-
5448
hasStoppedAtBreakpoint,
5549
stoppedAtLine(LINE_C),
5650
stepOver, // print.
5751

5852
hasStoppedAtBreakpoint,
5953
stepInto,
6054

61-
...ifLazyAsyncStacks(<IsolateTest>[
62-
hasStoppedAtBreakpoint,
63-
stoppedAtLine(26), // await for (...) { ... }
64-
stepInto,
65-
]),
66-
6755
hasStoppedAtBreakpoint,
6856
stoppedAtLine(LINE_A),
6957
// Resume here to exit the generator function.

pkg/vm_service/test/async_star_step_out_test.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,13 @@ var tests = <IsolateTest>[
4949
stoppedAtLine(LINE_F),
5050
stepInto,
5151

52-
...ifLazyAsyncStacks(<IsolateTest>[
53-
hasStoppedAtBreakpoint,
54-
stoppedAtLine(26), // helper() async { ... }
55-
stepInto,
56-
]),
57-
5852
hasStoppedAtBreakpoint,
5953
stoppedAtLine(LINE_C),
6054
stepOver, // print.
6155

6256
hasStoppedAtBreakpoint,
6357
stepInto,
6458

65-
...ifLazyAsyncStacks(<IsolateTest>[
66-
hasStoppedAtBreakpoint,
67-
stoppedAtLine(29), // await for (...) {}
68-
stepInto,
69-
]),
70-
7159
hasStoppedAtBreakpoint,
7260
stoppedAtLine(LINE_A),
7361
stepOut, // step out of generator.

pkg/vm_service/test/async_step_out_test.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ var tests = <IsolateTest>[
3737
stoppedAtLine(LINE_E),
3838
stepInto,
3939

40-
...ifLazyAsyncStacks(<IsolateTest>[
41-
hasStoppedAtBreakpoint,
42-
stoppedAtLine(18), // helper() async { ... }
43-
stepInto,
44-
]),
45-
4640
hasStoppedAtBreakpoint,
4741
stoppedAtLine(LINE_A),
4842
asyncNext,

pkg/vm_service/test/common/test_helper.dart

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ const List<String> extraDebuggingArgs = useCausalAsyncStacks
2222
? ['--causal-async-stacks', '--no-lazy-async-stacks']
2323
: ['--no-causal-async-stacks', '--lazy-async-stacks'];
2424

25-
List<IsolateTest> ifLazyAsyncStacks(List<IsolateTest> lazyTests) {
26-
if (useCausalAsyncStacks) return const <IsolateTest>[];
27-
return lazyTests;
28-
}
29-
3025
/// Will be set to the http address of the VM's service protocol before
3126
/// any tests are invoked.
3227
String serviceHttpAddress;
@@ -222,13 +217,13 @@ class _ServiceTesteeLauncher {
222217
first = false;
223218
print('** Signaled to run test queries on $uri');
224219
}
225-
print('>testee>out> $line');
220+
stdout.write('>testee>out> ${line}\n');
226221
});
227222
process.stderr
228223
.transform(utf8.decoder)
229224
.transform(LineSplitter())
230225
.listen((line) {
231-
print('>testee>err> $line');
226+
stdout.write('>testee>err> ${line}\n');
232227
});
233228
process.exitCode.then((exitCode) {
234229
if ((exitCode != 0) && !killedByTester) {

runtime/observatory/tests/service/async_single_step_exception_test.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ var tests = <IsolateTest>[
4646
stoppedAtLine(LINE_D), // await helper
4747
stepInto,
4848

49-
...ifLazyAsyncStacks(<IsolateTest>[
50-
hasStoppedAtBreakpoint,
51-
stoppedAtLine(19), // helper() async { ... }
52-
stepInto,
53-
]),
54-
5549
hasStoppedAtBreakpoint,
5650
stoppedAtLine(LINE_A), // print helper
5751
smartNext,

runtime/observatory/tests/service/async_single_step_into_test.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ var tests = <IsolateTest>[
3434
stoppedAtLine(LINE_D),
3535
stepInto,
3636

37-
...ifLazyAsyncStacks(<IsolateTest>[
38-
hasStoppedAtBreakpoint,
39-
stoppedAtLine(16),
40-
stepInto, // helper() async { ... }
41-
]),
42-
4337
hasStoppedAtBreakpoint,
4438
stoppedAtLine(LINE_A),
4539
stepOver, // print.

runtime/observatory/tests/service/async_single_step_out_test.dart

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ var tests = <IsolateTest>[
3535
stoppedAtLine(LINE_D), // await helper
3636
stepInto,
3737

38-
...ifLazyAsyncStacks(<IsolateTest>[
39-
hasStoppedAtBreakpoint,
40-
stoppedAtLine(17), // helper() async {}
41-
stepInto,
42-
]),
43-
4438
hasStoppedAtBreakpoint,
4539
stoppedAtLine(LINE_A), // print.
4640
stepOver,
@@ -57,7 +51,7 @@ var tests = <IsolateTest>[
5751
stoppedAtLine(25), // await helper (weird dispatching)
5852
smartNext,
5953

60-
hasStoppedAtBreakpoint, //19
54+
hasStoppedAtBreakpoint,
6155
stoppedAtLine(LINE_E), // arrive after the await.
6256
resumeIsolate
6357
];

0 commit comments

Comments
 (0)