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

Side by Side Diff: runtime/observatory/tests/service/debugging_inlined_finally_test.dart

Issue 1170483002: Fixed breakpoint handling at return statement with inlined finally clauses. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/observatory/tests/service/test_helper.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override
5
6 import 'package:observatory/service_io.dart';
7 import 'package:unittest/unittest.dart';
8 import 'test_helper.dart';
9 import 'dart:async';
10 import 'dart:developer';
11
12 testFunction() {
13 debugger();
rmacnak 2015/06/03 22:23:06 I have been setting breakpoints then doing an eval
regis 2015/06/03 22:25:31 You can thank John for the suggestion :-)
14 var a;
15 try {
16 var b;
17 try {
18 for (int i = 0; i < 10; i++) {
19 var x = () => i + a + b;
20 return x; // line 20
21 }
22 } finally {
23 b = 10; // line 23
24 }
25 } finally {
26 a = 1; // line 26
27 }
28 }
29
30 testMain() {
31 var f = testFunction();
32 Expect.equals(11, f());
33
34 }
35
36 var tests = [
37
38 hasStoppedAtBreakpoint,
39
40 // Add breakpoint
41 (Isolate isolate) async {
42 await isolate.rootLibrary.load();
43
44 var script = isolate.rootLibrary.scripts[0];
45 await script.load();
46
47 // Add 3 breakpoints.
48 {
49 var result = await isolate.addBreakpoint(script, 20);
50 expect(result is Breakpoint, isTrue);
51 Breakpoint bpt = result;
52 expect(bpt.type, equals('Breakpoint'));
53 expect(bpt.location.script.id, equals(script.id));
54 expect(bpt.location.script.tokenToLine(bpt.location.tokenPos), equals(20));
55 expect(isolate.breakpoints.length, equals(1));
56 }
57
58 {
59 var result = await isolate.addBreakpoint(script, 23);
60 expect(result is Breakpoint, isTrue);
61 Breakpoint bpt = result;
62 expect(bpt.type, equals('Breakpoint'));
63 expect(bpt.location.script.id, equals(script.id));
64 expect(bpt.location.script.tokenToLine(bpt.location.tokenPos), equals(23));
65 expect(isolate.breakpoints.length, equals(2));
66 }
67
68 {
69 var result = await isolate.addBreakpoint(script, 26);
70 expect(result is Breakpoint, isTrue);
71 Breakpoint bpt = result;
72 expect(bpt.type, equals('Breakpoint'));
73 expect(bpt.location.script.id, equals(script.id));
74 expect(bpt.location.script.tokenToLine(bpt.location.tokenPos), equals(26));
75 expect(isolate.breakpoints.length, equals(3));
76 }
77
78 // Wait for breakpoint events.
79 },
80
81 resumeIsolate,
82
83 hasStoppedAtBreakpoint,
84
85 // We are at the breakpoint on line 20.
86 (Isolate isolate) async {
87 ServiceMap stack = await isolate.getStack();
88 expect(stack.type, equals('Stack'));
89 expect(stack['frames'].length, greaterThanOrEqualTo(1));
90
91 Script script = stack['frames'][0].location.script;
92 expect(script.tokenToLine(stack['frames'][0].location.tokenPos), equals(20));
93 },
94
95 resumeIsolate,
96
97 hasStoppedAtBreakpoint,
98
99 // We are at the breakpoint on line 23.
100 (Isolate isolate) async {
101 ServiceMap stack = await isolate.getStack();
102 expect(stack.type, equals('Stack'));
103 expect(stack['frames'].length, greaterThanOrEqualTo(1));
104
105 Script script = stack['frames'][0].location.script;
106 expect(script.tokenToLine(stack['frames'][0].location.tokenPos), equals(23));
107 },
108
109 resumeIsolate,
110
111 hasStoppedAtBreakpoint,
112
113 // We are at the breakpoint on line 26.
114 (Isolate isolate) async {
115 ServiceMap stack = await isolate.getStack();
116 expect(stack.type, equals('Stack'));
117 expect(stack['frames'].length, greaterThanOrEqualTo(1));
118
119 Script script = stack['frames'][0].location.script;
120 expect(script.tokenToLine(stack['frames'][0].location.tokenPos), equals(26));
121 },
122
123 resumeIsolate,
124
125 ];
126
127 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain);
OLDNEW
« no previous file with comments | « no previous file | runtime/observatory/tests/service/test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698