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

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

Issue 1194103002: Observatory UI tweaks. (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/lib/src/elements/instance_view.html » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library debugger_page_element; 5 library debugger_page_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'observatory_element.dart'; 9 import 'observatory_element.dart';
10 import 'package:observatory/app.dart'; 10 import 'package:observatory/app.dart';
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 '\n' 103 '\n'
104 'Syntax: help - Show a list of all commands\n' 104 'Syntax: help - Show a list of all commands\n'
105 ' help <command> - Help for a specific command\n'; 105 ' help <command> - Help for a specific command\n';
106 } 106 }
107 107
108 class PrintCommand extends DebuggerCommand { 108 class PrintCommand extends DebuggerCommand {
109 PrintCommand(Debugger debugger) : super(debugger, 'print', []) { 109 PrintCommand(Debugger debugger) : super(debugger, 'print', []) {
110 alias = 'p'; 110 alias = 'p';
111 } 111 }
112 112
113 Future run(List<String> args) { 113 Future run(List<String> args) async {
114 if (args.length < 1) { 114 if (args.length < 1) {
115 debugger.console.print('print expects arguments'); 115 debugger.console.print('print expects arguments');
116 return new Future.value(null); 116 return;
117 } 117 }
118 var expr = args.join(''); 118 if (debugger.currentFrame == null) {
119 return debugger.isolate.evalFrame(debugger.currentFrame, expr) 119 debugger.console.print('No stack');
120 .then((ServiceObject response) { 120 return;
121 if (response is DartError) { 121 }
122 debugger.console.print(response.message); 122 var expression = args.join('');
123 } else { 123 var response = await debugger.isolate.evalFrame(debugger.currentFrame,
124 debugger.console.print('= ', newline:false); 124 expression);
125 debugger.console.printRef(response); 125 if (response is DartError) {
126 } 126 debugger.console.print(response.message);
127 }); 127 } else {
128 debugger.console.print('= ', newline:false);
129 debugger.console.printRef(response);
130 }
128 } 131 }
129 132
130 String helpShort = 'Evaluate and print an expression in the current frame'; 133 String helpShort = 'Evaluate and print an expression in the current frame';
131 134
132 String helpLong = 135 String helpLong =
133 'Evaluate and print an expression in the current frame.\n' 136 'Evaluate and print an expression in the current frame.\n'
134 '\n' 137 '\n'
135 'Syntax: print <expression>\n' 138 'Syntax: print <expression>\n'
136 ' p <expression>\n'; 139 ' p <expression>\n';
137 } 140 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 'in the current function'; 311 'in the current function';
309 312
310 String helpLong = 313 String helpLong =
311 'Continue running the isolate until it reaches the next source location ' 314 'Continue running the isolate until it reaches the next source location '
312 'in the current function.\n' 315 'in the current function.\n'
313 '\n' 316 '\n'
314 'Syntax: next\n'; 317 'Syntax: next\n';
315 } 318 }
316 319
317 class StepCommand extends DebuggerCommand { 320 class StepCommand extends DebuggerCommand {
318 StepCommand(Debugger debugger) : super(debugger, 'step', []); 321 StepCommand(Debugger debugger) : super(debugger, 'step', []) {
322 alias = 's';
323 }
319 324
320 Future run(List<String> args) { 325 Future run(List<String> args) {
321 if (debugger.isolatePaused()) { 326 if (debugger.isolatePaused()) {
322 var event = debugger.isolate.pauseEvent; 327 var event = debugger.isolate.pauseEvent;
323 if (event.kind == ServiceEvent.kPauseStart) { 328 if (event.kind == ServiceEvent.kPauseStart) {
324 debugger.console.print("Type 'continue' to start the isolate"); 329 debugger.console.print("Type 'continue' to start the isolate");
325 return new Future.value(null); 330 return new Future.value(null);
326 } 331 }
327 if (event.kind == ServiceEvent.kPauseExit) { 332 if (event.kind == ServiceEvent.kPauseExit) {
328 debugger.console.print("Type 'continue' to exit the isolate"); 333 debugger.console.print("Type 'continue' to exit the isolate");
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 Future<String> complete(String line) { 1177 Future<String> complete(String line) {
1173 return cmd.completeCommand(line).then((completions) { 1178 return cmd.completeCommand(line).then((completions) {
1174 if (completions.length == 0) { 1179 if (completions.length == 0) {
1175 // No completions. Leave the line alone. 1180 // No completions. Leave the line alone.
1176 return line; 1181 return line;
1177 } else if (completions.length == 1) { 1182 } else if (completions.length == 1) {
1178 // Unambiguous completion. 1183 // Unambiguous completion.
1179 return completions[0]; 1184 return completions[0];
1180 } else { 1185 } else {
1181 // Ambigous completion. 1186 // Ambigous completion.
1182 completions = completions.map((s )=> s.trimRight()).toList(); 1187 completions = completions.map((s) => s.trimRight()).toList();
1183 console.printBold(completions.toString()); 1188 console.printBold(completions.toString());
1184 return _foldCompletions(completions); 1189 return _foldCompletions(completions);
1185 } 1190 }
1186 }); 1191 });
1187 } 1192 }
1188 1193
1189 // TODO(turnidge): Implement real command line history. 1194 // TODO(turnidge): Implement real command line history.
1190 String lastCommand; 1195 String lastCommand;
1191 1196
1192 Future run(String command) { 1197 Future run(String command) {
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 }); 1720 });
1716 } 1721 }
1717 1722
1718 void focus() { 1723 void focus() {
1719 $['textBox'].focus(); 1724 $['textBox'].focus();
1720 } 1725 }
1721 1726
1722 DebuggerInputElement.created() : super.created(); 1727 DebuggerInputElement.created() : super.created();
1723 } 1728 }
1724 1729
OLDNEW
« no previous file with comments | « no previous file | runtime/observatory/lib/src/elements/instance_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698