Debugger/DebuggerInterfacePython.py

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

eric ide

mercurial