Debugger/DebuggerInterfacePython3.py

changeset 481
ad71812ba395
parent 465
c20e25deb33a
child 482
4650a72c307a
equal deleted inserted replaced
480:793552e39173 481:ad71812ba395
751 # or stderr, but not line terminated and we stepped over the 751 # or stderr, but not line terminated and we stepped over the
752 # write call, in that case the >line< will not be the first 752 # write call, in that case the >line< will not be the first
753 # string read from the socket... 753 # string read from the socket...
754 boc = line.find('>') 754 boc = line.find('>')
755 if boc > 0 and eoc > boc: 755 if boc > 0 and eoc > boc:
756 self.debugServer.clientOutput(line[:boc]) 756 self.debugServer.signalClientOutput(line[:boc])
757 line = line[boc:] 757 line = line[boc:]
758 eoc = line.find('<') + 1 758 eoc = line.find('<') + 1
759 boc = line.find('>') 759 boc = line.find('>')
760 760
761 if boc >= 0 and eoc > boc: 761 if boc >= 0 and eoc > boc:
768 cf = stack[0] 768 cf = stack[0]
769 if self.__autoContinue: 769 if self.__autoContinue:
770 self.__autoContinue = False 770 self.__autoContinue = False
771 QTimer.singleShot(0, self.remoteContinue) 771 QTimer.singleShot(0, self.remoteContinue)
772 else: 772 else:
773 self.debugServer.clientLine(cf[0], int(cf[1]), 773 self.debugServer.signalClientLine(cf[0], int(cf[1]),
774 resp == ResponseStack) 774 resp == ResponseStack)
775 self.debugServer.clientStack(stack) 775 self.debugServer.signalClientStack(stack)
776 continue 776 continue
777 777
778 if resp == ResponseThreadList: 778 if resp == ResponseThreadList:
779 currentId, threadList = eval(line[eoc:-1]) 779 currentId, threadList = eval(line[eoc:-1])
780 self.debugServer.clientThreadList(currentId, threadList) 780 self.debugServer.signalClientThreadList(currentId, threadList)
781 continue 781 continue
782 782
783 if resp == ResponseThreadSet: 783 if resp == ResponseThreadSet:
784 self.debugServer.clientThreadSet() 784 self.debugServer.signalClientThreadSet()
785 continue 785 continue
786 786
787 if resp == ResponseVariables: 787 if resp == ResponseVariables:
788 vlist = eval(line[eoc:-1]) 788 vlist = eval(line[eoc:-1])
789 scope = vlist[0] 789 scope = vlist[0]
790 try: 790 try:
791 variables = vlist[1:] 791 variables = vlist[1:]
792 except IndexError: 792 except IndexError:
793 variables = [] 793 variables = []
794 self.debugServer.clientVariables(scope, variables) 794 self.debugServer.signalClientVariables(scope, variables)
795 continue 795 continue
796 796
797 if resp == ResponseVariable: 797 if resp == ResponseVariable:
798 vlist = eval(line[eoc:-1]) 798 vlist = eval(line[eoc:-1])
799 scope = vlist[0] 799 scope = vlist[0]
800 try: 800 try:
801 variables = vlist[1:] 801 variables = vlist[1:]
802 except IndexError: 802 except IndexError:
803 variables = [] 803 variables = []
804 self.debugServer.clientVariable(scope, variables) 804 self.debugServer.signalClientVariable(scope, variables)
805 continue 805 continue
806 806
807 if resp == ResponseOK: 807 if resp == ResponseOK:
808 self.debugServer.clientStatement(False) 808 self.debugServer.signalClientStatement(False)
809 continue 809 continue
810 810
811 if resp == ResponseContinue: 811 if resp == ResponseContinue:
812 self.debugServer.clientStatement(True) 812 self.debugServer.signalClientStatement(True)
813 continue 813 continue
814 814
815 if resp == ResponseException: 815 if resp == ResponseException:
816 exc = line[eoc:-1] 816 exc = line[eoc:-1]
817 exc = self.translate(exc, True) 817 exc = self.translate(exc, True)
822 stack = exclist[2:] 822 stack = exclist[2:]
823 except (IndexError, ValueError, SyntaxError): 823 except (IndexError, ValueError, SyntaxError):
824 exctype = None 824 exctype = None
825 excmessage = '' 825 excmessage = ''
826 stack = [] 826 stack = []
827 self.debugServer.clientException(exctype, excmessage, stack) 827 self.debugServer.signalClientException(exctype, excmessage, stack)
828 continue 828 continue
829 829
830 if resp == ResponseSyntax: 830 if resp == ResponseSyntax:
831 exc = line[eoc:-1] 831 exc = line[eoc:-1]
832 exc = self.translate(exc, True) 832 exc = self.translate(exc, True)
839 fn = '' 839 fn = ''
840 ln = 0 840 ln = 0
841 cn = 0 841 cn = 0
842 if cn is None: 842 if cn is None:
843 cn = 0 843 cn = 0
844 self.debugServer.clientSyntaxError(message, fn, ln, cn) 844 self.debugServer.signalClientSyntaxError(message, fn, ln, cn)
845 continue 845 continue
846 846
847 if resp == ResponseExit: 847 if resp == ResponseExit:
848 self.debugServer.clientExit(line[eoc:-1]) 848 self.debugServer.signalClientExit(line[eoc:-1])
849 continue 849 continue
850 850
851 if resp == ResponseClearBreak: 851 if resp == ResponseClearBreak:
852 fn, lineno = line[eoc:-1].split(',') 852 fn, lineno = line[eoc:-1].split(',')
853 lineno = int(lineno) 853 lineno = int(lineno)
854 fn = self.translate(fn, True) 854 fn = self.translate(fn, True)
855 self.debugServer.clientClearBreak(fn, lineno) 855 self.debugServer.signalClientClearBreak(fn, lineno)
856 continue 856 continue
857 857
858 if resp == ResponseBPConditionError: 858 if resp == ResponseBPConditionError:
859 fn, lineno = line[eoc:-1].split(',') 859 fn, lineno = line[eoc:-1].split(',')
860 lineno = int(lineno) 860 lineno = int(lineno)
861 fn = self.translate(fn, True) 861 fn = self.translate(fn, True)
862 self.debugServer.clientBreakConditionError(fn, lineno) 862 self.debugServer.signalClientBreakConditionError(fn, lineno)
863 continue 863 continue
864 864
865 if resp == ResponseClearWatch: 865 if resp == ResponseClearWatch:
866 cond = line[eoc:-1] 866 cond = line[eoc:-1]
867 self.debugServer.clientClearWatch(cond) 867 self.debugServer.signalClientClearWatch(cond)
868 continue 868 continue
869 869
870 if resp == ResponseWPConditionError: 870 if resp == ResponseWPConditionError:
871 cond = line[eoc:-1] 871 cond = line[eoc:-1]
872 self.debugServer.clientWatchConditionError(cond) 872 self.debugServer.signalClientWatchConditionError(cond)
873 continue 873 continue
874 874
875 if resp == ResponseRaw: 875 if resp == ResponseRaw:
876 prompt, echo = eval(line[eoc:-1]) 876 prompt, echo = eval(line[eoc:-1])
877 self.debugServer.clientRawInput(prompt, echo) 877 self.debugServer.signalClientRawInput(prompt, echo)
878 continue 878 continue
879 879
880 if resp == ResponseBanner: 880 if resp == ResponseBanner:
881 version, platform, dbgclient = eval(line[eoc:-1]) 881 version, platform, dbgclient = eval(line[eoc:-1])
882 self.debugServer.clientBanner(version, platform, dbgclient) 882 self.debugServer.signalClientBanner(version, platform, dbgclient)
883 continue 883 continue
884 884
885 if resp == ResponseCapabilities: 885 if resp == ResponseCapabilities:
886 cap, clType = eval(line[eoc:-1]) 886 cap, clType = eval(line[eoc:-1])
887 self.clientCapabilities = cap 887 self.clientCapabilities = cap
888 self.debugServer.clientCapabilities(cap, clType) 888 self.debugServer.signalClientCapabilities(cap, clType)
889 continue 889 continue
890 890
891 if resp == ResponseCompletion: 891 if resp == ResponseCompletion:
892 clstring, text = line[eoc:-1].split('||') 892 clstring, text = line[eoc:-1].split('||')
893 cl = eval(clstring) 893 cl = eval(clstring)
894 self.debugServer.clientCompletionList(cl, text) 894 self.debugServer.signalClientCompletionList(cl, text)
895 continue 895 continue
896 896
897 if resp == PassiveStartup: 897 if resp == PassiveStartup:
898 fn, exc = line[eoc:-1].split('|') 898 fn, exc = line[eoc:-1].split('|')
899 exc = bool(exc) 899 exc = bool(exc)
931 931
932 if resp == RequestForkTo: 932 if resp == RequestForkTo:
933 self.__askForkTo() 933 self.__askForkTo()
934 continue 934 continue
935 935
936 self.debugServer.clientOutput(line) 936 self.debugServer.signalClientOutput(line)
937 937
938 def __sendCommand(self, cmd): 938 def __sendCommand(self, cmd):
939 """ 939 """
940 Private method to send a single line command to the client. 940 Private method to send a single line command to the client.
941 941

eric ide

mercurial