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

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

Issue 1174313002: Allow setting break-on-exceptions option over the service protocol. (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
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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 359
360 String helpShort = 360 String helpShort =
361 'Continue running the isolate until the current function exits'; 361 'Continue running the isolate until the current function exits';
362 362
363 String helpLong = 363 String helpLong =
364 'Continue running the isolate until the current function exits.\n' 364 'Continue running the isolate until the current function exits.\n'
365 '\n' 365 '\n'
366 'Syntax: finish\n'; 366 'Syntax: finish\n';
367 } 367 }
368 368
369 class BreakOnExceptionsCommand extends DebuggerCommand {
370 BreakOnExceptionsCommand(Debugger debugger)
371 : super(debugger, 'break-on-exceptions', []);
rmacnak 2015/06/11 17:31:17 Don't really want to introduce the first hyphenate
Cutch 2015/06/11 21:20:12 What about a 'set' command for configuring behavio
rmacnak 2015/06/12 00:09:38 Somewhat better.
372
373 Future run(List<String> args) async {
374 if (args.length == 0) {
375 var result = await debugger.isolate.getExceptionPauseInfo();
376 debugger.console.print(result.toString());
377 } else if (args.length == 1) {
378 var result = await debugger.isolate.setExceptionPauseInfo(args[0]);
379 debugger.console.print(result.toString());
380 } else {
381 debugger.console.print("break-on-exceptions expects 0 or 1 argument");
382 }
383 }
384
385 String helpShort =
386 'Set the break-on-exceptions policy: all, none or unhandled';
387
388 String helpLong =
389 'Set the break-on-exceptions policy: all, none or unhandled'
390 '\n'
391 'Syntax: break-on-exceptions "all" | "none" | "unhandled"'
392 '- Set the policy\n'
393 ' break-on-exceptions '
394 '- Query the policy\n';
395 }
396
369 class BreakCommand extends DebuggerCommand { 397 class BreakCommand extends DebuggerCommand {
370 BreakCommand(Debugger debugger) : super(debugger, 'break', []); 398 BreakCommand(Debugger debugger) : super(debugger, 'break', []);
371 399
372 Future run(List<String> args) async { 400 Future run(List<String> args) async {
373 if (args.length > 1) { 401 if (args.length > 1) {
374 debugger.console.print('not implemented'); 402 debugger.console.print('not implemented');
375 return new Future.value(null); 403 return new Future.value(null);
376 } 404 }
377 var arg = (args.length == 0 ? '' : args[0]); 405 var arg = (args.length == 0 ? '' : args[0]);
378 var loc = await DebuggerLocation.parse(debugger, arg); 406 var loc = await DebuggerLocation.parse(debugger, arg);
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 new PrintCommand(this), 877 new PrintCommand(this),
850 new DownCommand(this), 878 new DownCommand(this),
851 new UpCommand(this), 879 new UpCommand(this),
852 new FrameCommand(this), 880 new FrameCommand(this),
853 new PauseCommand(this), 881 new PauseCommand(this),
854 new ContinueCommand(this), 882 new ContinueCommand(this),
855 new NextCommand(this), 883 new NextCommand(this),
856 new StepCommand(this), 884 new StepCommand(this),
857 new FinishCommand(this), 885 new FinishCommand(this),
858 new BreakCommand(this), 886 new BreakCommand(this),
887 new BreakOnExceptionsCommand(this),
859 new ClearCommand(this), 888 new ClearCommand(this),
860 new DeleteCommand(this), 889 new DeleteCommand(this),
861 new InfoCommand(this), 890 new InfoCommand(this),
862 new IsolateCommand(this), 891 new IsolateCommand(this),
863 new RefreshCommand(this), 892 new RefreshCommand(this),
864 ]); 893 ]);
865 } 894 }
866 895
867 VM get vm => page.app.vm; 896 VM get vm => page.app.vm;
868 897
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 Frame frame = stack['frames'][0]; 1014 Frame frame = stack['frames'][0];
986 var script = frame.location.script; 1015 var script = frame.location.script;
987 script.load().then((_) { 1016 script.load().then((_) {
988 var line = script.tokenToLine(frame.location.tokenPos); 1017 var line = script.tokenToLine(frame.location.tokenPos);
989 var col = script.tokenToCol(frame.location.tokenPos); 1018 var col = script.tokenToCol(frame.location.tokenPos);
990 if (event.breakpoint != null) { 1019 if (event.breakpoint != null) {
991 var bpId = event.breakpoint.number; 1020 var bpId = event.breakpoint.number;
992 console.print('Paused at breakpoint ${bpId} at ' 1021 console.print('Paused at breakpoint ${bpId} at '
993 '${script.name}:${line}:${col}'); 1022 '${script.name}:${line}:${col}');
994 } else if (event.exception != null) { 1023 } else if (event.exception != null) {
995 // TODO(turnidge): Test this. 1024 console.print('Paused due to exception at '
996 console.print('Paused due to exception ${event.exception} at '
997 '${script.name}:${line}:${col}'); 1025 '${script.name}:${line}:${col}');
1026 // This seems to be missing if we are paused-at-exception after
1027 // paused-at-isolate-exit. Maybe we shutdown part of the debugger too
1028 // soon?
1029 console.printRef(event.exception);
998 } else { 1030 } else {
999 console.print('Paused at ${script.name}:${line}:${col}'); 1031 console.print('Paused at ${script.name}:${line}:${col}');
1000 } 1032 }
1001 }); 1033 });
1002 } 1034 }
1003 } 1035 }
1004 1036
1005 Future _reportBreakpointEvent(ServiceEvent event) { 1037 Future _reportBreakpointEvent(ServiceEvent event) {
1006 var bpt = event.breakpoint; 1038 var bpt = event.breakpoint;
1007 var verb = null; 1039 var verb = null;
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 default: 1695 default:
1664 busy = false; 1696 busy = false;
1665 break; 1697 break;
1666 } 1698 }
1667 }); 1699 });
1668 } 1700 }
1669 1701
1670 DebuggerInputElement.created() : super.created(); 1702 DebuggerInputElement.created() : super.created();
1671 } 1703 }
1672 1704
OLDNEW
« no previous file with comments | « no previous file | runtime/observatory/lib/src/service/object.dart » ('j') | runtime/observatory/lib/src/service/object.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698