# eric4.Debugger.DebuggerInterfacePython

Module implementing the Python debugger interface for the debug server.

### Global Attributes

ClientDefaultCapabilities

### Classes

DebuggerInterfacePython | Class implementing the Python debugger interface for the debug server.

### Functions

getRegistryData | Module function to get characterising data for the debugger interface.

## DebuggerInterfacePython

Class implementing the Python debugger interface for the debug server.

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

DebuggerInterfacePython | Constructor
__askForkTo | Private method to ask the user which branch of a fork to follow.
__identityTranslation | Private method to perform the identity path translation.
__parseClientLine | Private method to handle data from the client.
__remoteTranslation | Private method to perform the path translation.
__sendCommand | Private method to send a single line command to the client.
__startProcess | Private method to start the debugger client process.
flush | Public slot to flush the queue.
getClientCapabilities | Public method to retrieve the debug clients capabilities.
isConnected | Public method to test, if a debug client has connected.
newConnection | Public slot to handle a new connection.
remoteBanner | Public slot to get the banner info of the remote client.
remoteBreakpoint | Public method to set or clear a breakpoint.
remoteBreakpointEnable | Public method to enable or disable a breakpoint.
remoteBreakpointIgnore | Public method to ignore a breakpoint the next couple of occurrences.
remoteCapabilities | Public slot to get the debug clients capabilities.
remoteClientSetFilter | Public method to set a variables filter list.
remoteClientVariable | Public method to request the variables of the debugged program.
remoteClientVariables | Public method to request the variables of the debugged program.
remoteCompletion | Public slot to get the a list of possible commandline completions from the remote client.
remoteContinue | Public method to continue the debugged program.
remoteCoverage | Public method to load a new program to collect coverage data.
remoteEnvironment | Public method to set the environment for a program to debug, run, ...
remoteEval | Public method to evaluate arg in the current context of the debugged program.
remoteExec | Public method to execute stmt in the current context of the debugged program.
remoteLoad | Public method to load a new program to debug.
remoteProfile | Public method to load a new program to collect profiling data.
remoteRawInput | Public method to send the raw input to the debugged program.
remoteRun | Public method to load a new program to run.
remoteSetThread | Public method to request to set the given thread as current thread.
remoteStatement | Public method to execute a Python statement.
remoteStep | Public method to single step the debugged program.
remoteStepOut | Public method to step out the debugged program.
remoteStepOver | Public method to step over the debugged program.
remoteStepQuit | Public method to stop the debugged program.
remoteThreadList | Public method to request the list of threads from the client.
remoteUTPrepare | Public method to prepare a new unittest run.
remoteUTRun | Public method to start a unittest run.
remoteUTStop | Public method to stop a unittest run.
remoteWatchpoint | Public method to set or clear a watch expression.
remoteWatchpointEnable | Public method to enable or disable a watch expression.
remoteWatchpointIgnore | Public method to ignore a watch expression the next couple of occurrences.
shutdown | Public method to cleanly shut down.
startRemote | Public method to start a remote Python interpreter.
startRemoteForProject | Public method to start a remote Python interpreter for a project.

### Static Methods

None

#### DebuggerInterfacePython (Constructor)

DebuggerInterfacePython(debugServer, passive)

Constructor

debugServer
  reference to the debug server (DebugServer)
passive
  flag indicating passive connection mode (boolean)

#### DebuggerInterfacePython.__askForkTo

__askForkTo()

Private method to ask the user which branch of a fork to follow.

#### DebuggerInterfacePython.__identityTranslation

__identityTranslation(fn, remote2local = True)

Private method to perform the identity path translation.

fn
  filename to be translated (string or QString)
remote2local
  flag indicating the direction of translation (False = local to remote, True = remote to local [default])

Returns:
  translated filename (string)

#### DebuggerInterfacePython.__parseClientLine

__parseClientLine()

Private method to handle data from the client.

#### DebuggerInterfacePython.__remoteTranslation

__remoteTranslation(fn, remote2local = True)

Private method to perform the path translation.

fn
  filename to be translated (string or QString)
remote2local
  flag indicating the direction of translation (False = local to remote, True = remote to local [default])

Returns:
  translated filename (string)

#### DebuggerInterfacePython.__sendCommand

__sendCommand(cmd)

Private method to send a single line command to the client.

cmd
  command to send to the debug client (string)

#### DebuggerInterfacePython.__startProcess

__startProcess(program, arguments, environment = None)

Private method to start the debugger client process.

