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

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

Issue 2759973004: Fix observatory tests broken by running dartfmt. Temporarily reverted formatting for evaluate_activ… (Closed)
Patch Set: Created 3 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
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:svg'; 8 import 'dart:svg';
9 import 'dart:html'; 9 import 'dart:html';
10 import 'dart:math'; 10 import 'dart:math';
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 return new Future.value(null); 202 return new Future.value(null);
203 } 203 }
204 if (debugger.currentFrame == null) { 204 if (debugger.currentFrame == null) {
205 debugger.console.print('No stack'); 205 debugger.console.print('No stack');
206 return new Future.value(null); 206 return new Future.value(null);
207 } 207 }
208 try { 208 try {
209 debugger.downFrame(count); 209 debugger.downFrame(count);
210 debugger.console.print('frame = ${debugger.currentFrame}'); 210 debugger.console.print('frame = ${debugger.currentFrame}');
211 } catch (e) { 211 } catch (e) {
212 debugger.console.print( 212 debugger.console.print('frame must be in range [${e.start}..${e.end-1}]');
213 'frame must be in range [${e.start}..${e.end-1}]');
214 } 213 }
215 return new Future.value(null); 214 return new Future.value(null);
216 } 215 }
217 216
218 String helpShort = 'Move down one or more frames (hotkey: [Page Down])'; 217 String helpShort = 'Move down one or more frames (hotkey: [Page Down])';
219 218
220 String helpLong = 'Move down one or more frames.\n' 219 String helpLong = 'Move down one or more frames.\n'
221 '\n' 220 '\n'
222 'Hotkey: [Page Down]\n' 221 'Hotkey: [Page Down]\n'
223 '\n' 222 '\n'
(...skipping 13 matching lines...) Expand all
237 return new Future.value(null); 236 return new Future.value(null);
238 } 237 }
239 if (debugger.currentFrame == null) { 238 if (debugger.currentFrame == null) {
240 debugger.console.print('No stack'); 239 debugger.console.print('No stack');
241 return new Future.value(null); 240 return new Future.value(null);
242 } 241 }
243 try { 242 try {
244 debugger.upFrame(count); 243 debugger.upFrame(count);
245 debugger.console.print('frame = ${debugger.currentFrame}'); 244 debugger.console.print('frame = ${debugger.currentFrame}');
246 } on RangeError catch (e) { 245 } on RangeError catch (e) {
247 debugger.console.print( 246 debugger.console.print('frame must be in range [${e.start}..${e.end-1}]');
248 'frame must be in range [${e.start}..${e.end-1}]');
249 } 247 }
250 return new Future.value(null); 248 return new Future.value(null);
251 } 249 }
252 250
253 String helpShort = 'Move up one or more frames (hotkey: [Page Up])'; 251 String helpShort = 'Move up one or more frames (hotkey: [Page Up])';
254 252
255 String helpLong = 'Move up one or more frames.\n' 253 String helpLong = 'Move up one or more frames.\n'
256 '\n' 254 '\n'
257 'Hotkey: [Page Up]\n' 255 'Hotkey: [Page Up]\n'
258 '\n' 256 '\n'
(...skipping 15 matching lines...) Expand all
274 return new Future.value(null); 272 return new Future.value(null);
275 } 273 }
276 if (debugger.currentFrame == null) { 274 if (debugger.currentFrame == null) {
277 debugger.console.print('No stack'); 275 debugger.console.print('No stack');
278 return new Future.value(null); 276 return new Future.value(null);
279 } 277 }
280 try { 278 try {
281 debugger.currentFrame = frame; 279 debugger.currentFrame = frame;
282 debugger.console.print('frame = ${debugger.currentFrame}'); 280 debugger.console.print('frame = ${debugger.currentFrame}');
283 } on RangeError catch (e) { 281 } on RangeError catch (e) {
284 debugger.console.print( 282 debugger.console.print('frame must be in range [${e.start}..${e.end-1}]');
285 'frame must be in range [${e.start}..${e.end-1}]');
286 } 283 }
287 return new Future.value(null); 284 return new Future.value(null);
288 } 285 }
289 286
290 String helpShort = 'Set the current frame'; 287 String helpShort = 'Set the current frame';
291 288
292 String helpLong = 'Set the current frame.\n' 289 String helpLong = 'Set the current frame.\n'
293 '\n' 290 '\n'
294 'Syntax: frame <number>\n' 291 'Syntax: frame <number>\n'
295 ' f <count>\n'; 292 ' f <count>\n';
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 408
412 Future run(List<String> args) async { 409 Future run(List<String> args) async {
413 try { 410 try {
414 int count = 1; 411 int count = 1;
415 if (args.length == 1) { 412 if (args.length == 1) {
416 count = int.parse(args[0]); 413 count = int.parse(args[0]);
417 } else if (args.length > 1) { 414 } else if (args.length > 1) {
418 debugger.console.print('rewind expects 0 or 1 argument'); 415 debugger.console.print('rewind expects 0 or 1 argument');
419 return; 416 return;
420 } else if (count < 1 || count > debugger.stackDepth) { 417 } else if (count < 1 || count > debugger.stackDepth) {
421 debugger.console.print( 418 debugger.console
422 'frame must be in range [1..${debugger.stackDepth - 1}]'); 419 .print('frame must be in range [1..${debugger.stackDepth - 1}]');
423 return; 420 return;
424 } 421 }
425 await debugger.rewind(count); 422 await debugger.rewind(count);
426 } on S.ServerRpcException catch(e) { 423 } on S.ServerRpcException catch (e) {
427 if (e.code == S.ServerRpcException.kCannotResume) { 424 if (e.code == S.ServerRpcException.kCannotResume) {
428 debugger.console.printRed(e.data['details']); 425 debugger.console.printRed(e.data['details']);
429 } else { 426 } else {
430 rethrow; 427 rethrow;
431 } 428 }
432 } 429 }
433 } 430 }
434 431
435 String helpShort = 'Rewind the stack to a previous frame'; 432 String helpShort = 'Rewind the stack to a previous frame';
436 433
437 String helpLong = 434 String helpLong = 'Rewind the stack to a previous frame.\n'
438 'Rewind the stack to a previous frame.\n'
439 '\n' 435 '\n'
440 'Syntax: rewind\n' 436 'Syntax: rewind\n'
441 ' rewind <count>\n'; 437 ' rewind <count>\n';
442 } 438 }
443 439
444 class ReloadCommand extends DebuggerCommand { 440 class ReloadCommand extends DebuggerCommand {
445 ReloadCommand(Debugger debugger) : super(debugger, 'reload', []); 441 ReloadCommand(Debugger debugger) : super(debugger, 'reload', []);
446 442
447 Future run(List<String> args) async { 443 Future run(List<String> args) async {
448 try { 444 try {
449 int count = 1; 445 int count = 1;
450 if (args.length > 0) { 446 if (args.length > 0) {
451 debugger.console.print('reload expects no arguments'); 447 debugger.console.print('reload expects no arguments');
452 return; 448 return;
453 } 449 }
454 await debugger.isolate.reloadSources(); 450 await debugger.isolate.reloadSources();
455 debugger.console.print('reload complete'); 451 debugger.console.print('reload complete');
456 await debugger.refreshStack(); 452 await debugger.refreshStack();
457 } on S.ServerRpcException catch(e) { 453 } on S.ServerRpcException catch (e) {
458 if (e.code == S.ServerRpcException.kIsolateReloadBarred || 454 if (e.code == S.ServerRpcException.kIsolateReloadBarred ||
459 e.code == S.ServerRpcException.kIsolateReloadFailed || 455 e.code == S.ServerRpcException.kIsolateReloadFailed ||
460 e.code == S.ServerRpcException.kIsolateIsReloading) { 456 e.code == S.ServerRpcException.kIsolateIsReloading) {
461 debugger.console.printRed(e.data['details']); 457 debugger.console.printRed(e.data['details']);
462 } else { 458 } else {
463 rethrow; 459 rethrow;
464 } 460 }
465 } 461 }
466 } 462 }
467 463
468 String helpShort = 'Reload the sources for the current isolate'; 464 String helpShort = 'Reload the sources for the current isolate';
469 465
470 String helpLong = 466 String helpLong = 'Reload the sources for the current isolate.\n'
471 'Reload the sources for the current isolate.\n'
472 '\n' 467 '\n'
473 'Syntax: reload\n'; 468 'Syntax: reload\n';
474 } 469 }
475 470
476 class ClsCommand extends DebuggerCommand { 471 class ClsCommand extends DebuggerCommand {
477 ClsCommand(Debugger debugger) : super(debugger, 'cls', []) {} 472 ClsCommand(Debugger debugger) : super(debugger, 'cls', []) {}
478 473
479 Future run(List<String> args) { 474 Future run(List<String> args) {
480 debugger.console.clear(); 475 debugger.console.clear();
481 debugger.console.newline(); 476 debugger.console.newline();
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 // TODO(turnidge): Implement real command line history. 1821 // TODO(turnidge): Implement real command line history.
1827 String lastCommand; 1822 String lastCommand;
1828 1823
1829 Future run(String command) { 1824 Future run(String command) {
1830 if (command == '' && lastCommand != null) { 1825 if (command == '' && lastCommand != null) {
1831 command = lastCommand; 1826 command = lastCommand;
1832 } 1827 }
1833 console.printBold('\$ $command'); 1828 console.printBold('\$ $command');
1834 return cmd.runCommand(command).then((_) { 1829 return cmd.runCommand(command).then((_) {
1835 lastCommand = command; 1830 lastCommand = command;
1836 }).catchError( 1831 }).catchError((e, s) {
1837 (e, s) { 1832 console.printRed('Unable to execute command because the connection '
1838 console.printRed('Unable to execute command because the connection ' 1833 'to the VM has been closed');
1839 'to the VM has been closed'); 1834 }, test: (e) => e is S.NetworkRpcException).catchError((e, s) {
1840 }, test: (e) => e is S.NetworkRpcException 1835 console.printRed(e.toString());
1841 ).catchError( 1836 }, test: (e) => e is CommandException).catchError((e, s) {
1842 (e, s) { 1837 if (s != null) {
1843 console.printRed(e.toString()); 1838 console.printRed('Internal error: $e\n$s');
1844 }, test: (e) => e is CommandException 1839 } else {
1845 ).catchError( 1840 console.printRed('Internal error: $e\n');
1846 (e, s) {
1847 if (s != null) {
1848 console.printRed('Internal error: $e\n$s');
1849 } else {
1850 console.printRed('Internal error: $e\n');
1851 }
1852 } 1841 }
1853 ); 1842 });
1854 } 1843 }
1855 1844
1856 String historyPrev(String command) { 1845 String historyPrev(String command) {
1857 return cmd.historyPrev(command); 1846 return cmd.historyPrev(command);
1858 } 1847 }
1859 1848
1860 String historyNext(String command) { 1849 String historyNext(String command) {
1861 return cmd.historyNext(command); 1850 return cmd.historyNext(command);
1862 } 1851 }
1863 1852
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 2399
2411 // Is this the current frame? 2400 // Is this the current frame?
2412 bool _current = false; 2401 bool _current = false;
2413 2402
2414 // Has this frame been pinned open? 2403 // Has this frame been pinned open?
2415 bool _pinned = false; 2404 bool _pinned = false;
2416 2405
2417 bool _expanded = false; 2406 bool _expanded = false;
2418 2407
2419 void setCurrent(bool value) { 2408 void setCurrent(bool value) {
2420 Future load = 2409 Future load = (_frame.function != null)
2421 (_frame.function != null) ? 2410 ? _frame.function.load()
2422 _frame.function.load() : 2411 : new Future.value(null);
2423 new Future.value(null);
2424 load.then((func) { 2412 load.then((func) {
2425 _current = value; 2413 _current = value;
2426 if (_current) { 2414 if (_current) {
2427 _expand(); 2415 _expand();
2428 scrollIntoView(); 2416 scrollIntoView();
2429 } else { 2417 } else {
2430 if (_pinned) { 2418 if (_pinned) {
2431 _expand(); 2419 _expand();
2432 } else { 2420 } else {
2433 _unexpand(); 2421 _unexpand();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2473 classes.add('current'); 2461 classes.add('current');
2474 } else { 2462 } else {
2475 classes.remove('current'); 2463 classes.remove('current');
2476 } 2464 }
2477 if ((_frame.kind == M.FrameKind.asyncSuspensionMarker) || 2465 if ((_frame.kind == M.FrameKind.asyncSuspensionMarker) ||
2478 (_frame.kind == M.FrameKind.asyncCausal)) { 2466 (_frame.kind == M.FrameKind.asyncCausal)) {
2479 classes.add('causalFrame'); 2467 classes.add('causalFrame');
2480 } 2468 }
2481 if (_frame.kind == M.FrameKind.asyncSuspensionMarker) { 2469 if (_frame.kind == M.FrameKind.asyncSuspensionMarker) {
2482 final content = <Element>[ 2470 final content = <Element>[
2483 new SpanElement() 2471 new SpanElement()..children = _createMarkerHeader(_frame.marker)
2484 ..children = _createMarkerHeader(_frame.marker)
2485 ]; 2472 ];
2486 children = content; 2473 children = content;
2487 return; 2474 return;
2488 } 2475 }
2489 ButtonElement expandButton; 2476 ButtonElement expandButton;
2490 final content = <Element>[ 2477 final content = <Element>[
2491 expandButton = new ButtonElement() 2478 expandButton = new ButtonElement()
2492 ..children = _createHeader() 2479 ..children = _createHeader()
2493 ..onClick.listen((e) async { 2480 ..onClick.listen((e) async {
2494 if (e.target is AnchorElement) { 2481 if (e.target is AnchorElement) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 new DivElement() 2583 new DivElement()
2597 ..classes = ['frameId'] 2584 ..classes = ['frameId']
2598 ..text = 'Frame ${_frame.index}', 2585 ..text = 'Frame ${_frame.index}',
2599 new SpanElement()..text = '$marker', 2586 new SpanElement()..text = '$marker',
2600 ] 2587 ]
2601 ]; 2588 ];
2602 return [ 2589 return [
2603 new DivElement() 2590 new DivElement()
2604 ..classes = ['frameSummary'] 2591 ..classes = ['frameSummary']
2605 ..children = content 2592 ..children = content
2606 ]; 2593 ];
2607 } 2594 }
2608 2595
2609 List<Element> _createHeader() { 2596 List<Element> _createHeader() {
2610 final content = [ 2597 final content = [
2611 new DivElement() 2598 new DivElement()
2612 ..classes = ['frameSummaryText'] 2599 ..classes = ['frameSummaryText']
2613 ..children = [ 2600 ..children = [
2614 new DivElement() 2601 new DivElement()
2615 ..classes = ['frameId'] 2602 ..classes = ['frameId']
2616 ..text = 'Frame ${_frame.index}', 2603 ..text = 'Frame ${_frame.index}',
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 } 2637 }
2651 2638
2652 bool matchFrame(S.Frame newFrame) { 2639 bool matchFrame(S.Frame newFrame) {
2653 if (newFrame.kind != _frame.kind) { 2640 if (newFrame.kind != _frame.kind) {
2654 return false; 2641 return false;
2655 } 2642 }
2656 if (newFrame.function == null) { 2643 if (newFrame.function == null) {
2657 return frame.function == null; 2644 return frame.function == null;
2658 } 2645 }
2659 return (newFrame.function.id == _frame.function.id && 2646 return (newFrame.function.id == _frame.function.id &&
2660 newFrame.location.script.id == 2647 newFrame.location.script.id == frame.location.script.id);
2661 frame.location.script.id);
2662 } 2648 }
2663 2649
2664 void updateFrame(S.Frame newFrame) { 2650 void updateFrame(S.Frame newFrame) {
2665 assert(matchFrame(newFrame)); 2651 assert(matchFrame(newFrame));
2666 _frame = newFrame; 2652 _frame = newFrame;
2667 } 2653 }
2668 2654
2669 S.Script get script => _frame.location.script; 2655 S.Script get script => _frame.location.script;
2670 2656
2671 int _varsTop(varsDiv) { 2657 int _varsTop(varsDiv) {
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
3335 ..setAttribute('height', '24') 3321 ..setAttribute('height', '24')
3336 ..children = [ 3322 ..children = [
3337 new PathElement() 3323 new PathElement()
3338 ..setAttribute( 3324 ..setAttribute(
3339 'd', 3325 'd',
3340 'M11 17h2v-6h-2v6zm1-15C6.48 2 2 6.48 2 12s4.48 10 ' 3326 'M11 17h2v-6h-2v6zm1-15C6.48 2 2 6.48 2 12s4.48 10 '
3341 '10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 ' 3327 '10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 '
3342 '0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zM11 ' 3328 '0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zM11 '
3343 '9h2V7h-2v2z') 3329 '9h2V7h-2v2z')
3344 ]; 3330 ];
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/cli/command.dart ('k') | runtime/observatory/lib/src/elements/heap_snapshot.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698