OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 } | 708 } |
709 } | 709 } |
710 | 710 |
711 return request.toJSONProtocol(); | 711 return request.toJSONProtocol(); |
712 }; | 712 }; |
713 | 713 |
714 | 714 |
715 // Create a JSON request for the break command. | 715 // Create a JSON request for the break command. |
716 DebugRequest.prototype.breakCommandToJSONRequest_ = function(args) { | 716 DebugRequest.prototype.breakCommandToJSONRequest_ = function(args) { |
717 // Build a evaluate request from the text command. | 717 // Build a evaluate request from the text command. |
718 var request = this.createRequest('setbreakpoint'); | |
719 | |
720 // Process arguments if any. | 718 // Process arguments if any. |
721 if (args && args.length > 0) { | 719 if (args && args.length > 0) { |
722 var target = args; | 720 var target = args; |
723 var type = 'function'; | 721 var type = 'function'; |
724 var line; | 722 var line; |
725 var column; | 723 var column; |
726 var condition; | 724 var condition; |
727 var pos; | 725 var pos; |
728 | 726 |
| 727 var request = this.createRequest('setbreakpoint'); |
| 728 |
729 // Check for breakpoint condition. | 729 // Check for breakpoint condition. |
730 pos = args.indexOf(' '); | 730 pos = args.indexOf(' '); |
731 if (pos > 0) { | 731 if (pos > 0) { |
732 target = args.substring(0, pos); | 732 target = args.substring(0, pos); |
733 condition = args.substring(pos + 1, args.length); | 733 condition = args.substring(pos + 1, args.length); |
734 } | 734 } |
735 | 735 |
736 // Check for script breakpoint (name:line[:column]). If no ':' in break | 736 // Check for script breakpoint (name:line[:column]). If no ':' in break |
737 // specification it is considered a function break point. | 737 // specification it is considered a function break point. |
738 pos = target.indexOf(':'); | 738 pos = target.indexOf(':'); |
(...skipping 17 matching lines...) Expand all Loading... |
756 type = 'function'; | 756 type = 'function'; |
757 } | 757 } |
758 | 758 |
759 request.arguments = {}; | 759 request.arguments = {}; |
760 request.arguments.type = type; | 760 request.arguments.type = type; |
761 request.arguments.target = target; | 761 request.arguments.target = target; |
762 request.arguments.line = line; | 762 request.arguments.line = line; |
763 request.arguments.column = column; | 763 request.arguments.column = column; |
764 request.arguments.condition = condition; | 764 request.arguments.condition = condition; |
765 } else { | 765 } else { |
766 throw new Error('Invalid break arguments.'); | 766 var request = this.createRequest('suspend'); |
767 } | 767 } |
768 | 768 |
769 return request.toJSONProtocol(); | 769 return request.toJSONProtocol(); |
770 }; | 770 }; |
771 | 771 |
772 | 772 |
773 // Create a JSON request for the clear command. | 773 // Create a JSON request for the clear command. |
774 DebugRequest.prototype.clearCommandToJSONRequest_ = function(args) { | 774 DebugRequest.prototype.clearCommandToJSONRequest_ = function(args) { |
775 // Build a evaluate request from the text command. | 775 // Build a evaluate request from the text command. |
776 var request = this.createRequest('clearbreakpoint'); | 776 var request = this.createRequest('clearbreakpoint'); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 } | 810 } |
811 } | 811 } |
812 | 812 |
813 // Handle the help command. | 813 // Handle the help command. |
814 DebugRequest.prototype.helpCommand_ = function(args) { | 814 DebugRequest.prototype.helpCommand_ = function(args) { |
815 // Help os quite simple. | 815 // Help os quite simple. |
816 if (args && args.length > 0) { | 816 if (args && args.length > 0) { |
817 print('warning: arguments to \'help\' are ignored'); | 817 print('warning: arguments to \'help\' are ignored'); |
818 } | 818 } |
819 | 819 |
| 820 print('break'); |
820 print('break location [condition]'); | 821 print('break location [condition]'); |
821 print(' break on named function: location is a function name'); | 822 print(' break on named function: location is a function name'); |
822 print(' break on function: location is #<id>#'); | 823 print(' break on function: location is #<id>#'); |
823 print(' break on script position: location is name:line[:column]'); | 824 print(' break on script position: location is name:line[:column]'); |
824 print('clear <breakpoint #>'); | 825 print('clear <breakpoint #>'); |
825 print('backtrace [n] | [-n] | [from to]'); | 826 print('backtrace [n] | [-n] | [from to]'); |
826 print('frame <frame #>'); | 827 print('frame <frame #>'); |
827 print('scopes'); | 828 print('scopes'); |
828 print('scope <scope #>'); | 829 print('scope <scope #>'); |
829 print('step [in | next | out| min [step count]]'); | 830 print('step [in | next | out| min [step count]]'); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 details.text = response.message(); | 925 details.text = response.message(); |
925 return details; | 926 return details; |
926 } | 927 } |
927 | 928 |
928 // Get the running state. | 929 // Get the running state. |
929 details.running = response.running(); | 930 details.running = response.running(); |
930 | 931 |
931 var body = response.body(); | 932 var body = response.body(); |
932 var result = ''; | 933 var result = ''; |
933 switch (response.command()) { | 934 switch (response.command()) { |
| 935 case 'suspend': |
| 936 details.text = 'stopped'; |
| 937 break; |
| 938 |
934 case 'setbreakpoint': | 939 case 'setbreakpoint': |
935 result = 'set breakpoint #'; | 940 result = 'set breakpoint #'; |
936 result += body.breakpoint; | 941 result += body.breakpoint; |
937 details.text = result; | 942 details.text = result; |
938 break; | 943 break; |
939 | 944 |
940 case 'clearbreakpoint': | 945 case 'clearbreakpoint': |
941 result = 'cleared breakpoint #'; | 946 result = 'cleared breakpoint #'; |
942 result += body.breakpoint; | 947 result += body.breakpoint; |
943 details.text = result; | 948 details.text = result; |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 json += NumberToJSON_(elem); | 1621 json += NumberToJSON_(elem); |
1617 } else if (typeof(elem) === 'string') { | 1622 } else if (typeof(elem) === 'string') { |
1618 json += StringToJSON_(elem); | 1623 json += StringToJSON_(elem); |
1619 } else { | 1624 } else { |
1620 json += elem; | 1625 json += elem; |
1621 } | 1626 } |
1622 } | 1627 } |
1623 json += ']'; | 1628 json += ']'; |
1624 return json; | 1629 return json; |
1625 } | 1630 } |
OLD | NEW |