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 'observatory_element.dart'; | 9 import 'observatory_element.dart'; |
10 import 'package:observatory/cli.dart'; | 10 import 'package:observatory/cli.dart'; |
(...skipping 12 matching lines...) Expand all Loading... |
23 String get helpLong; | 23 String get helpLong; |
24 } | 24 } |
25 | 25 |
26 // TODO(turnidge): Rewrite HelpCommand so that it is a general utility | 26 // TODO(turnidge): Rewrite HelpCommand so that it is a general utility |
27 // provided by the cli library. | 27 // provided by the cli library. |
28 class HelpCommand extends DebuggerCommand { | 28 class HelpCommand extends DebuggerCommand { |
29 HelpCommand(Debugger debugger) : super(debugger, 'help', []); | 29 HelpCommand(Debugger debugger) : super(debugger, 'help', []); |
30 | 30 |
31 String _nameAndAlias(Command cmd) { | 31 String _nameAndAlias(Command cmd) { |
32 if (cmd.alias == null) { | 32 if (cmd.alias == null) { |
33 return cmd.name; | 33 return cmd.fullName; |
34 } else { | 34 } else { |
35 return '${cmd.name}, ${cmd.alias}'; | 35 return '${cmd.fullName}, ${cmd.alias}'; |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 Future run(List<String> args) { | 39 Future run(List<String> args) { |
40 var con = debugger.console; | 40 var con = debugger.console; |
41 if (args.length == 0) { | 41 if (args.length == 0) { |
42 // Print list of all top-level commands. | 42 // Print list of all top-level commands. |
43 var commands = debugger.cmd.matchCommand([], false); | 43 var commands = debugger.cmd.matchCommand([], false); |
44 commands.sort((a, b) => a.name.compareTo(b.name)); | 44 commands.sort((a, b) => a.name.compareTo(b.name)); |
45 con.print('List of commands:\n'); | 45 con.print('List of commands:\n'); |
46 for (var command in commands) { | 46 for (var command in commands) { |
47 con.print('${_nameAndAlias(command).padRight(12)} ' | 47 con.print('${_nameAndAlias(command).padRight(12)} ' |
48 '- ${command.helpShort}'); | 48 '- ${command.helpShort}'); |
49 } | 49 } |
50 con.print( | 50 con.print( |
51 "\nFor more information on a specific command type 'help <command>'\n" | 51 "\nFor more information on a specific command type 'help <command>'\n" |
52 "\n" | 52 "\n" |
53 "Command prefixes are accepted (e.g. 'h' for 'help')\n" | 53 "Command prefixes are accepted (e.g. 'h' for 'help')\n" |
54 "Hit [TAB] to complete a command (try 'i[TAB][TAB]')\n" | 54 "Hit [TAB] to complete a command (try 'is[TAB][TAB]')\n" |
55 "Hit [ENTER] to repeat the last command\n" | 55 "Hit [ENTER] to repeat the last command\n" |
56 "Use up/down arrow for command history\n"); | 56 "Use up/down arrow for command history\n"); |
57 return new Future.value(null); | 57 return new Future.value(null); |
58 } else { | 58 } else { |
59 // Print any matching commands. | 59 // Print any matching commands. |
60 var commands = debugger.cmd.matchCommand(args, true); | 60 var commands = debugger.cmd.matchCommand(args, true); |
61 commands.sort((a, b) => a.name.compareTo(b.name)); | 61 commands.sort((a, b) => a.name.compareTo(b.name)); |
62 if (commands.isEmpty) { | 62 if (commands.isEmpty) { |
63 var line = args.join(' '); | 63 var line = args.join(' '); |
64 con.print("No command matches '${line}'"); | 64 con.print("No command matches '${line}'"); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 } else { | 402 } else { |
403 // TODO(turnidge): Adding a duplicate breakpoint is | 403 // TODO(turnidge): Adding a duplicate breakpoint is |
404 // currently ignored. May want to change the protocol to | 404 // currently ignored. May want to change the protocol to |
405 // inform us when this happens. | 405 // inform us when this happens. |
406 } | 406 } |
407 return new Future.value(null); | 407 return new Future.value(null); |
408 } | 408 } |
409 | 409 |
410 Future<List<String>> complete(List<String> args) { | 410 Future<List<String>> complete(List<String> args) { |
411 if (args.length != 1) { | 411 if (args.length != 1) { |
412 return new Future.value([]); | 412 return new Future.value([args.join('')]); |
413 } | 413 } |
414 // TODO - fix SourceLocation complete | 414 // TODO - fix SourceLocation complete |
415 return new Future.value(SourceLocation.complete(debugger, args[0])); | 415 return new Future.value(SourceLocation.complete(debugger, args[0])); |
416 } | 416 } |
417 | 417 |
418 String helpShort = 'Add a breakpoint by source location or function name'; | 418 String helpShort = 'Add a breakpoint by source location or function name'; |
419 | 419 |
420 String helpLong = | 420 String helpLong = |
421 'Add a breakpoint by source location or function name.\n' | 421 'Add a breakpoint by source location or function name.\n' |
422 '\n' | 422 '\n' |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 } | 486 } |
487 debugger.console.print('No breakpoint found at ${loc}'); | 487 debugger.console.print('No breakpoint found at ${loc}'); |
488 } else { | 488 } else { |
489 debugger.console.print(loc.errorMessage); | 489 debugger.console.print(loc.errorMessage); |
490 } | 490 } |
491 }); | 491 }); |
492 } | 492 } |
493 | 493 |
494 Future<List<String>> complete(List<String> args) { | 494 Future<List<String>> complete(List<String> args) { |
495 if (args.length != 1) { | 495 if (args.length != 1) { |
496 return new Future.value([]); | 496 return new Future.value([args.join('')]); |
497 } | 497 } |
498 return new Future.value(SourceLocation.complete(debugger, args[0])); | 498 return new Future.value(SourceLocation.complete(debugger, args[0])); |
499 } | 499 } |
500 | 500 |
501 String helpShort = 'Remove a breakpoint by source location or function name'; | 501 String helpShort = 'Remove a breakpoint by source location or function name'; |
502 | 502 |
503 String helpLong = | 503 String helpLong = |
504 'Remove a breakpoint by source location or function name.\n' | 504 'Remove a breakpoint by source location or function name.\n' |
505 '\n' | 505 '\n' |
506 'Syntax: clear ' | 506 'Syntax: clear ' |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 } | 596 } |
597 | 597 |
598 String helpShort = 'List all breakpoints'; | 598 String helpShort = 'List all breakpoints'; |
599 | 599 |
600 String helpLong = | 600 String helpLong = |
601 'List all breakpoints.\n' | 601 'List all breakpoints.\n' |
602 '\n' | 602 '\n' |
603 'Syntax: info breakpoints\n'; | 603 'Syntax: info breakpoints\n'; |
604 } | 604 } |
605 | 605 |
606 class InfoIsolatesCommand extends DebuggerCommand { | 606 class InfoFrameCommand extends DebuggerCommand { |
607 InfoIsolatesCommand(Debugger debugger) : super(debugger, 'isolates', []); | 607 InfoFrameCommand(Debugger debugger) : super(debugger, 'frame', []); |
608 | 608 |
609 Future run(List<String> args) { | 609 Future run(List<String> args) { |
610 for (var isolate in debugger.isolate.vm.isolates) { | 610 if (args.length > 0) { |
611 String current = (isolate == debugger.isolate ? ' *' : ''); | 611 debugger.console.print('info frame expects no arguments'); |
612 debugger.console.print( | 612 return new Future.value(null); |
613 "Isolate ${isolate.id} '${isolate.name}'${current}"); | 613 } |
| 614 debugger.console.print('frame = ${debugger.currentFrame}'); |
| 615 return new Future.value(null); |
| 616 } |
| 617 |
| 618 String helpShort = 'Show current frame'; |
| 619 |
| 620 String helpLong = |
| 621 'Show current frame.\n' |
| 622 '\n' |
| 623 'Syntax: info frame\n'; |
| 624 } |
| 625 |
| 626 class IsolateCommand extends DebuggerCommand { |
| 627 IsolateCommand(Debugger debugger) : super(debugger, 'isolate', [ |
| 628 new IsolateListCommand(debugger), |
| 629 new IsolateNameCommand(debugger), |
| 630 ]) { |
| 631 alias = 'i'; |
| 632 } |
| 633 |
| 634 Future run(List<String> args) { |
| 635 if (args.length != 1) { |
| 636 debugger.console.print('isolate expects one argument'); |
| 637 return new Future.value(null); |
| 638 } |
| 639 var arg = args[0].trim(); |
| 640 var num = int.parse(arg, onError:(_) => null); |
| 641 |
| 642 var candidate; |
| 643 for (var isolate in debugger.vm.isolates) { |
| 644 if (num != null && num == isolate.number) { |
| 645 candidate = isolate; |
| 646 break; |
| 647 } else if (arg == isolate.name) { |
| 648 if (candidate != null) { |
| 649 debugger.console.print( |
| 650 "Isolate identifier '${arg}' is ambiguous: " |
| 651 'use the isolate number instead'); |
| 652 return new Future.value(null); |
| 653 } |
| 654 candidate = isolate; |
| 655 } |
| 656 } |
| 657 if (candidate == null) { |
| 658 debugger.console.print("Invalid isolate identifier '${arg}'"); |
| 659 } else { |
| 660 if (candidate == debugger.isolate) { |
| 661 debugger.console.print( |
| 662 "Current isolate is already ${candidate.number} '${candidate.name}'"
); |
| 663 } else { |
| 664 debugger.console.print( |
| 665 "Switching to isolate ${candidate.number} '${candidate.name}'"); |
| 666 debugger.isolate = candidate; |
| 667 } |
614 } | 668 } |
615 return new Future.value(null); | 669 return new Future.value(null); |
616 } | 670 } |
| 671 |
| 672 Future<List<String>> complete(List<String> args) { |
| 673 if (args.length != 1) { |
| 674 return new Future.value([args.join('')]); |
| 675 } |
| 676 var isolates = debugger.vm.isolates.toList(); |
| 677 isolates.sort((a, b) => a.startTime.compareTo(b.startTime)); |
| 678 var result = []; |
| 679 for (var isolate in isolates) { |
| 680 var str = isolate.number.toString(); |
| 681 if (str.startsWith(args[0])) { |
| 682 result.add('$str '); |
| 683 } |
| 684 } |
| 685 for (var isolate in isolates) { |
| 686 if (isolate.name.startsWith(args[0])) { |
| 687 result.add('${isolate.name} '); |
| 688 } |
| 689 } |
| 690 return new Future.value(result); |
| 691 } |
| 692 String helpShort = 'Switch the current isolate'; |
| 693 |
| 694 String helpLong = |
| 695 'Switch the current isolate.\n' |
| 696 '\n' |
| 697 'Syntax: isolate <number>\n' |
| 698 ' isolate <name>\n'; |
| 699 } |
| 700 |
| 701 class IsolateListCommand extends DebuggerCommand { |
| 702 IsolateListCommand(Debugger debugger) : super(debugger, 'list', []); |
| 703 |
| 704 Future run(List<String> args) { |
| 705 if (debugger.vm == null) { |
| 706 debugger.console.print( |
| 707 "Internal error: vm has not been set"); |
| 708 return new Future.value(null); |
| 709 } |
| 710 var isolates = debugger.vm.isolates.toList(); |
| 711 isolates.sort((a, b) => a.startTime.compareTo(b.startTime)); |
| 712 for (var isolate in isolates) { |
| 713 String current = (isolate == debugger.isolate ? ' *' : ''); |
| 714 debugger.console.print( |
| 715 "Isolate ${isolate.number} '${isolate.name}'${current}"); |
| 716 } |
| 717 return new Future.value(null); |
| 718 } |
617 | 719 |
618 String helpShort = 'List all isolates'; | 720 String helpShort = 'List all isolates'; |
619 | 721 |
620 String helpLong = | 722 String helpLong = |
621 'List all isolates.\n' | 723 'List all isolates.\n' |
622 '\n' | 724 '\n' |
623 'Syntax: info isolates\n'; | 725 'Syntax: isolate list\n'; |
624 } | 726 } |
625 | 727 |
626 class InfoFrameCommand extends DebuggerCommand { | 728 class IsolateNameCommand extends DebuggerCommand { |
627 InfoFrameCommand(Debugger debugger) : super(debugger, 'frame', []); | 729 IsolateNameCommand(Debugger debugger) : super(debugger, 'name', []); |
628 | 730 |
629 Future run(List<String> args) { | 731 Future run(List<String> args) { |
630 if (args.length > 0) { | 732 if (args.length != 1) { |
631 debugger.console.print('info frame expects 1 argument'); | 733 debugger.console.print('isolate name expects one argument'); |
632 return new Future.value(null); | 734 return new Future.value(null); |
633 } | 735 } |
634 debugger.console.print('frame = ${debugger.currentFrame}'); | 736 return debugger.isolate.setName(args[0]); |
635 return new Future.value(null); | |
636 } | 737 } |
637 | 738 |
638 String helpShort = 'Show current frame'; | 739 String helpShort = 'Rename an isolate'; |
639 | 740 |
640 String helpLong = | 741 String helpLong = |
641 'Show current frame.\n' | 742 'Rename an isolate.\n' |
642 '\n' | 743 '\n' |
643 'Syntax: info frame\n'; | 744 'Syntax: isolate name <name>\n'; |
644 } | 745 } |
645 | 746 |
646 class InfoCommand extends DebuggerCommand { | 747 class InfoCommand extends DebuggerCommand { |
647 InfoCommand(Debugger debugger) : super(debugger, 'info', [ | 748 InfoCommand(Debugger debugger) : super(debugger, 'info', [ |
648 new InfoBreakpointsCommand(debugger), | 749 new InfoBreakpointsCommand(debugger), |
649 new InfoIsolatesCommand(debugger), | 750 new InfoFrameCommand(debugger)]); |
650 new InfoFrameCommand(debugger), | |
651 ]); | |
652 | 751 |
653 Future run(List<String> args) { | 752 Future run(List<String> args) { |
654 debugger.console.print("'info' expects a subcommand (see 'help info')"); | 753 debugger.console.print("'info' expects a subcommand (see 'help info')"); |
655 return new Future.value(null); | 754 return new Future.value(null); |
656 } | 755 } |
657 | 756 |
658 String helpShort = 'Show information on a variety of topics'; | 757 String helpShort = 'Show information on a variety of topics'; |
659 | 758 |
660 String helpLong = | 759 String helpLong = |
661 'Show information on a variety of topics.\n' | 760 'Show information on a variety of topics.\n' |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 | 816 |
718 String helpLong = | 817 String helpLong = |
719 'Refresh debugging information of various sorts.\n' | 818 'Refresh debugging information of various sorts.\n' |
720 '\n' | 819 '\n' |
721 'Syntax: refresh <subcommand>\n'; | 820 'Syntax: refresh <subcommand>\n'; |
722 } | 821 } |
723 | 822 |
724 // Tracks the state for an isolate debugging session. | 823 // Tracks the state for an isolate debugging session. |
725 class ObservatoryDebugger extends Debugger { | 824 class ObservatoryDebugger extends Debugger { |
726 RootCommand cmd; | 825 RootCommand cmd; |
| 826 DebuggerPageElement page; |
727 DebuggerConsoleElement console; | 827 DebuggerConsoleElement console; |
728 DebuggerStackElement stackElement; | 828 DebuggerStackElement stackElement; |
729 ServiceMap stack; | 829 ServiceMap stack; |
730 | 830 |
731 int get currentFrame => _currentFrame; | 831 int get currentFrame => _currentFrame; |
732 void set currentFrame(int value) { | 832 void set currentFrame(int value) { |
733 if (value != null && (value < 0 || value >= stackDepth)) { | 833 if (value != null && (value < 0 || value >= stackDepth)) { |
734 throw new RangeError.range(value, 0, stackDepth); | 834 throw new RangeError.range(value, 0, stackDepth); |
735 } | 835 } |
736 _currentFrame = value; | 836 _currentFrame = value; |
(...skipping 14 matching lines...) Expand all Loading... |
751 new FrameCommand(this), | 851 new FrameCommand(this), |
752 new PauseCommand(this), | 852 new PauseCommand(this), |
753 new ContinueCommand(this), | 853 new ContinueCommand(this), |
754 new NextCommand(this), | 854 new NextCommand(this), |
755 new StepCommand(this), | 855 new StepCommand(this), |
756 new FinishCommand(this), | 856 new FinishCommand(this), |
757 new BreakCommand(this), | 857 new BreakCommand(this), |
758 new ClearCommand(this), | 858 new ClearCommand(this), |
759 new DeleteCommand(this), | 859 new DeleteCommand(this), |
760 new InfoCommand(this), | 860 new InfoCommand(this), |
| 861 new IsolateCommand(this), |
761 new RefreshCommand(this), | 862 new RefreshCommand(this), |
762 ]); | 863 ]); |
763 } | 864 } |
764 | 865 |
765 void set isolate(Isolate iso) { | 866 VM get vm => page.app.vm; |
| 867 |
| 868 void updateIsolate(Isolate iso) { |
766 _isolate = iso; | 869 _isolate = iso; |
767 if (_isolate != null) { | 870 if (_isolate != null) { |
768 _isolate.reload().then((_) { | 871 _isolate.reload().then((response) { |
769 // TODO(turnidge): Currently the debugger relies on all libs | 872 // TODO(turnidge): Currently the debugger relies on all libs |
770 // being loaded. Fix this. | 873 // being loaded. Fix this. |
771 var pending = []; | 874 var pending = []; |
772 for (var lib in _isolate.libraries) { | 875 for (var lib in _isolate.libraries) { |
773 if (!lib.loaded) { | 876 if (!lib.loaded) { |
774 pending.add(lib.load()); | 877 pending.add(lib.load()); |
775 } | 878 } |
776 } | 879 } |
777 Future.wait(pending).then((_) { | 880 Future.wait(pending).then((_) { |
778 _isolate.vm.events.stream.listen(_onEvent); | 881 if (_subscription == null) { |
| 882 _subscription = vm.events.stream.listen(_onEvent); |
| 883 } |
779 _refreshStack(isolate.pauseEvent).then((_) { | 884 _refreshStack(isolate.pauseEvent).then((_) { |
780 reportStatus(); | 885 reportStatus(); |
781 }); | 886 }); |
782 }); | 887 }); |
783 }); | 888 }); |
| 889 } else { |
| 890 reportStatus(); |
784 } | 891 } |
785 } | 892 } |
| 893 |
| 894 void set isolate(Isolate iso) { |
| 895 // Setting the page's isolate will trigger updateIsolate to be called. |
| 896 // |
| 897 // TODO(turnidge): Rework ownership of the ObservatoryDebugger in another |
| 898 // change. |
| 899 page.isolate = iso; |
| 900 } |
786 Isolate get isolate => _isolate; | 901 Isolate get isolate => _isolate; |
787 Isolate _isolate; | 902 Isolate _isolate; |
| 903 var _subscription; |
788 | 904 |
789 void init() { | 905 void init() { |
790 console.newline(); | 906 console.newline(); |
791 console.printBold("Type 'h' for help"); | 907 console.printBold("Type 'h' for help"); |
| 908 // Wait a bit and if polymer still hasn't set up the isolate, |
| 909 // report this to the user. |
| 910 new Timer(const Duration(seconds:1), () { |
| 911 if (isolate == null) { |
| 912 reportStatus(); |
| 913 } |
| 914 }); |
792 } | 915 } |
793 | 916 |
794 Future refreshStack() { | 917 Future refreshStack() { |
795 return _refreshStack(isolate.pauseEvent).then((_) { | 918 return _refreshStack(isolate.pauseEvent).then((_) { |
796 reportStatus(); | 919 reportStatus(); |
797 }); | 920 }); |
798 } | 921 } |
799 | 922 |
800 bool isolatePaused() { | 923 bool isolatePaused() { |
801 // TODO(turnidge): Stop relying on the isolate to track the last | 924 // TODO(turnidge): Stop relying on the isolate to track the last |
802 // pause event. Since we listen to events directly in the | 925 // pause event. Since we listen to events directly in the |
803 // debugger, this could introduce a race. | 926 // debugger, this could introduce a race. |
804 return (isolate != null && | 927 return (isolate != null && |
805 isolate.pauseEvent != null && | 928 isolate.pauseEvent != null && |
806 isolate.pauseEvent.eventType != ServiceEvent.kResume); | 929 isolate.pauseEvent.eventType != ServiceEvent.kResume); |
807 } | 930 } |
(...skipping 15 matching lines...) Expand all Loading... |
823 stackElement.updateStack(stack, pauseEvent); | 946 stackElement.updateStack(stack, pauseEvent); |
824 if (stack['frames'].length > 0) { | 947 if (stack['frames'].length > 0) { |
825 currentFrame = 0; | 948 currentFrame = 0; |
826 } else { | 949 } else { |
827 currentFrame = null; | 950 currentFrame = null; |
828 } | 951 } |
829 }); | 952 }); |
830 } | 953 } |
831 | 954 |
832 void reportStatus() { | 955 void reportStatus() { |
833 if (_isolate.idle) { | 956 if (_isolate == null) { |
| 957 console.print('No current isolate'); |
| 958 } else if (_isolate.idle) { |
834 console.print('Isolate is idle'); | 959 console.print('Isolate is idle'); |
835 } else if (_isolate.running) { | 960 } else if (_isolate.running) { |
836 console.print("Isolate is running (type 'pause' to interrupt)"); | 961 console.print("Isolate is running (type 'pause' to interrupt)"); |
837 } else if (_isolate.pauseEvent != null) { | 962 } else if (_isolate.pauseEvent != null) { |
838 _reportPause(_isolate.pauseEvent); | 963 _reportPause(_isolate.pauseEvent); |
839 } else { | 964 } else { |
840 console.print('Isolate is in unknown state'); | 965 console.print('Isolate is in unknown state'); |
841 } | 966 } |
842 } | 967 } |
843 | 968 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 console.print( | 1020 console.print( |
896 'Breakpoint ${bpId} ${verb} at ${script.name}:${line}:${col}'); | 1021 'Breakpoint ${bpId} ${verb} at ${script.name}:${line}:${col}'); |
897 } else { | 1022 } else { |
898 console.print( | 1023 console.print( |
899 'Future breakpoint ${bpId} ${verb} at ${script.name}:${line}:${col}'
); | 1024 'Future breakpoint ${bpId} ${verb} at ${script.name}:${line}:${col}'
); |
900 } | 1025 } |
901 }); | 1026 }); |
902 } | 1027 } |
903 | 1028 |
904 void _onEvent(ServiceEvent event) { | 1029 void _onEvent(ServiceEvent event) { |
905 if (event.owner != isolate) { | |
906 return; | |
907 } | |
908 switch(event.eventType) { | 1030 switch(event.eventType) { |
909 case ServiceEvent.kIsolateExit: | 1031 case ServiceEvent.kIsolateStart: { |
910 console.print('Isolate shutdown'); | 1032 var iso = event.owner; |
911 isolate = null; | 1033 console.print( |
| 1034 "Isolate ${iso.number} '${iso.name}' has been created"); |
| 1035 break; |
| 1036 } |
| 1037 |
| 1038 case ServiceEvent.kIsolateExit: { |
| 1039 var iso = event.owner; |
| 1040 if (iso == isolate) { |
| 1041 console.print("The current isolate has exited"); |
| 1042 } else { |
| 1043 console.print( |
| 1044 "Isolate ${iso.number} '${iso.name}' has exited"); |
| 1045 } |
| 1046 break; |
| 1047 } |
| 1048 |
| 1049 case ServiceEvent.kIsolateUpdate: |
| 1050 var iso = event.owner; |
| 1051 console.print("Isolate ${iso.number} renamed to '${iso.name}'"); |
912 break; | 1052 break; |
913 | 1053 |
914 case ServiceEvent.kPauseStart: | 1054 case ServiceEvent.kPauseStart: |
915 case ServiceEvent.kPauseExit: | 1055 case ServiceEvent.kPauseExit: |
916 case ServiceEvent.kPauseBreakpoint: | 1056 case ServiceEvent.kPauseBreakpoint: |
917 case ServiceEvent.kPauseInterrupted: | 1057 case ServiceEvent.kPauseInterrupted: |
918 case ServiceEvent.kPauseException: | 1058 case ServiceEvent.kPauseException: |
919 _refreshStack(event).then((_) { | 1059 if (event.owner == isolate) { |
920 _reportPause(event); | 1060 _refreshStack(event).then((_) { |
921 }); | 1061 _reportPause(event); |
| 1062 }); |
| 1063 } |
922 break; | 1064 break; |
923 | 1065 |
924 case ServiceEvent.kResume: | 1066 case ServiceEvent.kResume: |
925 console.print('Continuing...'); | 1067 if (event.owner == isolate) { |
| 1068 console.print('Continuing...'); |
| 1069 } |
926 break; | 1070 break; |
927 | 1071 |
928 case ServiceEvent.kBreakpointAdded: | 1072 case ServiceEvent.kBreakpointAdded: |
929 case ServiceEvent.kBreakpointResolved: | 1073 case ServiceEvent.kBreakpointResolved: |
930 case ServiceEvent.kBreakpointRemoved: | 1074 case ServiceEvent.kBreakpointRemoved: |
931 _reportBreakpointEvent(event); | 1075 if (event.owner == isolate) { |
| 1076 _reportBreakpointEvent(event); |
| 1077 } |
932 break; | 1078 break; |
933 | 1079 |
934 case ServiceEvent.kIsolateStart: | 1080 case ServiceEvent.kIsolateStart: |
935 case ServiceEvent.kGraph: | 1081 case ServiceEvent.kGraph: |
936 case ServiceEvent.kGC: | 1082 case ServiceEvent.kGC: |
937 // Ignore these events for now. | |
938 break; | 1083 break; |
939 | 1084 |
940 default: | 1085 default: |
941 console.print('Unrecognized event: $event'); | 1086 console.print('Unrecognized event: $event'); |
942 break; | 1087 break; |
943 } | 1088 } |
944 } | 1089 } |
945 | 1090 |
946 static String _commonPrefix(String a, String b) { | 1091 static String _commonPrefix(String a, String b) { |
947 int pos = 0; | 1092 int pos = 0; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 return cmd.historyPrev(command); | 1146 return cmd.historyPrev(command); |
1002 } | 1147 } |
1003 | 1148 |
1004 String historyNext(String command) { | 1149 String historyNext(String command) { |
1005 return cmd.historyNext(command); | 1150 return cmd.historyNext(command); |
1006 } | 1151 } |
1007 } | 1152 } |
1008 | 1153 |
1009 @CustomTag('debugger-page') | 1154 @CustomTag('debugger-page') |
1010 class DebuggerPageElement extends ObservatoryElement { | 1155 class DebuggerPageElement extends ObservatoryElement { |
| 1156 @published ObservatoryApplication app; |
1011 @published Isolate isolate; | 1157 @published Isolate isolate; |
1012 | 1158 |
1013 isolateChanged(oldValue) { | 1159 isolateChanged(oldValue) { |
1014 if (isolate != null) { | 1160 if (isolate != null) { |
1015 debugger.isolate = isolate; | 1161 debugger.updateIsolate(isolate); |
1016 } | 1162 } |
1017 } | 1163 } |
1018 ObservatoryDebugger debugger = new ObservatoryDebugger(); | 1164 ObservatoryDebugger debugger = new ObservatoryDebugger(); |
1019 | 1165 |
1020 DebuggerPageElement.created() : super.created(); | 1166 DebuggerPageElement.created() : super.created() { |
| 1167 debugger.page = this; |
| 1168 } |
1021 | 1169 |
1022 @override | 1170 @override |
1023 void attached() { | 1171 void attached() { |
1024 super.attached(); | 1172 super.attached(); |
1025 | 1173 |
1026 var navbarDiv = $['navbarDiv']; | 1174 var navbarDiv = $['navbarDiv']; |
1027 var stackDiv = $['stackDiv']; | 1175 var stackDiv = $['stackDiv']; |
1028 var splitterDiv = $['splitterDiv']; | 1176 var splitterDiv = $['splitterDiv']; |
1029 var cmdDiv = $['commandDiv']; | 1177 var cmdDiv = $['commandDiv']; |
1030 var consoleDiv = $['consoleDiv']; | 1178 var consoleDiv = $['consoleDiv']; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 default: | 1494 default: |
1347 busy = false; | 1495 busy = false; |
1348 break; | 1496 break; |
1349 } | 1497 } |
1350 }); | 1498 }); |
1351 } | 1499 } |
1352 | 1500 |
1353 DebuggerInputElement.created() : super.created(); | 1501 DebuggerInputElement.created() : super.created(); |
1354 } | 1502 } |
1355 | 1503 |
OLD | NEW |