Table of Contents

Eric3 Source Documentation: Debugger  
-
* ?csdZ	dkZdkZ
dkZdkZdkZdklZlZdk	l
Z
lZdkTdk
Z
de
fdYZdS(s'
Module implementing the debug server.
N(sSIGNALsPYSIGNAL(s
QServerSocketsQSocket(s*sDebugServercstZdZ<=dZSdZdZdZdZdZdZ	dZ
d	Z#d
Z)dZ
/dZ5d
Z;dZAdZ[dZfddZtdZ~dZdZdZdZdZddZdZdZdZdZdZ)d Z :d!Z!RS("s
    Class implementing the debug server embedded within the IDE.
    
    Signals
    
        clientRawInputSent -- emitted after the data was sent to the debug client
        
        clientLine(filename, lineno) -- emitted after the debug client has executed a
            line of code
        
        clientStack(stack) -- emitted after the debug client has executed a
            line of code
            
        clientVariables(variables) -- emitted after a variables dump has been received
        
        clientStatement(boolean) -- emitted after an interactive command has
            been executed. The parameter is 0 to indicate that the command is
            complete and 1 if it needs more input.
            
        clientException(exception) -- emitted after an exception occured on the 
            client side
            
        clientSyntaxError(exception) -- emitted after a syntax error has been detected
            on the client side
            
        clientExit(exitcode) -- emitted after the client has exited
        
        clientRawInput(prompt) -- emitted after a raw input request was received
        
        clientBanner(banner) -- emitted after the client banner was received
        
        passiveDebuStarted -- emitted after the debug client has connected in
            passive debug mode
            
        clientGone -- emitted if the client went away (planned or unplanned)
    cs=@Atido5Btid}Cti||Dd|_n Fti|dGd|_It|_Jd|_	Kd|_
Lg|_Mh|_Nd|_
P|ioQ|indS(s
        Constructor
        sPassiveDbgEnabledsPassiveDbgPortiiN(sPreferencessgetDebuggerssockets
QServerSockets__init__sselfspassivesNonesqsocks
progLoadeds	debuggingsqueuesbreakss	clientPIDsstartRemote(sselfssocket((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pys__init__=sc	sSVWtido<Xttid}Y|djoZti}nn
\ti}^tid}_|djo&`tii	tiddd}na|d	jo&btii	tiddd
}nc|djo&dtii	tiddd}nOfttid
}g|djo&htii	tiddd}nj|iokynti
|iti}o|ddfjo{pti|itiqtidrti
|iti}s|ddfjotti|itinnWn
uvnXnxtidoytiti}zttid}{ttid}|titi|}|||tii||i
|g|_n2titi||||i
g|_dS(s?
        Private method to start a remote interpreter.
        sCustomPythonInterpretersPythonInterpreterssDebugClientTypeiisDebuggersDebugClient.pyisDebugClientThreads.pyisDebugClientNoQt.pysDebugClientsRemoteDbgEnabledsRemoteExecutions
RemoteHostN( sPreferencessgetDebuggersstrsinterpreterssyss
executablesdebugClientTypesosspathsjoinsdebugClientsselfs	clientPIDswaitpidsWNOHANGsstatusskillssignalsSIGTERMstimessleepsSIGKILLssockets
gethostbynamesgethostnamesipaddrsrexecsrhostsspawnvsP_NOWAITsabspathsport(sselfsstatussipaddrsdebugClientTypesdebugClientsrexecsrhostsinterpreter((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysstartRemoteSsF&&&&
%8cst}|i||itj	odSn|i|td|i	|i|td|i
||_x'|iD]}|ii
|qWg|_|iod|_ndS(s
        Reimplemented to handle a new connection.
        
        Arguments
        
            sockfd -- the socket descriptor
        NsreadyRead()sconnectionClosed()i(sQSocketssocks	setSocketssockfdsselfsqsocksNonesconnectsSIGNALs
handleLinesstartClientsqueuescmds
writeBlockspassives
progLoaded(sselfssockfdscmdssock((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pys
newConnections
	
cs|itjodSn|i|itd|i|i|itd|i|idt|ii	|ii
t|_d|_g|_dS(s
        Public method to cleanly shut down.
        
        It closes our socket and shuts down
        the debug client. (Needed on Win OS)
        NsconnectionClosed()sreadyRead()s%s
i(
sselfsqsocksNones
disconnectsSIGNALsstartClients
handleLinessendCommandsRequestShutdownsflushscloses
progLoadedsqueue(sself((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysshutdownServers""cs|io|idn|idtt|ttii	t|t|fd|_d|_|i
dS(sF
        Public method to load a new program to debug.
        
        Arguments
        
            fn -- the filename to debug (string)
            
            argv -- the commandline arguments to pass to the program (list of strings)
            
            wd -- the working directory for the program (string)
        is%s%s|%s|%s
iN(sselfs
progLoadedsstartClientssendCommandsRequestLoadsstrswdsosspathsabspathsfnsargvs	debuggingsrestoreBreakpoints(sselfsfnsargvswd((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pys
remoteLoads
Dcs|io|idn|idtt|ttii	t|t|fd|_d|_dS(sB
        Public method to load a new program to run.
        
        Arguments
        
            fn -- the filename to run (string)
            
            argv -- the commandline arguments to pass to the program (list of strings)
            
            wd -- the working directory for the program (string)
        is%s%s|%s|%s
iN(
sselfs
progLoadedsstartClientssendCommands
RequestRunsstrswdsosspathsabspathsfnsargvs	debugging(sselfsfnsargvswd((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pys	remoteRuns
Dcs|io|idn|idtt|ttii	t|t||fd|_d|_
dS(s
        Public method to load a new program to collect coverage data.
        
        Arguments
        
            fn -- the filename to run (string)
            
            argv -- the commandline arguments to pass to the program (list of strings)
            
            wd -- the working directory for the program (string)
            
            erase -- flag indicating that coverage info should be cleared first (boolean)
        is%s%s|%s|%s|%d
iN(sselfs
progLoadedsstartClientssendCommandsRequestCoveragesstrswdsosspathsabspathsfnsargvserases	debugging(sselfsfnsargvswdserase((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysremoteCoverages

Gcs|io|idn|idtt|ttii	t|t||fd|_d|_
dS(s
        Public method to load a new program to collect profiling data.
        
        Arguments
        
            fn -- the filename to run (string)
            
            argv -- the commandline arguments to pass to the program (list of strings)
            
            wd -- the working directory for the program (string)
            
            erase -- flag indicating that timing info should be cleared first (boolean)
        is%s%s|%s|%s|%d
iN(sselfs
progLoadedsstartClientssendCommandsRequestProfilesstrswdsosspathsabspathsfnsargvserases	debugging(sselfsfnsargvswdserase((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pys
remoteProfiles

Gcs2 |id|!|itddS(s
        Public method to execute a Python statement.  
        
        Arguments
        
            stmt -- the Python statement to execute (string). It
              should not have a trailing newline.
        s%s
s
N(sselfssendCommandsstmts	RequestOK(sselfsstmt((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysremoteStatementscs#&'|itddS(sD
        Public method to single step the debugged program.
        s
N(sselfssendCommandsRequestStep(sself((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pys
remoteStep#scs),-|itddS(sB
        Public method to step over the debugged program.
        s
N(sselfssendCommandsRequestStepOver(sself((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysremoteStepOver)scs/23|itddS(sA
        Public method to step out the debugged program.
        s
N(sselfssendCommandsRequestStepOut(sself((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pys
remoteStepOut/scs589|itddS(s=
        Public method to stop the debugged program.
        s
N(sselfssendCommandsRequestStepQuit(sself((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysremoteStepQuit5scs;>?|itddS(sA
        Public method to continue the debugged program.
        s
N(sselfssendCommandsRequestContinue(sself((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysremoteContinue;scsANO|ofPy'Q|it|i||fWn5Rtj
o&S||fg|it|<nXn;Uy'V|it|i	||fWn
WXnXY|i
dt||||fdS(s
        Public method to set or clear a breakpoint.
        
        Arguments
        
            fn -- filename the breakpoint belongs to (string)
            
            line -- linenumber of the breakpoint (int)
            
            set -- flag indicating setting or resetting a breakpoint (boolean)
            
            cond -- condition of the breakpoint (string)
        s%s%s,%d,%d,%s
N(ssetsselfsbreakssstrsfnsappendslinescondsKeyErrorsremovessendCommandsRequestBreak(sselfsfnslinessetscond((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysremoteBreakpointAs

'('cs7[bc|i|dd|itdfdS(s
        Public method to send the raw input to the debugged program.
        
        Arguments
        
            s -- the raw input (string)
        s
sclientRawInputSentN(sselfssendCommandsssemitsPYSIGNAL(sselfss((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysremoteRawInput[sics0fqr|idt||t|fdS(sf
        Public method to request the variables of the debugged program.
        
        Arguments
        
            scope -- the scope of the variables (0 = local, 1 = global)
            
            filter -- list of variable types to filter out (list of int)
            
            framenr -- framenumber of the variables to retrieve (int)
        s
%s%d, %d, %s
N(sselfssendCommandsRequestVariablessframenrsscopesstrsfilter(sselfsscopesfiltersframenr((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysremoteClientVariablesfscs$t{||idt|fdS(s
        Public method to evaluate arg in the current context of the debugged program.
        
        Arguments
        
            arg -- the arguments to evaluate (string)
        s%s%s
N(sselfssendCommandsRequestEvalsarg(sselfsarg((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pys
remoteEvaltscs$~|idt|fdS(s
        Public method to execute stmt in the current context of the debugged program.
        
        Arguments
        
            stmt -- statement to execute (string)
        s%s%s
N(sselfssendCommandsRequestExecsstmt(sselfsstmt((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pys
remoteExec~scs|itddS(sJ
        Public slot to get the banner info of the remote client.
        s
N(sselfssendCommands
RequestBanner(sself((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysremoteBannerscsx|iiot|ii}|idd}|id}|djo$|i	t
d|| fn|djo
||jo|||!}|tjowt
||d!}|d}|i	t
d|dt|df|i	t
d|fd	Sn|tjo.|i	t
d
||d!fd	Sn|tjo'|i	t
ddfd	Sn|tjo'|i	t
ddfd	Sn|tjo.|i	t
d||d!fd	Sn|tjo.|i	t
d
||d!fd	Sn|tjoL|i	t
d||d!f|io|ind	Sn|tjo.|i	t
d||d!fd	Sn|tjo:t
||d!}|i	t
d|d	Sn|tjo|id	Snn|i	t
d|fqWd	S(s@
        Private method to handle data from the client.
        s<is>isclientOutputis
clientLinesclientStackNsclientVariablessclientStatementsclientExceptionsclientSyntaxErrors
clientExitsclientRawInputsclientBanner(sselfsqsockscanReadLinesstrsreadLineslinesfindseocsbocsemitsPYSIGNALsrespsResponseLinesevalsstackscfsintsResponseVariabless
ResponseOKsResponseContinuesResponseExceptionsResponseSyntaxsResponseExitspassivespassiveShutDownsResponseRawsResponseBannersbisPassiveStartupspassiveStartUp(sselfsrespscfslinesstackseocsbisboc((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pys
handleLines^$
-####
#
csSt|idGHd|_|i|itdfdS(sF
        Private method to handle a passive debug connection.
        s!Passive debug connection receivedispassiveDebugStartedN(sstrsselfstrUtf8spassiveClientExitedsrestoreBreakpointssemitsPYSIGNAL(sself((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pyspassiveStartUps

cs:d|_|it|idGHdS(sI
        Private method to shut down a passive debug connection.
        isPassive debug connection closedN(sselfspassiveClientExitedsshutdownServersstrstrUtf8(sself((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pyspassiveShutDowns
ics|ip|ioK|itj	o4|i|itd||i	@fnn|io|i
ndS(s
        Private method to start a debug client.
        
        Arguments
        
            unplanned -- flag indicating that the client has died
        s
clientGoneN(sselfspassivespassiveClientExitedsqsocksNonesshutdownServersemitsPYSIGNALs	unplanneds	debuggingsstartRemote(sselfs	unplanned((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysstartClients
+csG|itj	o|ii|n|ii|dS(s
        Private method to send a single line command to the client.
        
        Arguments
        
            cmd -- command to send to the debug client (string)
        N(sselfsqsocksNones
writeBlockscmdsqueuesappend(sselfscmd((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pyssendCommandsc	swxg|iiD]S\}}	xA|i|D	]/\}}
|idt||d|fq9WqWdS(sM
        Private method to restore the break points after a restart.
        s%s%s,%d,%d,%s
iN(	sselfsbreakssitemssfnsbpsslinescondssendCommandsRequestBreak(sselfsbpsscondslinesfn((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysrestoreBreakpointsscsh|_dS(sN
        Public method (slot) to clear the local list of breakpoints.
        N(sselfsbreaks(sself((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysclearAllBreakpointsscs4y|it|=Wn
nXdS(s
        Public method to clear the local list of breakpoints for a file.
        
        Arguments
        
            fn -- filename of the breakpoints to be cleared (string)
        N(sselfsbreakssstrsfn(sselfsfn((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysclearFileBreakpointss
cs&'|iSdS(s
        Public method to get all breakpoints set in the server.
        
        Returns
        
            list of all breakpoints
        N(sselfsbreaks(sself((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysgetAllBreakpointsscs9)45y6|it|SWn78gSnXdS(s
        Public method to get all breakpoints of a specific file.
        
        Arguments
        
            filename -- the filename of the breakpoints to retrieve (string)
            
        Returns
        
            list of all breakpoints belonging to filename
        N(sselfsbreakssstrsfilename(sselfsfilename((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysgetFileBreakpoints)s
csv:EFh}G|tj	oLHxB|DH]7}IyJ|it|||<Wn
KLnXq)WnM|SdS(s'
        Public method to get all breakpoints of the current project.
        
        Arguments
        
            filelist -- list of filenames belonging to the current project
            
        Returns
        
            list of all breakpoint belonging to the current project
        N(sbpDictsfilelistsNonesfnsselfsbreakssstr(sselfsfilelistsbpDictsfn((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysgetProjectBreakpoints:s	
	("s__name__s
__module__s__doc__s__init__sstartRemotes
newConnectionsshutdownServers
remoteLoads	remoteRunsremoteCoverages
remoteProfilesremoteStatements
remoteStepsremoteStepOvers
remoteStepOutsremoteStepQuitsremoteContinuesremoteBreakpointsremoteRawInputsremoteClientVariabless
remoteEvals
remoteExecsremoteBanners
handleLinespassiveStartUpspassiveShutDownsstartClientssendCommandsrestoreBreakpointssclearAllBreakpointssclearFileBreakpointssgetAllBreakpointssgetFileBreakpointssgetProjectBreakpoints(((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pysDebugServers@$0

H	


(s__doc__ssyssosssocketstimessignalsqtsSIGNALsPYSIGNALs	qtnetworks
QServerSocketsQSockets
DebugProtocolsPreferencessDebugServer(sPYSIGNALssocketsQSocketsSIGNALs
QServerSocketsPreferencesssysstimesosssignalsDebugServer((sB/home/detlev/Development/Python/Eric/eric3/Debugger/DebugServer.pys?	s


Table of Contents

This document was automatically generated by HappyDoc version 2.1