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

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

Issue 993613002: Implement 'print', 'up', 'down', and 'frame' commands in the Observatory debugger. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 5 years, 9 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 | Annotate | Revision Log
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 SourceLocation { 7 class SourceLocation {
8 SourceLocation.file(this.script, this.line, this.col); 8 SourceLocation.file(this.script, this.line, this.col);
9 SourceLocation.func(this.function); 9 SourceLocation.func(this.function);
10 SourceLocation.error(this.errorMessage); 10 SourceLocation.error(this.errorMessage);
(...skipping 30 matching lines...) Expand all
41 return new Future.value(new SourceLocation.error( 41 return new Future.value(new SourceLocation.error(
42 "Invalid source location '${locDesc}'")); 42 "Invalid source location '${locDesc}'"));
43 } 43 }
44 44
45 static Future<SourceLocation> _currentLocation(Debugger debugger) { 45 static Future<SourceLocation> _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 SourceLocation.error( 48 return new Future.value(new SourceLocation.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'][0]; 51 var frame = stack['frames'][debugger.currentFrame];
52 Script script = frame['script']; 52 Script script = frame['script'];
53 return script.load().then((_) { 53 return script.load().then((_) {
54 var line = script.tokenToLine(frame['tokenPos']); 54 var line = script.tokenToLine(frame['tokenPos']);
55 // TODO(turnidge): Pass in the column here once the protocol supports it. 55 // TODO(turnidge): Pass in the column here once the protocol supports it.
56 return new Future.value(new SourceLocation.file(script, line, null)); 56 return new Future.value(new SourceLocation.file(script, line, null));
57 }); 57 });
58 } 58 }
59 59
60 static Future<SourceLocation> _parseScriptLine(Debugger debugger, 60 static Future<SourceLocation> _parseScriptLine(Debugger debugger,
61 Match match) { 61 Match match) {
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 return 'invalid source location (${errorMessage})'; 358 return 'invalid source location (${errorMessage})';
359 } 359 }
360 360
361 Script script; 361 Script script;
362 int line; 362 int line;
363 int col; 363 int col;
364 ServiceFunction function; 364 ServiceFunction function;
365 String errorMessage; 365 String errorMessage;
366 bool get valid => (errorMessage == null); 366 bool get valid => (errorMessage == null);
367 } 367 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/debugger/debugger.dart ('k') | runtime/observatory/lib/src/elements/debugger.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698