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

Side by Side Diff: runtime/observatory/lib/src/debugger/debugger_location.dart

Issue 1312763010: Support column-based breakpoints in the VM and Observatory. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: hausner review Created 5 years, 3 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/lib/src/elements/debugger.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of debugger; 5 part of debugger;
6 6
7 class DebuggerLocation { 7 class DebuggerLocation {
8 DebuggerLocation.file(this.script, this.line, this.col); 8 DebuggerLocation.file(this.script, this.line, this.col);
9 DebuggerLocation.func(this.function); 9 DebuggerLocation.func(this.function);
10 DebuggerLocation.error(this.errorMessage); 10 DebuggerLocation.error(this.errorMessage);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 static Future<DebuggerLocation> _currentLocation(Debugger debugger) { 45 static Future<DebuggerLocation> _currentLocation(Debugger debugger) {
46 ServiceMap stack = debugger.stack; 46 ServiceMap stack = debugger.stack;
47 if (stack == null || stack['frames'].length == 0) { 47 if (stack == null || stack['frames'].length == 0) {
48 return new Future.value(new DebuggerLocation.error( 48 return new Future.value(new DebuggerLocation.error(
49 'A script must be provided when the stack is empty')); 49 'A script must be provided when the stack is empty'));
50 } 50 }
51 var frame = stack['frames'][debugger.currentFrame]; 51 var frame = stack['frames'][debugger.currentFrame];
52 Script script = frame.location.script; 52 Script script = frame.location.script;
53 return script.load().then((_) { 53 return script.load().then((_) {
54 var line = script.tokenToLine(frame.location.tokenPos); 54 var line = script.tokenToLine(frame.location.tokenPos);
55 // TODO(turnidge): Pass in the column here once the protocol supports it. 55 var col = script.tokenToCol(frame.location.tokenPos);
56 return new Future.value(new DebuggerLocation.file(script, line, null)); 56 return new Future.value(new DebuggerLocation.file(script, line, col));
57 }); 57 });
58 } 58 }
59 59
60 static Future<DebuggerLocation> _parseScriptLine(Debugger debugger, 60 static Future<DebuggerLocation> _parseScriptLine(Debugger debugger,
61 Match match) { 61 Match match) {
62 var scriptName = match.group(1); 62 var scriptName = match.group(1);
63 if (scriptName != null) { 63 if (scriptName != null) {
64 scriptName = scriptName.substring(0, scriptName.length - 1); 64 scriptName = scriptName.substring(0, scriptName.length - 1);
65 } 65 }
66 var lineStr = match.group(2); 66 var lineStr = match.group(2);
(...skipping 27 matching lines...) Expand all
94 return new DebuggerLocation.error("Script '${scriptName}' is ambigous" ); 94 return new DebuggerLocation.error("Script '${scriptName}' is ambigous" );
95 } 95 }
96 }); 96 });
97 } else { 97 } else {
98 // No script provided. Default to top of stack for now. 98 // No script provided. Default to top of stack for now.
99 ServiceMap stack = debugger.stack; 99 ServiceMap stack = debugger.stack;
100 if (stack == null || stack['frames'].length == 0) { 100 if (stack == null || stack['frames'].length == 0) {
101 return new Future.value(new DebuggerLocation.error( 101 return new Future.value(new DebuggerLocation.error(
102 'A script must be provided when the stack is empty')); 102 'A script must be provided when the stack is empty'));
103 } 103 }
104 Script script = stack['frames'][0].location.script; 104 var frame = stack['frames'][debugger.currentFrame];
105 return new Future.value(new DebuggerLocation.file(script, line, col)); 105 Script script = frame.location.script;
106 return script.load().then((_) {
107 return new Future.value(new DebuggerLocation.file(script, line, col));
108 });
106 } 109 }
107 } 110 }
108 111
109 static Future<List<Script>> _lookupScript(Isolate isolate, 112 static Future<List<Script>> _lookupScript(Isolate isolate,
110 String name, 113 String name,
111 {bool allowPrefix: false}) { 114 {bool allowPrefix: false}) {
112 var pending = []; 115 var pending = [];
113 for (var lib in isolate.libraries) { 116 for (var lib in isolate.libraries) {
114 if (!lib.loaded) { 117 if (!lib.loaded) {
115 pending.add(lib.load()); 118 pending.add(lib.load());
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 return 'invalid source location (${errorMessage})'; 360 return 'invalid source location (${errorMessage})';
358 } 361 }
359 362
360 Script script; 363 Script script;
361 int line; 364 int line;
362 int col; 365 int col;
363 ServiceFunction function; 366 ServiceFunction function;
364 String errorMessage; 367 String errorMessage;
365 bool get valid => (errorMessage == null); 368 bool get valid => (errorMessage == null);
366 } 369 }
OLDNEW
« no previous file with comments | « no previous file | runtime/observatory/lib/src/elements/debugger.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698