595 ## DebugProtocol.RequestContinue, special)) |
596 ## DebugProtocol.RequestContinue, special)) |
596 self.__sendJsonCommand("RequestContinue", { |
597 self.__sendJsonCommand("RequestContinue", { |
597 "special": special, |
598 "special": special, |
598 }) |
599 }) |
599 |
600 |
600 def remoteBreakpoint(self, fn, line, set, cond=None, temp=False): |
601 def remoteBreakpoint(self, fn, line, setBreakpoint, cond=None, temp=False): |
601 """ |
602 """ |
602 Public method to set or clear a breakpoint. |
603 Public method to set or clear a breakpoint. |
603 |
604 |
604 @param fn filename the breakpoint belongs to (string) |
605 @param fn filename the breakpoint belongs to (string) |
605 @param line linenumber of the breakpoint (int) |
606 @param line linenumber of the breakpoint (int) |
606 @param set flag indicating setting or resetting a breakpoint (boolean) |
607 @param setBreakpoint flag indicating setting or resetting a |
|
608 breakpoint (boolean) |
607 @param cond condition of the breakpoint (string) |
609 @param cond condition of the breakpoint (string) |
608 @param temp flag indicating a temporary breakpoint (boolean) |
610 @param temp flag indicating a temporary breakpoint (boolean) |
609 """ |
611 """ |
610 fn = self.translate(fn, False) |
612 ## fn = self.translate(fn, False) |
611 self.__sendCommand('{0}{1}@@{2:d}@@{3:d}@@{4:d}@@{5}\n'.format( |
613 ## self.__sendCommand('{0}{1}@@{2:d}@@{3:d}@@{4:d}@@{5}\n'.format( |
612 DebugProtocol.RequestBreak, fn, line, temp, set, cond)) |
614 ## DebugProtocol.RequestBreak, fn, line, temp, set, cond)) |
|
615 self.__sendJsonCommand("RequestBreakpoint", { |
|
616 "filename": self.translate(fn, False), |
|
617 "line": line, |
|
618 "temporary": temp, |
|
619 "setBreakpoint": setBreakpoint, |
|
620 "condition": cond, |
|
621 }) |
613 |
622 |
614 def remoteBreakpointEnable(self, fn, line, enable): |
623 def remoteBreakpointEnable(self, fn, line, enable): |
615 """ |
624 """ |
616 Public method to enable or disable a breakpoint. |
625 Public method to enable or disable a breakpoint. |
617 |
626 |
618 @param fn filename the breakpoint belongs to (string) |
627 @param fn filename the breakpoint belongs to (string) |
619 @param line linenumber of the breakpoint (int) |
628 @param line linenumber of the breakpoint (int) |
620 @param enable flag indicating enabling or disabling a breakpoint |
629 @param enable flag indicating enabling or disabling a breakpoint |
621 (boolean) |
630 (boolean) |
622 """ |
631 """ |
623 fn = self.translate(fn, False) |
632 ## fn = self.translate(fn, False) |
624 self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format( |
633 ## self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format( |
625 DebugProtocol.RequestBreakEnable, fn, line, enable)) |
634 ## DebugProtocol.RequestBreakEnable, fn, line, enable)) |
|
635 self.__sendJsonCommand("RequestBreakpointEnable", { |
|
636 "filename": self.translate(fn, False), |
|
637 "line": line, |
|
638 "enable": enable, |
|
639 }) |
626 |
640 |
627 def remoteBreakpointIgnore(self, fn, line, count): |
641 def remoteBreakpointIgnore(self, fn, line, count): |
628 """ |
642 """ |
629 Public method to ignore a breakpoint the next couple of occurrences. |
643 Public method to ignore a breakpoint the next couple of occurrences. |
630 |
644 |
631 @param fn filename the breakpoint belongs to (string) |
645 @param fn filename the breakpoint belongs to (string) |
632 @param line linenumber of the breakpoint (int) |
646 @param line linenumber of the breakpoint (int) |
633 @param count number of occurrences to ignore (int) |
647 @param count number of occurrences to ignore (int) |
634 """ |
648 """ |
635 fn = self.translate(fn, False) |
649 ## fn = self.translate(fn, False) |
636 self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format( |
650 ## self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format( |
637 DebugProtocol.RequestBreakIgnore, fn, line, count)) |
651 ## DebugProtocol.RequestBreakIgnore, fn, line, count)) |
638 |
652 self.__sendJsonCommand("RequestBreakpointIgnore", { |
639 def remoteWatchpoint(self, cond, set, temp=False): |
653 "filename": self.translate(fn, False), |
|
654 "line": line, |
|
655 "count": count, |
|
656 }) |
|
657 |
|
658 def remoteWatchpoint(self, cond, setWatch, temp=False): |
640 """ |
659 """ |
641 Public method to set or clear a watch expression. |
660 Public method to set or clear a watch expression. |
642 |
661 |
643 @param cond expression of the watch expression (string) |
662 @param cond expression of the watch expression (string) |
644 @param set flag indicating setting or resetting a watch expression |
663 @param setWatch flag indicating setting or resetting a watch expression |
645 (boolean) |
664 (boolean) |
646 @param temp flag indicating a temporary watch expression (boolean) |
665 @param temp flag indicating a temporary watch expression (boolean) |
647 """ |
666 """ |
648 # cond is combination of cond and special (s. watch expression viewer) |
667 # cond is combination of cond and special (s. watch expression viewer) |
649 self.__sendCommand('{0}{1}@@{2:d}@@{3:d}\n'.format( |
668 ## self.__sendCommand('{0}{1}@@{2:d}@@{3:d}\n'.format( |
650 DebugProtocol.RequestWatch, cond, temp, set)) |
669 ## DebugProtocol.RequestWatch, cond, temp, set)) |
|
670 self.__sendJsonCommand("RequestWatch", { |
|
671 "temporary": temp, |
|
672 "setWatch": setWatch, |
|
673 "condition": cond, |
|
674 }) |
651 |
675 |
652 def remoteWatchpointEnable(self, cond, enable): |
676 def remoteWatchpointEnable(self, cond, enable): |
653 """ |
677 """ |
654 Public method to enable or disable a watch expression. |
678 Public method to enable or disable a watch expression. |
655 |
679 |
656 @param cond expression of the watch expression (string) |
680 @param cond expression of the watch expression (string) |
657 @param enable flag indicating enabling or disabling a watch expression |
681 @param enable flag indicating enabling or disabling a watch expression |
658 (boolean) |
682 (boolean) |
659 """ |
683 """ |
660 # cond is combination of cond and special (s. watch expression viewer) |
684 # cond is combination of cond and special (s. watch expression viewer) |
661 self.__sendCommand('{0}{1},{2:d}\n'.format( |
685 ## self.__sendCommand('{0}{1},{2:d}\n'.format( |
662 DebugProtocol.RequestWatchEnable, cond, enable)) |
686 ## DebugProtocol.RequestWatchEnable, cond, enable)) |
|
687 self.__sendJsonCommand("RequestWatchEnable", { |
|
688 "condition": cond, |
|
689 "enable": enable, |
|
690 }) |
663 |
691 |
664 def remoteWatchpointIgnore(self, cond, count): |
692 def remoteWatchpointIgnore(self, cond, count): |
665 """ |
693 """ |
666 Public method to ignore a watch expression the next couple of |
694 Public method to ignore a watch expression the next couple of |
667 occurrences. |
695 occurrences. |
668 |
696 |
669 @param cond expression of the watch expression (string) |
697 @param cond expression of the watch expression (string) |
670 @param count number of occurrences to ignore (int) |
698 @param count number of occurrences to ignore (int) |
671 """ |
699 """ |
672 # cond is combination of cond and special (s. watch expression viewer) |
700 # cond is combination of cond and special (s. watch expression viewer) |
673 self.__sendCommand('{0}{1},{2:d}\n'.format( |
701 ## self.__sendCommand('{0}{1},{2:d}\n'.format( |
674 DebugProtocol.RequestWatchIgnore, cond, count)) |
702 ## DebugProtocol.RequestWatchIgnore, cond, count)) |
|
703 self.__sendJsonCommand("RequestWatchIgnore", { |
|
704 "condition": cond, |
|
705 "count": count, |
|
706 }) |
675 |
707 |
676 def remoteRawInput(self, s): |
708 def remoteRawInput(self, s): |
677 """ |
709 """ |
678 Public method to send the raw input to the debugged program. |
710 Public method to send the raw input to the debugged program. |
679 |
711 |
686 |
718 |
687 def remoteThreadList(self): |
719 def remoteThreadList(self): |
688 """ |
720 """ |
689 Public method to request the list of threads from the client. |
721 Public method to request the list of threads from the client. |
690 """ |
722 """ |
691 self.__sendCommand('{0}\n'.format(DebugProtocol.RequestThreadList)) |
723 ## self.__sendCommand('{0}\n'.format(DebugProtocol.RequestThreadList)) |
|
724 self.__sendJsonCommand("RequestThreadList", {}) |
692 |
725 |
693 def remoteSetThread(self, tid): |
726 def remoteSetThread(self, tid): |
694 """ |
727 """ |
695 Public method to request to set the given thread as current thread. |
728 Public method to request to set the given thread as current thread. |
696 |
729 |
697 @param tid id of the thread (integer) |
730 @param tid id of the thread (integer) |
698 """ |
731 """ |
699 self.__sendCommand('{0}{1:d}\n'.format( |
732 ## self.__sendCommand('{0}{1:d}\n'.format( |
700 DebugProtocol.RequestThreadSet, tid)) |
733 ## DebugProtocol.RequestThreadSet, tid)) |
|
734 self.__sendJsonCommand("RequestThreadSet", { |
|
735 "threadID": tid, |
|
736 }) |
701 |
737 |
702 def remoteClientVariables(self, scope, filter, framenr=0): |
738 def remoteClientVariables(self, scope, filter, framenr=0): |
703 """ |
739 """ |
704 Public method to request the variables of the debugged program. |
740 Public method to request the variables of the debugged program. |
705 |
741 |
706 @param scope the scope of the variables (0 = local, 1 = global) |
742 @param scope the scope of the variables (0 = local, 1 = global) |
707 @param filter list of variable types to filter out (list of int) |
743 @param filter list of variable types to filter out (list of int) |
708 @param framenr framenumber of the variables to retrieve (int) |
744 @param framenr framenumber of the variables to retrieve (int) |
709 """ |
745 """ |
710 self.__sendCommand('{0}{1:d}, {2:d}, {3}\n'.format( |
746 ## self.__sendCommand('{0}{1:d}, {2:d}, {3}\n'.format( |
711 DebugProtocol.RequestVariables, framenr, scope, str(filter))) |
747 ## DebugProtocol.RequestVariables, framenr, scope, str(filter))) |
|
748 self.__sendJsonCommand("RequestVariables", { |
|
749 "frameNumber": framenr, |
|
750 "scope": scope, |
|
751 "filters": filter, |
|
752 }) |
712 |
753 |
713 def remoteClientVariable(self, scope, filter, var, framenr=0): |
754 def remoteClientVariable(self, scope, filter, var, framenr=0): |
714 """ |
755 """ |
715 Public method to request the variables of the debugged program. |
756 Public method to request the variables of the debugged program. |
716 |
757 |
717 @param scope the scope of the variables (0 = local, 1 = global) |
758 @param scope the scope of the variables (0 = local, 1 = global) |
718 @param filter list of variable types to filter out (list of int) |
759 @param filter list of variable types to filter out (list of int) |
719 @param var list encoded name of variable to retrieve (string) |
760 @param var list encoded name of variable to retrieve (string) |
720 @param framenr framenumber of the variables to retrieve (int) |
761 @param framenr framenumber of the variables to retrieve (int) |
721 """ |
762 """ |
722 self.__sendCommand('{0}{1}, {2:d}, {3:d}, {4}\n'.format( |
763 ## self.__sendCommand('{0}{1}, {2:d}, {3:d}, {4}\n'.format( |
723 DebugProtocol.RequestVariable, str(var), framenr, scope, |
764 ## DebugProtocol.RequestVariable, str(var), framenr, scope, |
724 str(filter))) |
765 ## str(filter))) |
|
766 self.__sendJsonCommand("RequestVariable", { |
|
767 "variable": var, |
|
768 "frameNumber": framenr, |
|
769 "scope": scope, |
|
770 "filters": filter, |
|
771 }) |
725 |
772 |
726 def remoteClientSetFilter(self, scope, filter): |
773 def remoteClientSetFilter(self, scope, filter): |
727 """ |
774 """ |
728 Public method to set a variables filter list. |
775 Public method to set a variables filter list. |
729 |
776 |
730 @param scope the scope of the variables (0 = local, 1 = global) |
777 @param scope the scope of the variables (0 = local, 1 = global) |
731 @param filter regexp string for variable names to filter out (string) |
778 @param filter regexp string for variable names to filter out (string) |
732 """ |
779 """ |
733 self.__sendCommand('{0}{1:d}, "{2}"\n'.format( |
780 ## self.__sendCommand('{0}{1:d}, "{2}"\n'.format( |
734 DebugProtocol.RequestSetFilter, scope, filter)) |
781 ## DebugProtocol.RequestSetFilter, scope, filter)) |
|
782 self.__sendJsonCommand("RequestSetFilter", { |
|
783 "scope": scope, |
|
784 "filter": filter, |
|
785 }) |
735 |
786 |
736 def setCallTraceEnabled(self, on): |
787 def setCallTraceEnabled(self, on): |
737 """ |
788 """ |
738 Public method to set the call trace state. |
789 Public method to set the call trace state. |
739 |
790 |
740 @param on flag indicating to enable the call trace function (boolean) |
791 @param on flag indicating to enable the call trace function (boolean) |
741 """ |
792 """ |
742 if on: |
793 ## if on: |
743 cmd = "on" |
794 ## cmd = "on" |
744 else: |
795 ## else: |
745 cmd = "off" |
796 ## cmd = "off" |
746 self.__sendCommand('{0}{1}\n'.format( |
797 ## self.__sendCommand('{0}{1}\n'.format( |
747 DebugProtocol.RequestCallTrace, cmd)) |
798 ## DebugProtocol.RequestCallTrace, cmd)) |
748 |
799 self.__sendJsonCommand("RequestCallTrace", { |
749 def remoteEval(self, arg): |
800 "enable": on, |
750 """ |
801 }) |
751 Public method to evaluate arg in the current context of the debugged |
802 |
752 program. |
803 ## def remoteEval(self, arg): |
753 |
804 ## """ |
754 @param arg the arguments to evaluate (string) |
805 ## Public method to evaluate arg in the current context of the debugged |
755 """ |
806 ## program. |
756 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestEval, arg)) |
807 ## |
757 |
808 ## @param arg the arguments to evaluate (string) |
758 def remoteExec(self, stmt): |
809 ## """ |
759 """ |
810 #### self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestEval, arg)) |
760 Public method to execute stmt in the current context of the debugged |
811 ## self.__sendJsonCommand("RequestEval", { |
761 program. |
812 ## "argument": arg, |
762 |
813 ## }) |
763 @param stmt statement to execute (string) |
814 ## |
764 """ |
815 ## def remoteExec(self, stmt): |
765 self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestExec, stmt)) |
816 ## """ |
766 |
817 ## Public method to execute stmt in the current context of the debugged |
|
818 ## program. |
|
819 ## |
|
820 ## @param stmt statement to execute (string) |
|
821 ## """ |
|
822 ## self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestExec, stmt)) |
|
823 ## |
767 def remoteBanner(self): |
824 def remoteBanner(self): |
768 """ |
825 """ |
769 Public slot to get the banner info of the remote client. |
826 Public slot to get the banner info of the remote client. |
770 """ |
827 """ |
771 ## self.__sendCommand(DebugProtocol.RequestBanner + '\n') |
828 ## self.__sendCommand(DebugProtocol.RequestBanner + '\n') |
875 boc = line.find('>') |
935 boc = line.find('>') |
876 |
936 |
877 if boc >= 0 and eoc > boc: |
937 if boc >= 0 and eoc > boc: |
878 resp = line[boc:eoc] |
938 resp = line[boc:eoc] |
879 |
939 |
880 if resp == DebugProtocol.ResponseLine or \ |
940 ## if resp == DebugProtocol.ResponseLine or \ |
881 resp == DebugProtocol.ResponseStack: |
941 ## resp == DebugProtocol.ResponseStack: |
882 stack = eval(line[eoc:-1]) |
942 ## stack = eval(line[eoc:-1]) |
883 for s in stack: |
943 ## for s in stack: |
884 s[0] = self.translate(s[0], True) |
944 ## s[0] = self.translate(s[0], True) |
885 cf = stack[0] |
945 ## cf = stack[0] |
886 if self.__autoContinue: |
946 ## if self.__autoContinue: |
887 self.__autoContinue = False |
947 ## self.__autoContinue = False |
888 QTimer.singleShot(0, self.remoteContinue) |
948 ## QTimer.singleShot(0, self.remoteContinue) |
889 else: |
949 ## else: |
890 self.debugServer.signalClientLine( |
950 ## self.debugServer.signalClientLine( |
891 cf[0], int(cf[1]), |
951 ## cf[0], int(cf[1]), |
892 resp == DebugProtocol.ResponseStack) |
952 ## resp == DebugProtocol.ResponseStack) |
893 self.debugServer.signalClientStack(stack) |
953 ## self.debugServer.signalClientStack(stack) |
894 continue |
954 ## continue |
895 |
955 ## |
896 if resp == DebugProtocol.CallTrace: |
956 ## if resp == DebugProtocol.CallTrace: |
897 event, fromStr, toStr = line[eoc:-1].split("@@") |
957 ## event, fromStr, toStr = line[eoc:-1].split("@@") |
898 isCall = event.lower() == "c" |
958 ## isCall = event.lower() == "c" |
899 fromFile, fromLineno, fromFunc = fromStr.rsplit(":", 2) |
959 ## fromFile, fromLineno, fromFunc = fromStr.rsplit(":", 2) |
900 toFile, toLineno, toFunc = toStr.rsplit(":", 2) |
960 ## toFile, toLineno, toFunc = toStr.rsplit(":", 2) |
901 self.debugServer.signalClientCallTrace( |
961 ## self.debugServer.signalClientCallTrace( |
902 isCall, |
962 ## isCall, |
903 fromFile, fromLineno, fromFunc, |
963 ## fromFile, fromLineno, fromFunc, |
904 toFile, toLineno, toFunc) |
964 ## toFile, toLineno, toFunc) |
905 continue |
965 ## continue |
906 |
966 ## |
907 if resp == DebugProtocol.ResponseThreadList: |
967 ## if resp == DebugProtocol.ResponseThreadList: |
908 currentId, threadList = eval(line[eoc:-1]) |
968 ## currentId, threadList = eval(line[eoc:-1]) |
909 self.debugServer.signalClientThreadList( |
969 ## self.debugServer.signalClientThreadList( |
910 currentId, threadList) |
970 ## currentId, threadList) |
911 continue |
971 ## continue |
912 |
972 ## |
913 if resp == DebugProtocol.ResponseThreadSet: |
973 ## if resp == DebugProtocol.ResponseThreadSet: |
914 self.debugServer.signalClientThreadSet() |
974 ## self.debugServer.signalClientThreadSet() |
915 continue |
975 ## continue |
916 |
976 ## |
917 if resp == DebugProtocol.ResponseVariables: |
977 ## if resp == DebugProtocol.ResponseVariables: |
918 vlist = eval(line[eoc:-1]) |
978 ## vlist = eval(line[eoc:-1]) |
919 scope = vlist[0] |
979 ## scope = vlist[0] |
920 try: |
980 ## try: |
921 variables = vlist[1:] |
981 ## variables = vlist[1:] |
922 except IndexError: |
982 ## except IndexError: |
923 variables = [] |
983 ## variables = [] |
924 self.debugServer.signalClientVariables(scope, variables) |
984 ## self.debugServer.signalClientVariables(scope, variables) |
925 continue |
985 ## continue |
926 |
986 ## |
927 if resp == DebugProtocol.ResponseVariable: |
987 ## if resp == DebugProtocol.ResponseVariable: |
928 vlist = eval(line[eoc:-1]) |
988 ## vlist = eval(line[eoc:-1]) |
929 scope = vlist[0] |
989 ## scope = vlist[0] |
930 try: |
990 ## try: |
931 variables = vlist[1:] |
991 ## variables = vlist[1:] |
932 except IndexError: |
992 ## except IndexError: |
933 variables = [] |
993 ## variables = [] |
934 self.debugServer.signalClientVariable(scope, variables) |
994 ## self.debugServer.signalClientVariable(scope, variables) |
935 continue |
995 ## continue |
936 |
996 ## |
937 ## if resp == DebugProtocol.ResponseOK: |
997 ## if resp == DebugProtocol.ResponseOK: |
938 ## self.debugServer.signalClientStatement(False) |
998 ## self.debugServer.signalClientStatement(False) |
939 ## continue |
999 ## continue |
940 ## |
1000 ## |
941 ## if resp == DebugProtocol.ResponseContinue: |
1001 ## if resp == DebugProtocol.ResponseContinue: |
942 ## self.debugServer.signalClientStatement(True) |
1002 ## self.debugServer.signalClientStatement(True) |
943 ## continue |
1003 ## continue |
944 ## |
1004 ## |
945 if resp == DebugProtocol.ResponseException: |
1005 ## if resp == DebugProtocol.ResponseException: |
946 exc = line[eoc:-1] |
1006 ## exc = line[eoc:-1] |
947 exc = self.translate(exc, True) |
1007 ## exc = self.translate(exc, True) |
948 try: |
1008 ## try: |
949 exclist = eval(exc) |
1009 ## exclist = eval(exc) |
950 exctype = exclist[0] |
1010 ## exctype = exclist[0] |
951 excmessage = exclist[1] |
1011 ## excmessage = exclist[1] |
952 stack = exclist[2:] |
1012 ## stack = exclist[2:] |
953 if stack and stack[0] and stack[0][0] == "<string>": |
1013 ## if stack and stack[0] and stack[0][0] == "<string>": |
954 for stackEntry in stack: |
1014 ## for stackEntry in stack: |
955 if stackEntry[0] == "<string>": |
1015 ## if stackEntry[0] == "<string>": |
956 stackEntry[0] = self.__scriptName |
1016 ## stackEntry[0] = self.__scriptName |
957 else: |
1017 ## else: |
958 break |
1018 ## break |
959 except (IndexError, ValueError, SyntaxError): |
1019 ## except (IndexError, ValueError, SyntaxError): |
960 exctype = None |
1020 ## exctype = None |
961 excmessage = '' |
1021 ## excmessage = '' |
962 stack = [] |
1022 ## stack = [] |
963 self.debugServer.signalClientException( |
1023 ## self.debugServer.signalClientException( |
964 exctype, excmessage, stack) |
1024 ## exctype, excmessage, stack) |
965 continue |
1025 ## continue |
966 |
1026 ## |
967 if resp == DebugProtocol.ResponseSyntax: |
1027 ## if resp == DebugProtocol.ResponseSyntax: |
968 exc = line[eoc:-1] |
1028 ## exc = line[eoc:-1] |
969 exc = self.translate(exc, True) |
1029 ## exc = self.translate(exc, True) |
970 try: |
1030 ## try: |
971 message, (fn, ln, cn) = eval(exc) |
1031 ## message, (fn, ln, cn) = eval(exc) |
972 if fn is None: |
1032 ## if fn is None: |
973 fn = '' |
1033 ## fn = '' |
974 except (IndexError, ValueError): |
1034 ## except (IndexError, ValueError): |
975 message = None |
1035 ## message = None |
976 fn = '' |
1036 ## fn = '' |
977 ln = 0 |
1037 ## ln = 0 |
978 cn = 0 |
1038 ## cn = 0 |
979 if cn is None: |
1039 ## if cn is None: |
980 cn = 0 |
1040 ## cn = 0 |
981 self.debugServer.signalClientSyntaxError( |
1041 ## self.debugServer.signalClientSyntaxError( |
982 message, fn, ln, cn) |
1042 ## message, fn, ln, cn) |
983 continue |
1043 ## continue |
984 |
1044 ## |
985 if resp == DebugProtocol.ResponseSignal: |
1045 ## if resp == DebugProtocol.ResponseSignal: |
986 sig = line[eoc:-1] |
1046 ## sig = line[eoc:-1] |
987 sig = self.translate(sig, True) |
1047 ## sig = self.translate(sig, True) |
988 message, (fn, ln, func, args) = eval(sig) |
1048 ## message, (fn, ln, func, args) = eval(sig) |
989 self.debugServer.signalClientSignal( |
1049 ## self.debugServer.signalClientSignal( |
990 message, fn, ln, func, args) |
1050 ## message, fn, ln, func, args) |
991 continue |
1051 ## continue |
992 |
1052 ## |
993 if resp == DebugProtocol.ResponseExit: |
1053 ## if resp == DebugProtocol.ResponseExit: |
994 self.__scriptName = "" |
1054 ## self.__scriptName = "" |
995 self.debugServer.signalClientExit(line[eoc:-1]) |
1055 ## self.debugServer.signalClientExit(line[eoc:-1]) |
996 continue |
1056 ## continue |
997 |
1057 ## |
998 if resp == DebugProtocol.ResponseClearBreak: |
1058 ## if resp == DebugProtocol.ResponseClearBreak: |
999 fn, lineno = line[eoc:-1].split(',') |
1059 ## fn, lineno = line[eoc:-1].split(',') |
1000 lineno = int(lineno) |
1060 ## lineno = int(lineno) |
1001 fn = self.translate(fn, True) |
1061 ## fn = self.translate(fn, True) |
1002 self.debugServer.signalClientClearBreak(fn, lineno) |
1062 ## self.debugServer.signalClientClearBreak(fn, lineno) |
1003 continue |
1063 ## continue |
1004 |
1064 ## |
1005 if resp == DebugProtocol.ResponseBPConditionError: |
1065 ## if resp == DebugProtocol.ResponseBPConditionError: |
1006 fn, lineno = line[eoc:-1].split(',') |
1066 ## fn, lineno = line[eoc:-1].split(',') |
1007 lineno = int(lineno) |
1067 ## lineno = int(lineno) |
1008 fn = self.translate(fn, True) |
1068 ## fn = self.translate(fn, True) |
1009 self.debugServer.signalClientBreakConditionError( |
1069 ## self.debugServer.signalClientBreakConditionError( |
1010 fn, lineno) |
1070 ## fn, lineno) |
1011 continue |
1071 ## continue |
1012 |
1072 ## |
1013 if resp == DebugProtocol.ResponseClearWatch: |
1073 ## if resp == DebugProtocol.ResponseClearWatch: |
1014 cond = line[eoc:-1] |
1074 ## cond = line[eoc:-1] |
1015 self.debugServer.signalClientClearWatch(cond) |
1075 ## self.debugServer.signalClientClearWatch(cond) |
1016 continue |
1076 ## continue |
1017 |
1077 ## |
1018 if resp == DebugProtocol.ResponseWPConditionError: |
1078 ## if resp == DebugProtocol.ResponseWPConditionError: |
1019 cond = line[eoc:-1] |
1079 ## cond = line[eoc:-1] |
1020 self.debugServer.signalClientWatchConditionError(cond) |
1080 ## self.debugServer.signalClientWatchConditionError(cond) |
1021 continue |
1081 ## continue |
1022 |
1082 ## |
1023 ## if resp == DebugProtocol.ResponseRaw: |
1083 ## if resp == DebugProtocol.ResponseRaw: |
1024 ## prompt, echo = eval(line[eoc:-1]) |
1084 ## prompt, echo = eval(line[eoc:-1]) |
1025 ## self.debugServer.signalClientRawInput(prompt, echo) |
1085 ## self.debugServer.signalClientRawInput(prompt, echo) |
1026 ## continue |
1086 ## continue |
1027 ## |
1087 ## |
1110 import json |
1170 import json |
1111 |
1171 |
1112 try: |
1172 try: |
1113 commandDict = json.loads(jsonStr.strip()) |
1173 commandDict = json.loads(jsonStr.strip()) |
1114 except json.JSONDecodeError as err: |
1174 except json.JSONDecodeError as err: |
|
1175 # TODO: implement real error handling |
1115 print(str(err)) |
1176 print(str(err)) |
1116 return |
1177 return |
1117 |
1178 |
1118 method = commandDict["method"] |
1179 method = commandDict["method"] |
1119 params = commandDict["params"] |
1180 params = commandDict["params"] |
|
1181 |
|
1182 if method in ["ResponseLine", "ResponseStack"]: |
|
1183 for s in params["stack"]: |
|
1184 s[0] = self.translate(s[0], True) |
|
1185 cf = params["stack"][0] |
|
1186 if self.__autoContinue: |
|
1187 self.__autoContinue = False |
|
1188 QTimer.singleShot(0, self.remoteContinue) |
|
1189 else: |
|
1190 self.debugServer.signalClientLine( |
|
1191 cf[0], int(cf[1]), |
|
1192 method == "ResponseStack") |
|
1193 self.debugServer.signalClientStack(params["stack"]) |
|
1194 return |
|
1195 |
|
1196 if method == "CallTrace": |
|
1197 isCall = params["event"].lower() == "c" |
|
1198 fromFile, fromLineno, fromFunc = params["from"].rsplit(":", 2) |
|
1199 toFile, toLineno, toFunc = params["to"].rsplit(":", 2) |
|
1200 self.debugServer.signalClientCallTrace( |
|
1201 isCall, |
|
1202 fromFile, fromLineno, fromFunc, |
|
1203 toFile, toLineno, toFunc) |
|
1204 return |
|
1205 |
|
1206 if method == "ResponseVariables": |
|
1207 self.debugServer.signalClientVariables( |
|
1208 params["scope"], params["variables"]) |
|
1209 return |
|
1210 |
|
1211 if method == "ResponseVariable": |
|
1212 self.debugServer.signalClientVariable( |
|
1213 params["scope"], [params["variable"]] + params["variables"]) |
|
1214 return |
|
1215 |
|
1216 if method == "ResponseThreadList": |
|
1217 self.debugServer.signalClientThreadList( |
|
1218 params["currentID"], params["threadList"]) |
|
1219 return |
|
1220 |
|
1221 if method == "ResponseThreadSet": |
|
1222 self.debugServer.signalClientThreadSet() |
|
1223 return |
1120 |
1224 |
1121 if method == "ResponseCapabilities": |
1225 if method == "ResponseCapabilities": |
1122 self.clientCapabilities = params["capabilities"] |
1226 self.clientCapabilities = params["capabilities"] |
1123 self.debugServer.signalClientCapabilities( |
1227 self.debugServer.signalClientCapabilities( |
1124 params["capabilities"], params["clientType"]) |
1228 params["capabilities"], params["clientType"]) |
1140 return |
1244 return |
1141 |
1245 |
1142 if method == "RequestRaw": |
1246 if method == "RequestRaw": |
1143 self.debugServer.signalClientRawInput( |
1247 self.debugServer.signalClientRawInput( |
1144 params["prompt"], params["echo"]) |
1248 params["prompt"], params["echo"]) |
|
1249 return |
|
1250 |
|
1251 if method == "ResponseBPConditionError": |
|
1252 params["filename"] = self.translate(params["filename"], True) |
|
1253 self.debugServer.signalClientBreakConditionError( |
|
1254 params["filename"], params["line"]) |
|
1255 return |
|
1256 |
|
1257 if method == "ResponseClearBreakpoint": |
|
1258 params["filename"] = self.translate(params["filename"], True) |
|
1259 self.debugServer.signalClientClearBreak( |
|
1260 params["filename"], params["line"]) |
|
1261 return |
|
1262 |
|
1263 if method == "ResponseWatchConditionError": |
|
1264 self.debugServer.signalClientWatchConditionError( |
|
1265 params["condition"]) |
|
1266 return |
|
1267 |
|
1268 if method == "ResponseClearWatch": |
|
1269 self.debugServer.signalClientClearWatch(params["condition"]) |
|
1270 return |
|
1271 |
|
1272 if method == "ResponseException": |
|
1273 if params: |
|
1274 exctype = params["type"] |
|
1275 excmessage = params["message"] |
|
1276 stack = params["stack"] |
|
1277 if stack: |
|
1278 for stackEntry in stack: |
|
1279 stackEntry[0] = self.translate(stackEntry[0], True) |
|
1280 if stack[0] and stack[0][0] == "<string>": |
|
1281 for stackEntry in stack: |
|
1282 if stackEntry[0] == "<string>": |
|
1283 stackEntry[0] = self.__scriptName |
|
1284 else: |
|
1285 break |
|
1286 else: |
|
1287 exctype = None |
|
1288 excmessage = '' |
|
1289 stack = [] |
|
1290 |
|
1291 self.debugServer.signalClientException( |
|
1292 exctype, excmessage, stack) |
|
1293 return |
|
1294 |
|
1295 if method == "ResponseSyntax": |
|
1296 self.debugServer.signalClientSyntaxError( |
|
1297 params["message"], self.translate(params["filename"], True), |
|
1298 params["linenumber"], params["characternumber"]) |
|
1299 return |
|
1300 |
|
1301 if method == "ResponseSignal": |
|
1302 self.debugServer.signalClientSignal( |
|
1303 params["message"], self.translate(params["filename"], True), |
|
1304 params["linenumber"], params["function"], params["arguments"]) |
|
1305 return |
|
1306 |
|
1307 if method == "ResponseExit": |
|
1308 self.__scriptName = "" |
|
1309 self.debugServer.signalClientExit(params["status"]) |
|
1310 return |
|
1311 |
|
1312 if method == "PassiveStartup": |
|
1313 self.debugServer.passiveStartUp( |
|
1314 self.translate(params["filename"], True), params["exceptions"]) |
|
1315 return |
|
1316 |
|
1317 if method == "ResponseCompletion": |
|
1318 ## clstring, text = line[eoc:-1].split('||') |
|
1319 ## cl = eval(clstring) |
|
1320 self.debugServer.signalClientCompletionList( |
|
1321 params["completions"], params["text"]) |
1145 return |
1322 return |
1146 |
1323 |
1147 def __sendCommand(self, cmd): |
1324 def __sendCommand(self, cmd): |
1148 """ |
1325 """ |
1149 Private method to send a single line command to the client. |
1326 Private method to send a single line command to the client. |