Debugger/DebuggerInterfaceRuby.py

changeset 12
1d8dd9706f46
parent 0
de9c2efb9d02
child 13
1af94a91f439
equal deleted inserted replaced
11:b0996e4a289e 12:1d8dd9706f46
15 from PyQt4.QtCore import * 15 from PyQt4.QtCore import *
16 from PyQt4.QtGui import QMessageBox 16 from PyQt4.QtGui import QMessageBox
17 17
18 from E4Gui.E4Application import e4App 18 from E4Gui.E4Application import e4App
19 19
20 from DebugProtocol import * 20 from .DebugProtocol import *
21 import DebugClientCapabilities 21 from . import DebugClientCapabilities
22 22
23 import Preferences 23 import Preferences
24 import Utilities 24 import Utilities
25 25
26 from eric4config import getConfig 26 from eric4config import getConfig
116 @return the process object (QProcess) or None 116 @return the process object (QProcess) or None
117 """ 117 """
118 proc = QProcess() 118 proc = QProcess()
119 if environment is not None: 119 if environment is not None:
120 env = [] 120 env = []
121 for key, value in environment.items(): 121 for key, value in list(environment.items()):
122 env.append("%s=%s" % (key, value)) 122 env.append("%s=%s" % (key, value))
123 proc.setEnvironment(env) 123 proc.setEnvironment(env)
124 args = [] 124 args = []
125 for arg in arguments: 125 for arg in arguments:
126 args.append(arg) 126 args.append(arg)
411 self.__autoContinue = autoContinue 411 self.__autoContinue = autoContinue
412 412
413 wd = self.translate(wd, False) 413 wd = self.translate(wd, False)
414 fn = self.translate(os.path.abspath(fn), False) 414 fn = self.translate(os.path.abspath(fn), False)
415 self.__sendCommand('%s%s|%s|%s|%d\n' % \ 415 self.__sendCommand('%s%s|%s|%s|%d\n' % \
416 (RequestLoad, wd, fn, unicode(Utilities.parseOptionString(argv)), 416 (RequestLoad, wd, fn, str(Utilities.parseOptionString(argv)),
417 traceInterpreter)) 417 traceInterpreter))
418 418
419 def remoteRun(self, fn, argv, wd): 419 def remoteRun(self, fn, argv, wd):
420 """ 420 """
421 Public method to load a new program to run. 421 Public method to load a new program to run.
425 @param wd the working directory for the program (string) 425 @param wd the working directory for the program (string)
426 """ 426 """
427 wd = self.translate(wd, False) 427 wd = self.translate(wd, False)
428 fn = self.translate(os.path.abspath(fn), False) 428 fn = self.translate(os.path.abspath(fn), False)
429 self.__sendCommand('%s%s|%s|%s\n' % \ 429 self.__sendCommand('%s%s|%s|%s\n' % \
430 (RequestRun, wd, fn, unicode(Utilities.parseOptionString(argv)))) 430 (RequestRun, wd, fn, str(Utilities.parseOptionString(argv))))
431 431
432 def remoteCoverage(self, fn, argv, wd, erase = False): 432 def remoteCoverage(self, fn, argv, wd, erase = False):
433 """ 433 """
434 Public method to load a new program to collect coverage data. 434 Public method to load a new program to collect coverage data.
435 435
590 @param scope the scope of the variables (0 = local, 1 = global) 590 @param scope the scope of the variables (0 = local, 1 = global)
591 @param filter list of variable types to filter out (list of int) 591 @param filter list of variable types to filter out (list of int)
592 @param framenr framenumber of the variables to retrieve (int) 592 @param framenr framenumber of the variables to retrieve (int)
593 """ 593 """
594 self.__sendCommand('%s%d, %d, %s\n' % \ 594 self.__sendCommand('%s%d, %d, %s\n' % \
595 (RequestVariables, framenr, scope, unicode(filter))) 595 (RequestVariables, framenr, scope, str(filter)))
596 596
597 def remoteClientVariable(self, scope, filter, var, framenr = 0): 597 def remoteClientVariable(self, scope, filter, var, framenr = 0):
598 """ 598 """
599 Public method to request the variables of the debugged program. 599 Public method to request the variables of the debugged program.
600 600
602 @param filter list of variable types to filter out (list of int) 602 @param filter list of variable types to filter out (list of int)
603 @param var list encoded name of variable to retrieve (string) 603 @param var list encoded name of variable to retrieve (string)
604 @param framenr framenumber of the variables to retrieve (int) 604 @param framenr framenumber of the variables to retrieve (int)
605 """ 605 """
606 self.__sendCommand('%s%s, %d, %d, %s\n' % \ 606 self.__sendCommand('%s%s, %d, %d, %s\n' % \
607 (RequestVariable, unicode(var), framenr, scope, str(filter))) 607 (RequestVariable, str(var), framenr, scope, str(filter)))
608 608
609 def remoteClientSetFilter(self, scope, filter): 609 def remoteClientSetFilter(self, scope, filter):
610 """ 610 """
611 Public method to set a variables filter list. 611 Public method to set a variables filter list.
612 612
683 Private method to handle data from the client. 683 Private method to handle data from the client.
684 """ 684 """
685 while self.qsock and self.qsock.canReadLine(): 685 while self.qsock and self.qsock.canReadLine():
686 qs = self.qsock.readLine() 686 qs = self.qsock.readLine()
687 if self.codec is not None: 687 if self.codec is not None:
688 us = self.codec.fromUnicode(unicode(qs)) 688 line = self.codec.toUnicode(qs)
689 else: 689 else:
690 us = qs 690 line = bytes(qs).decode()
691 line = str(us)
692 if line.endswith(EOT): 691 if line.endswith(EOT):
693 line = line[:-len(EOT)] 692 line = line[:-len(EOT)]
694 if not line: 693 if not line:
695 continue 694 continue
696 695
697 ## print "Server: ", line ##debug 696 ## print("Server: ", line) ##debug
698 697
699 eoc = line.find('<') + 1 698 eoc = line.find('<') + 1
700 699
701 # Deal with case where user has written directly to stdout 700 # Deal with case where user has written directly to stdout
702 # or stderr, but not line terminated and we stepped over the 701 # or stderr, but not line terminated and we stepped over the

eric ide

mercurial