# eric4.DebugClients.Python.DebugBase

Module implementing the debug base class.

### Global Attributes

gRecursionLimit

### Classes

DebugBase | Class implementing base class of the debugger.

### Functions

printerr | Module function used for debugging the debug client.
setRecursionLimit | Module function to set the recursion limit.

## DebugBase

Class implementing base class of the debugger.

Provides simple wrapper methods around bdb for the 'owning' client to call to step etc.

### Derived from

bdb.Bdb

### Class Attributes

None

### Class Methods

None

### Methods

DebugBase | Constructor
__do_clear | Private method called to clear a temporary breakpoint.
__do_clearWatch | Private method called to clear a temporary watch expression.
__effective | Private method to determine, if a watch expression is effective.
__extract_stack | Private member to return a list of stack frames.
__skip_it | Private method to filter out debugger files.
break_anywhere | Reimplemented from bdb.py to do some special things.
break_here | Reimplemented from bdb.py to fix the filename from the frame.
clear_watch | Public method to clear a watch expression.
dispatch_exception | Reimplemented from bdb.py to always call user_exception.
dispatch_line | Reimplemented from bdb.py to do some special things.
dispatch_return | Reimplemented from bdb.py to handle passive mode cleanly.
fix_frame_filename | Public method used to fixup the filename for a given frame.
getCurrentFrame | Public method to return the current frame.
getCurrentFrameLocals | Public method to return the locals dictionary of the current frame.
getEvent | Public method to return the last debugger event.
getStack | Public method to get the stack.
get_break | Reimplemented from bdb.py to get the first breakpoint of a particular line.
get_watch | Public method to get a watch expression.
go | Public method to resume the thread.
isBroken | Public method to return the broken state of the debugger.
profile | Public method used to trace some stuff independent of the debugger trace function.
setRecursionDepth | Public method to determine the current recursion depth.
set_continue | Reimplemented from bdb.py to always get informed of exceptions.
set_quit | Public method to quit.
set_trace | Overridden method of bdb.py to do some special setup.
set_watch | Public method to set a watch expression.
step | Public method to perform a step operation in this thread.
stepOut | Public method to perform a step out of the current call.
stop_here | Reimplemented to filter out debugger files.
trace_dispatch | Reimplemented from bdb.py to do some special things.
user_exception | Reimplemented to report an exception to the debug server.
user_line | Reimplemented to handle the program about to execute a particular line.
user_return | Reimplemented to report program termination to the debug server.

### Static Methods

None

#### DebugBase (Constructor)

DebugBase(dbgClient)

Constructor

dbgClient
  the owning client

#### DebugBase.__do_clear

__do_clear(filename, lineno)

Private method called to clear a temporary breakpoint.

filename
  name of the file the bp belongs to
lineno
  linenumber of the bp

#### DebugBase.__do_clearWatch

__do_clearWatch(cond)

Private method called to clear a temporary watch expression.

cond
  expression of the watch expression to be cleared (string)

#### DebugBase.__effective

__effective(frame)

Private method to determine, if a watch expression is effective.

frame
  the current execution frame

Returns:
  tuple of watch expression and a flag to indicate, that a temporary watch expression may be deleted (bdb.Breakpoint, boolean)

#### DebugBase.__extract_stack

__extract_stack(exctb)

Private member to return a list of stack frames.

exctb
  exception traceback

Returns:
  list of stack frames

#### DebugBase.__skip_it

__skip_it(frame)

Private method to filter out debugger files.

Tracing is turned off for files that are part of the debugger that are called from the application being debugged.

frame
  the frame object

Returns:
  flag indicating whether the debugger should skip this frame

#### DebugBase.break_anywhere

break_anywhere(frame)

Reimplemented from bdb.py to do some special things.

These speciality is to fix the filename from the frame (see fix_frame_filename for more info).

frame
  the frame object

Returns:
  flag indicating the break status (boolean)

#### DebugBase.break_here

break_here(frame)

Reimplemented from bdb.py to fix the filename from the frame.

See fix_frame_filename for more info.

frame
  the frame object

Returns:
  flag indicating the break status (boolean)

#### DebugBase.clear_watch

clear_watch(cond)

Public method to clear a watch expression.

cond
  expression of the watch expression to be cleared (string)

#### DebugBase.dispatch_exception

dispatch_exception(frame, arg)

Reimplemented from bdb.py to always call user_exception.

frame
  The current stack frame.
arg
  The arguments

Returns:
  local trace function

#### DebugBase.dispatch_line

dispatch_line(frame)

Reimplemented from bdb.py to do some special things.

This speciality is to check the connection to the debug server for new events (i.e. new breakpoints) while we are going through the code.

frame
  The current stack frame.

Returns:
  local trace function

#### DebugBase.dispatch_return

