-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement support for single stepping out of an async function.
BUG= R=rmacnak@google.com Review-Url: https://codereview.chromium.org/2785243003 .
- Loading branch information
1 parent
8d340ee
commit 193f26d
Showing
7 changed files
with
221 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
runtime/observatory/tests/service/async_single_step_exception_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// 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=--error_on_bad_type --error_on_bad_override --verbose_debug | ||
|
||
import 'dart:developer'; | ||
import 'package:observatory/models.dart' as M; | ||
import 'package:observatory/service_io.dart'; | ||
import 'package:unittest/unittest.dart'; | ||
import 'service_test_common.dart'; | ||
import 'test_helper.dart'; | ||
|
||
const LINE_A = 20; | ||
const LINE_B = 21; | ||
const LINE_C = 26; | ||
const LINE_D = 27; | ||
const LINE_E = 28; | ||
const LINE_F = 35; | ||
const LINE_G = 38; | ||
|
||
helper() async { | ||
print('helper'); // LINE_A. | ||
throw 'a'; // LINE_B. | ||
} | ||
|
||
testMain() async { | ||
debugger(); | ||
print('mmmmm'); // LINE_C. | ||
try { | ||
await helper(); // LINE_D. | ||
} catch (e) { | ||
// arrive here on error. | ||
print('error: $e'); // LINE_E. | ||
} finally { | ||
// arrive here in both cases. | ||
print('foo'); // LINE_F. | ||
} | ||
print('z'); // LINE_G. | ||
} | ||
|
||
var tests = [ | ||
hasStoppedAtBreakpoint, | ||
stoppedAtLine(LINE_C), | ||
stepOver, // print. | ||
hasStoppedAtBreakpoint, | ||
stoppedAtLine(LINE_D), | ||
stepInto, | ||
hasStoppedAtBreakpoint, | ||
stoppedAtLine(LINE_A), | ||
stepOver, // print. | ||
hasStoppedAtBreakpoint, | ||
stoppedAtLine(LINE_B), // throw 'a'. | ||
stepInto, // exit helper via a throw. | ||
hasStoppedAtBreakpoint, | ||
stoppedAtLine(LINE_E), // print(error) | ||
stepOver, | ||
hasStoppedAtBreakpoint, | ||
stoppedAtLine(LINE_F), // print(foo) | ||
stepOver, | ||
hasStoppedAtBreakpoint, | ||
stoppedAtLine(LINE_G), // print(z) | ||
resumeIsolate | ||
]; | ||
|
||
main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
49 changes: 49 additions & 0 deletions
49
runtime/observatory/tests/service/async_single_step_out_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// 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=--error_on_bad_type --error_on_bad_override --verbose_debug | ||
|
||
import 'dart:developer'; | ||
import 'package:observatory/models.dart' as M; | ||
import 'package:observatory/service_io.dart'; | ||
import 'package:unittest/unittest.dart'; | ||
import 'service_test_common.dart'; | ||
import 'test_helper.dart'; | ||
|
||
const LINE_A = 20; | ||
const LINE_B = 21; | ||
const LINE_C = 26; | ||
const LINE_D = 27; | ||
const LINE_E = 28; | ||
|
||
helper() async { | ||
print('helper'); // LINE_A. | ||
return null; // LINE_B. | ||
} | ||
|
||
testMain() async { | ||
debugger(); | ||
print('mmmmm'); // LINE_C. | ||
await helper(); // LINE_D. | ||
print('z'); // LINE_E. | ||
} | ||
|
||
var tests = [ | ||
hasStoppedAtBreakpoint, | ||
stoppedAtLine(LINE_C), | ||
stepOver, // print. | ||
hasStoppedAtBreakpoint, | ||
stoppedAtLine(LINE_D), | ||
stepInto, | ||
hasStoppedAtBreakpoint, | ||
stoppedAtLine(LINE_A), | ||
stepOver, // print. | ||
hasStoppedAtBreakpoint, | ||
stoppedAtLine(LINE_B), // return null. | ||
stepInto, // exit helper via a single step. | ||
hasStoppedAtBreakpoint, | ||
stoppedAtLine(LINE_E), // arrive after the await. | ||
resumeIsolate | ||
]; | ||
|
||
main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.