OLD | NEW |
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 'dart:math'; | 9 import 'dart:math'; |
10 import 'observatory_element.dart'; | 10 import 'observatory_element.dart'; |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 String helpLong = | 895 String helpLong = |
896 'Show current frame.\n' | 896 'Show current frame.\n' |
897 '\n' | 897 '\n' |
898 'Syntax: info frame\n'; | 898 'Syntax: info frame\n'; |
899 } | 899 } |
900 | 900 |
901 class IsolateCommand extends DebuggerCommand { | 901 class IsolateCommand extends DebuggerCommand { |
902 IsolateCommand(Debugger debugger) : super(debugger, 'isolate', [ | 902 IsolateCommand(Debugger debugger) : super(debugger, 'isolate', [ |
903 new IsolateListCommand(debugger), | 903 new IsolateListCommand(debugger), |
904 new IsolateNameCommand(debugger), | 904 new IsolateNameCommand(debugger), |
| 905 new IsolateReloadCommand(debugger), |
905 ]) { | 906 ]) { |
906 alias = 'i'; | 907 alias = 'i'; |
907 } | 908 } |
908 | 909 |
909 Future run(List<String> args) { | 910 Future run(List<String> args) { |
910 if (args.length != 1) { | 911 if (args.length != 1) { |
911 debugger.console.print('isolate expects one argument'); | 912 debugger.console.print('isolate expects one argument'); |
912 return new Future.value(null); | 913 return new Future.value(null); |
913 } | 914 } |
914 var arg = args[0].trim(); | 915 var arg = args[0].trim(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 result.add('$str '); | 956 result.add('$str '); |
956 } | 957 } |
957 } | 958 } |
958 for (var isolate in debugger.vm.isolates) { | 959 for (var isolate in debugger.vm.isolates) { |
959 if (isolate.name.startsWith(args[0])) { | 960 if (isolate.name.startsWith(args[0])) { |
960 result.add('${isolate.name} '); | 961 result.add('${isolate.name} '); |
961 } | 962 } |
962 } | 963 } |
963 return new Future.value(result); | 964 return new Future.value(result); |
964 } | 965 } |
965 String helpShort = 'Switch the current isolate'; | 966 String helpShort = 'Switch, list, rename, or reload isolates'; |
966 | 967 |
967 String helpLong = | 968 String helpLong = |
968 'Switch, list, or rename isolates.\n' | 969 'Switch the current isolate.\n' |
969 '\n' | 970 '\n' |
970 'Syntax: isolate <number>\n' | 971 'Syntax: isolate <number>\n' |
971 ' isolate <name>\n'; | 972 ' isolate <name>\n'; |
972 } | 973 } |
973 | 974 |
974 String _isolateRunState(Isolate isolate) { | 975 String _isolateRunState(Isolate isolate) { |
975 if (isolate.paused) { | 976 if (isolate.paused) { |
976 return 'paused'; | 977 return 'paused'; |
977 } else if (isolate.running) { | 978 } else if (isolate.running) { |
978 return 'running'; | 979 return 'running'; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 IsolateNameCommand(Debugger debugger) : super(debugger, 'name', []); | 1036 IsolateNameCommand(Debugger debugger) : super(debugger, 'name', []); |
1036 | 1037 |
1037 Future run(List<String> args) { | 1038 Future run(List<String> args) { |
1038 if (args.length != 1) { | 1039 if (args.length != 1) { |
1039 debugger.console.print('isolate name expects one argument'); | 1040 debugger.console.print('isolate name expects one argument'); |
1040 return new Future.value(null); | 1041 return new Future.value(null); |
1041 } | 1042 } |
1042 return debugger.isolate.setName(args[0]); | 1043 return debugger.isolate.setName(args[0]); |
1043 } | 1044 } |
1044 | 1045 |
1045 String helpShort = 'Rename an isolate'; | 1046 String helpShort = 'Rename the current isolate'; |
1046 | 1047 |
1047 String helpLong = | 1048 String helpLong = |
1048 'Rename an isolate.\n' | 1049 'Rename the current isolate.\n' |
1049 '\n' | 1050 '\n' |
1050 'Syntax: isolate name <name>\n'; | 1051 'Syntax: isolate name <name>\n'; |
1051 } | 1052 } |
1052 | 1053 |
| 1054 class IsolateReloadCommand extends DebuggerCommand { |
| 1055 IsolateReloadCommand(Debugger debugger) : super(debugger, 'reload', []); |
| 1056 |
| 1057 Future run(List<String> args) async { |
| 1058 if (debugger.isolate == null) { |
| 1059 debugger.console.print('There is no current vm'); |
| 1060 return; |
| 1061 } |
| 1062 |
| 1063 await debugger.isolate.reloadSources(); |
| 1064 |
| 1065 debugger.console.print('Isolate reloading....'); |
| 1066 } |
| 1067 |
| 1068 String helpShort = 'Reload the sources for the current isolate.'; |
| 1069 |
| 1070 String helpLong = |
| 1071 'Reload the sources for the current isolate.\n' |
| 1072 '\n' |
| 1073 'Syntax: reload\n'; |
| 1074 } |
| 1075 |
1053 class InfoCommand extends DebuggerCommand { | 1076 class InfoCommand extends DebuggerCommand { |
1054 InfoCommand(Debugger debugger) : super(debugger, 'info', [ | 1077 InfoCommand(Debugger debugger) : super(debugger, 'info', [ |
1055 new InfoBreakpointsCommand(debugger), | 1078 new InfoBreakpointsCommand(debugger), |
1056 new InfoFrameCommand(debugger)]); | 1079 new InfoFrameCommand(debugger)]); |
1057 | 1080 |
1058 Future run(List<String> args) { | 1081 Future run(List<String> args) { |
1059 debugger.console.print("'info' expects a subcommand (see 'help info')"); | 1082 debugger.console.print("'info' expects a subcommand (see 'help info')"); |
1060 return new Future.value(null); | 1083 return new Future.value(null); |
1061 } | 1084 } |
1062 | 1085 |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 breakOnException = event.exceptions; | 1666 breakOnException = event.exceptions; |
1644 console.print("Now pausing for exceptions: $breakOnException"); | 1667 console.print("Now pausing for exceptions: $breakOnException"); |
1645 } | 1668 } |
1646 break; | 1669 break; |
1647 | 1670 |
1648 case ServiceEvent.kIsolateUpdate: | 1671 case ServiceEvent.kIsolateUpdate: |
1649 var iso = event.owner; | 1672 var iso = event.owner; |
1650 console.print("Isolate ${iso.number} renamed to '${iso.name}'"); | 1673 console.print("Isolate ${iso.number} renamed to '${iso.name}'"); |
1651 break; | 1674 break; |
1652 | 1675 |
| 1676 case ServiceEvent.kIsolateReload: |
| 1677 var reloadError = event.reloadError; |
| 1678 if (reloadError != null) { |
| 1679 console.print('Isolate reload failed: ${event.reloadError}'); |
| 1680 } else { |
| 1681 console.print('Isolate reloaded.'); |
| 1682 } |
| 1683 break; |
| 1684 |
1653 case ServiceEvent.kPauseStart: | 1685 case ServiceEvent.kPauseStart: |
1654 case ServiceEvent.kPauseExit: | 1686 case ServiceEvent.kPauseExit: |
1655 case ServiceEvent.kPauseBreakpoint: | 1687 case ServiceEvent.kPauseBreakpoint: |
1656 case ServiceEvent.kPauseInterrupted: | 1688 case ServiceEvent.kPauseInterrupted: |
1657 case ServiceEvent.kPauseException: | 1689 case ServiceEvent.kPauseException: |
1658 if (event.owner == isolate) { | 1690 if (event.owner == isolate) { |
1659 _refreshStack(event).then((_) async { | 1691 _refreshStack(event).then((_) async { |
1660 flushStdio(); | 1692 flushStdio(); |
1661 if (isolate != null) { | 1693 if (isolate != null) { |
1662 await isolate.reload(); | 1694 await isolate.reload(); |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2672 } | 2704 } |
2673 }); | 2705 }); |
2674 } | 2706 } |
2675 | 2707 |
2676 void focus() { | 2708 void focus() { |
2677 $['textBox'].focus(); | 2709 $['textBox'].focus(); |
2678 } | 2710 } |
2679 | 2711 |
2680 DebuggerInputElement.created() : super.created(); | 2712 DebuggerInputElement.created() : super.created(); |
2681 } | 2713 } |
OLD | NEW |