program
  name of the executable to start (string)
arguments
  arguments to be passed to the program (list of string)
environment
  dictionary of environment settings to pass (dict of string)

Returns:
  the process object (QProcess) or None and an error string (QString)

#### DebuggerInterfacePython.flush

flush()

Public slot to flush the queue.

#### DebuggerInterfacePython.getClientCapabilities

getClientCapabilities()

Public method to retrieve the debug clients capabilities.

Returns:
  debug client capabilities (integer)

#### DebuggerInterfacePython.isConnected

isConnected()

Public method to test, if a debug client has connected.

Returns:
  flag indicating the connection status (boolean)

#### DebuggerInterfacePython.newConnection

newConnection(sock)

Public slot to handle a new connection.

sock
  reference to the socket object (QTcpSocket)

Returns:
  flag indicating success (boolean)

#### DebuggerInterfacePython.remoteBanner

remoteBanner()

Public slot to get the banner info of the remote client.

#### DebuggerInterfacePython.remoteBreakpoint

remoteBreakpoint(fn, line, set, cond = None, temp = False)

Public method to set or clear a breakpoint.

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)
temp
  flag indicating a temporary breakpoint (boolean)

#### DebuggerInterfacePython.remoteBreakpointEnable

remoteBreakpointEnable(fn, line, enable)

Public method to enable or disable a breakpoint.

fn
  filename the breakpoint belongs to (string)
line
  linenumber of the breakpoint (int)
enable
  flag indicating enabling or disabling a breakpoint (boolean)

#### DebuggerInterfacePython.remoteBreakpointIgnore

remoteBreakpointIgnore(fn, line, count)

Public method to ignore a breakpoint the next couple of occurrences.

fn
  filename the breakpoint belongs to (string)
line
  linenumber of the breakpoint (int)
count
  number of occurrences to ignore (int)

#### DebuggerInterfacePython.remoteCapabilities

remoteCapabilities()

Public slot to get the debug clients capabilities.

#### DebuggerInterfacePython.remoteClientSetFilter

remoteClientSetFilter(scope, filter)

Public method to set a variables filter list.

scope
  the scope of the variables (0 = local, 1 = global)
filter
  regexp string for variable names to filter out (string)

#### DebuggerInterfacePython.remoteClientVariable

remoteClientVariable(scope, filter, var, framenr = 0)

Public method to request the variables of the debugged program.

scope
  the scope of the variables (0 = local, 1 = global)
filter
  list of variable types to filter out (list of int)
var
  list encoded name of variable to retrieve (string)
framenr
  framenumber of the variables to retrieve (int)

#### DebuggerInterfacePython.remoteClientVariables

remoteClientVariables(scope, filter, framenr = 0)

Public method to request the variables of the debugged program.

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)

#### DebuggerInterfacePython.remoteCompletion

remoteCompletion(text)

Public slot to get the a list of possible commandline completions from the remote client.

text
  the text to be completed (string or QString)

#### DebuggerInterfacePython.remoteContinue

remoteContinue(special = False)

Public method to continue the debugged program.

special
  flag indicating a special continue operation

#### DebuggerInterfacePython.remoteCoverage

remoteCoverage(fn, argv, wd, erase = False)

Public method to load a new program to collect coverage data.

fn
  the filename to run (string)
argv
  the commandline arguments to pass to the program (string or QString)
wd
  the working directory for the program (string)
erase=
  flag indicating that coverage info should be cleared first (boolean)

#### DebuggerInterfacePython.remoteEnvironment

remoteEnvironment(env)

Public method to set the environment for a program to debug, run, ...

env
  environment settings (dictionary)

#### DebuggerInterfacePython.remoteEval

remoteEval(arg)

Public method to evaluate arg in the current context of the debugged program.

arg
  the arguments to evaluate (string)

#### DebuggerInterfacePython.remoteExec

remoteExec(stmt)

Public method to execute stmt in the current context of the debugged program.

stmt
  statement to execute (string)

#### DebuggerInterfacePython.remoteLoad

remoteLoad(fn, argv, wd, traceInterpreter = False, autoContinue = True, autoFork = False, forkChild = False)

Public method to load a new program to debug.

fn
  the filename to debug (string)
argv
  the commandline arguments to pass to the program (string or QString)
wd
  the working directory for the program (string)
traceInterpreter=
  flag indicating if the interpreter library should be traced as well (boolean)
autoContinue=
  flag indicating, that the debugger should not stop at the first executable line (boolean)