dispatch_return(frame, arg)

Reimplemented from bdb.py to handle passive mode cleanly.

frame
  The current stack frame.
arg
  The arguments

Returns:
  local trace function

#### DebugBase.fix_frame_filename

fix_frame_filename(frame)

Public method used to fixup the filename for a given frame.

The logic employed here is that if a module was loaded from a .pyc file, then the correct .py to operate with should be in the same path as the .pyc. The reason this logic is needed is that when a .pyc file is generated, the filename embedded and thus what is readable in the code object of the frame object is the fully qualified filepath when the pyc is generated. If files are moved from machine to machine this can break debugging as the .pyc will refer to the .py on the original machine. Another case might be sharing code over a network... This logic deals with that.

frame
  the frame object

#### DebugBase.getCurrentFrame

getCurrentFrame()

Public method to return the current frame.

Returns:
  the current frame

#### DebugBase.getCurrentFrameLocals

getCurrentFrameLocals()

Public method to return the locals dictionary of the current frame.

Returns:
  locals dictionary of the current frame

#### DebugBase.getEvent

getEvent()

Public method to return the last debugger event.

Returns:
  last debugger event (string)

#### DebugBase.getStack

getStack()

Public method to get the stack.

Returns:
  list of lists with file name (string), line number (integer) and function name (string)

#### DebugBase.get_break

get_break(filename, lineno)

Reimplemented from bdb.py to get the first breakpoint of a particular line.

Because eric4 supports only one breakpoint per line, this overwritten method will return this one and only breakpoint.

filename
  the filename of the bp to retrieve (string)
ineno
  the linenumber of the bp to retrieve (integer)

Returns:
  breakpoint or None, if there is no bp

#### DebugBase.get_watch

get_watch(cond)

Public method to get a watch expression.

cond
  expression of the watch expression to be cleared (string)

#### DebugBase.go

go(special)

Public method to resume the thread.

It resumes the thread stopping only at breakpoints or exceptions.

special
  flag indicating a special continue operation

#### DebugBase.isBroken

isBroken()

Public method to return the broken state of the debugger.

Returns:
  flag indicating the broken state (boolean)

#### DebugBase.profile

profile(frame, event, arg)

Public method used to trace some stuff independent of the debugger trace function.

frame
  The current stack frame.
event
  The trace event (string)
arg
  The arguments

#### DebugBase.setRecursionDepth

setRecursionDepth(frame)

Public method to determine the current recursion depth.

frame
  The current stack frame.

#### DebugBase.set_continue

set_continue(special)

Reimplemented from bdb.py to always get informed of exceptions.

special
  flag indicating a special continue operation

#### DebugBase.set_quit

set_quit()

Public method to quit.

It wraps call to bdb to clear the current frame properly.

#### DebugBase.set_trace

set_trace(frame = None)

Overridden method of bdb.py to do some special setup.

frame
  frame to start debugging from

#### DebugBase.set_watch

set_watch(cond, temporary=0)

Public method to set a watch expression.

cond
  expression of the watch expression (string)
temporary
  flag indicating a temporary watch expression (boolean)

#### DebugBase.step

step(traceMode)

Public method to perform a step operation in this thread.

traceMode
  If it is non-zero, then the step is a step into, otherwise it is a step over.

#### DebugBase.stepOut

stepOut()

Public method to perform a step out of the current call.

#### DebugBase.stop_here

stop_here(frame)

Reimplemented to filter out debugger files.

Tracing is turned off for files that are part of the debugger that are called from the application being debugged.

frame
  the frame object

Returns:
  flag indicating whether the debugger should stop here

#### DebugBase.trace_dispatch

trace_dispatch(frame, event, arg)

Reimplemented from bdb.py to do some special things.

This specialty is to check the connection to the debug server for new events (i.e. new breakpoints) while we are going through the code.

frame
  The current stack frame.
event
  The trace event (string)
arg
  The arguments

Returns:
  local trace function

#### DebugBase.user_exception

user_exception(frame, (exctype, excval, exctb), unhandled=0)

Reimplemented to report an exception to the debug server.

frame
  the frame object
exctype
  the type of the exception
excval
  data about the exception
exctb
  traceback for the exception
unhandled
  flag indicating an uncaught exception

#### DebugBase.user_line

user_line(frame)

Reimplemented to handle the program about to execute a particular line.

frame
  the frame object

#### DebugBase.user_return

user_return(frame, retval)

Reimplemented to report program termination to the debug server.

frame
  the frame object
retval
  the return value of the program

Up

## printerr

printerr(s)

Module function used for debugging the debug client.

s
  data to be printed

Up

## setRecursionLimit

setRecursionLimit(limit)

Module function to set the recursion limit.

limit
  recursion limit (integer)

Up