src/eric7/Debugger/DebuggerInterfacePython.py

branch
server
changeset 10564
0de57f082daa
parent 10561
be23a662d709
child 10597
fbe93720ee9f
equal deleted inserted replaced
10563:b4b47c1a02ba 10564:0de57f082daa
257 ) 257 )
258 return None, False, "" 258 return None, False, ""
259 259
260 self.__inShutdown = False 260 self.__inShutdown = False
261 261
262 self.__ericServerDebuggerInterface.stopClient()
263 self.__ericServerDebugging = False 262 self.__ericServerDebugging = False
264 self.__mainDebugger = None
265 263
266 redirect = ( 264 redirect = (
267 str(configOverride["redirect"]) 265 str(configOverride["redirect"])
268 if configOverride and configOverride["enable"] 266 if configOverride and configOverride["enable"]
269 else str(Preferences.getDebugger("Python3Redirect")) 267 else str(Preferences.getDebugger("Python3Redirect"))
542 ) 540 )
543 return None, self.__isNetworked, "" 541 return None, self.__isNetworked, ""
544 542
545 self.__inShutdown = False 543 self.__inShutdown = False
546 544
547 self.__ericServerDebuggerInterface.stopClient()
548 self.__ericServerDebugging = False 545 self.__ericServerDebugging = False
549 self.__mainDebugger = None
550 546
551 if project.getDebugProperty("REMOTEDEBUGGER"): 547 if project.getDebugProperty("REMOTEDEBUGGER"):
552 # remote debugging code 548 # remote debugging code
553 ipaddr = self.debugServer.getHostAddress(False) 549 ipaddr = self.debugServer.getHostAddress(False)
554 rexec = project.getDebugProperty("REMOTECOMMAND") 550 rexec = project.getDebugProperty("REMOTECOMMAND")
792 Private slot to handle the exit of the last debug client connected. 788 Private slot to handle the exit of the last debug client connected.
793 """ 789 """
794 with contextlib.suppress(RuntimeError): 790 with contextlib.suppress(RuntimeError):
795 # debug server object might have been deleted already 791 # debug server object might have been deleted already
796 # ignore this 792 # ignore this
797 self.debugServer.signalLastClientExited()
798 self.__autoContinued.clear() 793 self.__autoContinued.clear()
799 if not self.__inShutdown: 794 if not self.__inShutdown:
795 self.debugServer.signalLastClientExited()
800 self.debugServer.startClient() 796 self.debugServer.startClient()
801 797
802 def getDebuggerIds(self): 798 def getDebuggerIds(self):
803 """ 799 """
804 Public method to return the IDs of the connected debugger backends. 800 Public method to return the IDs of the connected debugger backends.
844 840
845 while self.__pendingConnections: 841 while self.__pendingConnections:
846 sock = self.__pendingConnections.pop() 842 sock = self.__pendingConnections.pop()
847 self.__shutdownSocket(sock) 843 self.__shutdownSocket(sock)
848 844
845 self.__ericServerDebuggerInterface.stopClient()
846
849 # reinitialize 847 # reinitialize
850 self.__commandQueue.clear() 848 self.__commandQueue.clear()
851 849
852 self.__mainDebugger = None 850 self.__mainDebugger = None
853 851
876 Public method to test, if a debug client has connected. 874 Public method to test, if a debug client has connected.
877 875
878 @return flag indicating the connection status 876 @return flag indicating the connection status
879 @rtype bool 877 @rtype bool
880 """ 878 """
881 return bool(self.__connections) 879 return bool(self.__connections) or self.__ericServerDebugging
882 880
883 def remoteEnvironment(self, env): 881 def remoteEnvironment(self, env):
884 """ 882 """
885 Public method to set the environment for a program to debug, run, ... 883 Public method to set the environment for a program to debug, run, ...
886 884
954 @param argv list of command line arguments to pass to the program 952 @param argv list of command line arguments to pass to the program
955 @type list of str 953 @type list of str
956 @param wd working directory for the program 954 @param wd working directory for the program
957 @type str 955 @type str
958 """ 956 """
959 self.__scriptName = os.path.abspath(fn) 957 if FileSystemUtilities.isPlainFileName(fn):
958 fn = os.path.abspath(fn)
959
960 self.__scriptName = fn
960 961
961 wd = self.translate(wd, False) 962 wd = self.translate(wd, False)
962 fn = self.translate(os.path.abspath(fn), False) 963 fn = self.translate(fn, False)
963 self.__sendJsonCommand( 964 self.__sendJsonCommand(
964 "RequestRun", 965 "RequestRun",
965 { 966 {
966 "workdir": wd, 967 "workdir": wd,
967 "filename": fn, 968 "filename": fn,
982 @type str 983 @type str
983 @param erase flag indicating that coverage info should be 984 @param erase flag indicating that coverage info should be
984 cleared first 985 cleared first
985 @type bool 986 @type bool
986 """ 987 """
987 self.__scriptName = os.path.abspath(fn) 988 if FileSystemUtilities.isPlainFileName(fn):
989 fn = os.path.abspath(fn)
990
991 self.__scriptName = fn
988 992
989 wd = self.translate(wd, False) 993 wd = self.translate(wd, False)
990 fn = self.translate(os.path.abspath(fn), False) 994 fn = self.translate(fn, False)
991 self.__sendJsonCommand( 995 self.__sendJsonCommand(
992 "RequestCoverage", 996 "RequestCoverage",
993 { 997 {
994 "workdir": wd, 998 "workdir": wd,
995 "filename": fn, 999 "filename": fn,
1011 @type str 1015 @type str
1012 @param erase flag indicating that timing info should be cleared 1016 @param erase flag indicating that timing info should be cleared
1013 first 1017 first
1014 @type bool 1018 @type bool
1015 """ 1019 """
1016 self.__scriptName = os.path.abspath(fn) 1020 if FileSystemUtilities.isPlainFileName(fn):
1021 fn = os.path.abspath(fn)
1022
1023 self.__scriptName = fn
1017 1024
1018 wd = self.translate(wd, False) 1025 wd = self.translate(wd, False)
1019 fn = self.translate(os.path.abspath(fn), False) 1026 fn = self.translate(fn, False)
1020 self.__sendJsonCommand( 1027 self.__sendJsonCommand(
1021 "RequestProfile", 1028 "RequestProfile",
1022 { 1029 {
1023 "workdir": wd, 1030 "workdir": wd,
1024 "filename": fn, 1031 "filename": fn,
1697 1704
1698 elif method == "RequestRaw": 1705 elif method == "RequestRaw":
1699 self.debugServer.signalClientRawInput( 1706 self.debugServer.signalClientRawInput(
1700 params["prompt"], params["echo"], params["debuggerId"] 1707 params["prompt"], params["echo"], params["debuggerId"]
1701 ) 1708 )
1709 pass
1702 1710
1703 elif method == "ResponseBPConditionError": 1711 elif method == "ResponseBPConditionError":
1704 fn = self.translate(params["filename"], True) 1712 fn = self.translate(params["filename"], True)
1705 self.debugServer.signalClientBreakConditionError( 1713 self.debugServer.signalClientBreakConditionError(
1706 fn, params["line"], params["debuggerId"] 1714 fn, params["line"], params["debuggerId"]
1821 else: 1829 else:
1822 # Local debugging -> send the command to the client 1830 # Local debugging -> send the command to the client
1823 if debuggerId and debuggerId in self.__connections: 1831 if debuggerId and debuggerId in self.__connections:
1824 sock = self.__connections[debuggerId] 1832 sock = self.__connections[debuggerId]
1825 elif sock is None and self.__mainDebugger is not None: 1833 elif sock is None and self.__mainDebugger is not None:
1826 sock = self.__connections[self.__mainDebugger] 1834 with contextlib.suppress(KeyError):
1835 sock = self.__connections[self.__mainDebugger]
1827 if sock is not None: 1836 if sock is not None:
1828 self.__writeJsonCommandToSocket(jsonStr, sock) 1837 self.__writeJsonCommandToSocket(jsonStr, sock)
1829 else: 1838 else:
1830 self.__commandQueue.append(jsonStr) 1839 self.__commandQueue.append(jsonStr)
1831 1840

eric ide

mercurial