autoFork=
  flag indicating the automatic fork mode (boolean)
forkChild=
  flag indicating to debug the child after forking (boolean)

#### DebuggerInterfacePython.remoteProfile

remoteProfile(fn, argv, wd, erase = False)

Public method to load a new program to collect profiling data.

fn
  the filename to run (string)
argv
  the commandline arguments to pass to the program (string or QString)
wd
  the working directory for the program (string)
erase=
  flag indicating that timing info should be cleared first (boolean)

#### DebuggerInterfacePython.remoteRawInput

remoteRawInput(s)

Public method to send the raw input to the debugged program.

s
  the raw input (string)

#### DebuggerInterfacePython.remoteRun

remoteRun(fn, argv, wd, autoFork = False, forkChild = False)

Public method to load a new program to run.

fn
  the filename to run (string)
argv
  the commandline arguments to pass to the program (string or QString)
wd
  the working directory for the program (string)
autoFork=
  flag indicating the automatic fork mode (boolean)
forkChild=
  flag indicating to debug the child after forking (boolean)

#### DebuggerInterfacePython.remoteSetThread

remoteSetThread(tid)

Public method to request to set the given thread as current thread.

tid
  id of the thread (integer)

#### DebuggerInterfacePython.remoteStatement

remoteStatement(stmt)

Public method to execute a Python statement.

stmt
  the Python statement to execute (string). It should not have a trailing newline.

#### DebuggerInterfacePython.remoteStep

remoteStep()

Public method to single step the debugged program.

#### DebuggerInterfacePython.remoteStepOut

remoteStepOut()

Public method to step out the debugged program.

#### DebuggerInterfacePython.remoteStepOver

remoteStepOver()

Public method to step over the debugged program.

#### DebuggerInterfacePython.remoteStepQuit

remoteStepQuit()

Public method to stop the debugged program.

#### DebuggerInterfacePython.remoteThreadList

remoteThreadList()

Public method to request the list of threads from the client.

#### DebuggerInterfacePython.remoteUTPrepare

remoteUTPrepare(fn, tn, tfn, cov, covname, coverase)

Public method to prepare a new unittest run.

fn
  the filename to load (string)
tn
  the testname to load (string)
tfn
  the test function name to load tests from (string)
cov
  flag indicating collection of coverage data is requested
covname
  filename to be used to assemble the coverage caches filename
coverase
  flag indicating erasure of coverage data is requested

#### DebuggerInterfacePython.remoteUTRun

remoteUTRun()

Public method to start a unittest run.

#### DebuggerInterfacePython.remoteUTStop

remoteUTStop()

Public method to stop a unittest run.

#### DebuggerInterfacePython.remoteWatchpoint

remoteWatchpoint(cond, set, temp = False)

Public method to set or clear a watch expression.

cond
  expression of the watch expression (string)
set
  flag indicating setting or resetting a watch expression (boolean)
temp
  flag indicating a temporary watch expression (boolean)

#### DebuggerInterfacePython.remoteWatchpointEnable

remoteWatchpointEnable(cond, enable)

Public method to enable or disable a watch expression.

cond
  expression of the watch expression (string)
enable
  flag indicating enabling or disabling a watch expression (boolean)

#### DebuggerInterfacePython.remoteWatchpointIgnore

remoteWatchpointIgnore(cond, count)

Public method to ignore a watch expression the next couple of occurrences.

cond
  expression of the watch expression (string)
count
  number of occurrences to ignore (int)

#### DebuggerInterfacePython.shutdown

shutdown()

Public method to cleanly shut down.

It closes our socket and shuts down the debug client. (Needed on Win OS)

#### DebuggerInterfacePython.startRemote

startRemote(port, runInConsole)

Public method to start a remote Python interpreter.

port
  portnumber the debug server is listening on (integer)
runInConsole
  flag indicating to start the debugger in a console window (boolean)

Returns:
  client process object (QProcess) and a flag to indicate a network connection (boolean)

#### DebuggerInterfacePython.startRemoteForProject

startRemoteForProject(port, runInConsole)

Public method to start a remote Python interpreter for a project.

port
  portnumber the debug server is listening on (integer)
runInConsole
  flag indicating to start the debugger in a console window (boolean)

Returns:
  client process object (QProcess) and a flag to indicate a network connection (boolean)

Up

## getRegistryData

getRegistryData()

Module function to get characterising data for the debugger interface.

Returns:
  list of the following data. Client type (string), client capabilities (integer), client type association (list of strings)

Up