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

Unified Diff: runtime/observatory/tests/service/break_on_function_test.dart

Issue 1237203002: Insert debug step check at the beginning of a function. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/tests/service/break_on_function_test.dart
diff --git a/runtime/observatory/tests/service/break_on_function_test.dart b/runtime/observatory/tests/service/break_on_function_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..bbe907922a591177a04c28f0e3ee41f839952104
--- /dev/null
+++ b/runtime/observatory/tests/service/break_on_function_test.dart
@@ -0,0 +1,72 @@
+// Copyright (c) 2015, 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=--compile_all --error_on_bad_type --error_on_bad_override --verbose_debug
+
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+import 'test_helper.dart';
+import 'dart:developer';
+
+testFunction(flag) { // Line 11
+ if (flag) {
+ print("Yes");
+ } else {
+ print("No");
+ }
+}
+
+testMain() {
+ debugger();
+ testFunction(true);
+ testFunction(false);
+ print("Done");
+}
+
+var tests = [
+
+hasStoppedAtBreakpoint,
+
+// Add breakpoint
+(Isolate isolate) async {
+ var rootLib = await isolate.rootLibrary.load();
+ var function = rootLib.functions.singleWhere((f) => f.name == 'testFunction');
+
+ var bpt = await isolate.addBreakpointAtEntry(function);
+ expect(bpt is Breakpoint, isTrue);
+ print(bpt);
+},
+
+resumeIsolate,
+
+hasStoppedAtBreakpoint,
+
+// We are at the breakpoint on line 11.
+(Isolate isolate) async {
+ ServiceMap stack = await isolate.getStack();
+ expect(stack.type, equals('Stack'));
+ expect(stack['frames'].length, greaterThanOrEqualTo(1));
+
+ Script script = stack['frames'][0].location.script;
+ expect(stack['frames'][0].location.tokenPos, equals(22));
+},
+
+resumeIsolate,
+
+hasStoppedAtBreakpoint,
+
+// We are at the breakpoint on line 11.
+(Isolate isolate) async {
+ ServiceMap stack = await isolate.getStack();
+ expect(stack.type, equals('Stack'));
+ expect(stack['frames'].length, greaterThanOrEqualTo(1));
+
+ Script script = stack['frames'][0].location.script;
+ expect(stack['frames'][0].location.tokenPos, equals(22));
+},
+
+resumeIsolate,
+
+];
+
+main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain);
« no previous file with comments | « no previous file | runtime/observatory/tests/service/debugging_test.dart » ('j') | runtime/vm/flow_graph_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698