Module implementing a debug client base class.
DebugClientInstance |
DebugClientBase | Class implementing the client side of the debugger. |
DebugClientClose | Replacement for the standard os.close(fd). |
DebugClientFork | Replacement for the standard os.fork(). |
DebugClientInput | Replacement for the standard input builtin. |
DebugClientSetRecursionLimit | Replacement for the standard sys.setrecursionlimit(limit). |
Class implementing the client side of the debugger.
It provides access to the Python interpeter from a debugger running in another process whether or not the Qt event loop is running.
The protocol between the debugger and the client assumes that there will be a single source of debugger commands and a single source of Python statements. Commands and statement are always exactly one line and may be interspersed.
The protocol is as follows. First the client opens a connection to the debugger and then sends a series of one line commands. A command is either >Load<, >Step<, >StepInto<, ... or a Python statement. See DebugProtocol.py for a listing of valid protocol tokens.
A Python statement consists of the statement to execute, followed (in a separate line) by >OK?<. If the statement was incomplete then the response is >Continue<. If there was an exception then the response is >Exception<. Otherwise the response is >OK<. The reason for the >OK?< part is to provide a sentinal (ie. the responding >OK<) after any possible output as a result of executing the command.
The client may send any other lines at any other time which should be interpreted as program output.
If the debugger closes the session there is no response from the client. The client may close the session at any time as a result of the script being debugged closing or crashing.
Note: This class is meant to be subclassed by individual DebugClient classes. Do not instantiate it directly.
clientCapabilities |
None |
DebugClientBase | Constructor |
__clientCapabilities | Private method to determine the clients capabilities. |
__compileFileSource | Private method to compile source code read from a file. |
__completionList | Private slot to handle the request for a commandline completion list. |
__dumpThreadList | Public method to send the list of threads. |
__dumpVariable | Private method to return the variables of a frame to the debug server. |
__dumpVariables | Private method to return the variables of a frame to the debug server. |
__exceptionRaised | Private method called in the case of an exception |
__formatQt4Variable | Private method to produce a formatted output of a simple Qt4 type. |
__formatVariablesList | Private method to produce a formated variables list. |
__generateFilterObjects | Private slot to convert a filter string to a list of filter objects. |
__getSysPath | Private slot to calculate a path list including the PYTHONPATH environment variable. |
__interact | Private method to Interact with the debugger. |
__resolveHost | Private method to resolve a hostname to an IP address. |
__setCoding | Private method to set the coding used by a python file. |
__unhandled_exception | Private method called to report an uncaught exception. |
absPath | Public method to convert a filename to an absolute name. |
attachThread | Public method to setup a thread for DebugClient to debug. |
close | Private method implementing a close method as a replacement for os.close(). |
connectDebugger | Public method to establish a session with the debugger. |
eventLoop | Public method implementing our event loop. |
eventPoll | Public method to poll for events like 'set break point'. |
fork | Public method implementing a fork routine deciding which branch to follow. |
getCoding | Public method to return the current coding. |
getRunning | Public method to return the main script we are currently running. |
handleLine | Public method to handle the receipt of a complete line. |
input | Public method to implement input() using the event loop. |
main | Public method implementing the main method. |
progTerminated | Public method to tell the debugger that the program has terminated. |
run_call | Public method used to start the remote debugger and call a function. |
sessionClose | Public method to close the session with the debugger and optionally terminate. |
shouldSkip | Public method to check if a file should be skipped. |
startDebugger | Public method used to start the remote debugger. |
startProgInDebugger | Public method used to start the remote debugger. |
write | Public method to write data to the output stream. |
None |
Constructor
Private method to determine the clients capabilities.
Private method to compile source code read from a file.
Private slot to handle the request for a commandline completion list.
Public method to send the list of threads.
Private method to return the variables of a frame to the debug server.
Private method to return the variables of a frame to the debug server.
Private method called in the case of an exception
It ensures that the debug server is informed of the raised exception.
Private method to produce a formatted output of a simple Qt4 type.
Private method to produce a formated variables list.
The dictionary passed in to it is scanned. Variables are only added to the list, if their type is not contained in the filter list and their name doesn't match any of the filter expressions. The formated variables list (a list of tuples of 3 values) is returned.
Private slot to convert a filter string to a list of filter objects.
Private slot to calculate a path list including the PYTHONPATH environment variable.
Private method to Interact with the debugger.
Private method to resolve a hostname to an IP address.
Private method to set the coding used by a python file.
Private method called to report an uncaught exception.
Public method to convert a filename to an absolute name.
sys.path is used as a set of possible prefixes. The name stays relative if a file could not be found.
Public method to setup a thread for DebugClient to debug.
If mainThread is non-zero, then we are attaching to the already started mainthread of the app and the rest of the args are ignored.
Private method implementing a close method as a replacement for os.close().
It prevents the debugger connections from being closed.
Public method to establish a session with the debugger.
It opens a network connection to the debugger, connects it to stdin, stdout and stderr and saves these file objects in case the application being debugged redirects them itself.
Public method implementing our event loop.
Public method to poll for events like 'set break point'.
Public method implementing a fork routine deciding which branch to follow.
Public method to return the current coding.
Public method to return the main script we are currently running.
Public method to handle the receipt of a complete line.
It first looks for a valid protocol token at the start of the line. Thereafter it trys to execute the lines accumulated so far.
Public method to implement input() using the event loop.
Public method implementing the main method.
Public method to tell the debugger that the program has terminated.
Public method used to start the remote debugger and call a function.
Public method to close the session with the debugger and optionally terminate.
Public method to check if a file should be skipped.
Public method used to start the remote debugger.
Public method used to start the remote debugger.
Public method to write data to the output stream.
Replacement for the standard os.close(fd).
Replacement for the standard os.fork().
Replacement for the standard input builtin.
This function works with the split debugger.
Replacement for the standard sys.setrecursionlimit(limit).