# eric6.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.
__sendCallTrace | Private method to send a call/return trace.
__skip_it | Private method to filter out debugger files.
break_anywhere | Public method reimplemented from bdb.py to do some special things.
break_here | Public method reimplemented from bdb.py to fix the filename from the frame.
clear_watch | Public method to clear a watch expression.
dispatch_exception | Public method reimplemented from bdb.py to always call user_exception.
dispatch_line | Public method reimplemented from bdb.py to do some special things.
dispatch_return | Public method 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 | Protected method to return the last debugger event.
getStack | Public method to get the stack.
get_break | Public method 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 | Public method reimplemented from bdb.py to always get informed of exceptions.
set_quit | Public method to quit.
set_trace | Public method reimplemented from 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 | Public method reimplemented to filter out debugger files.
trace_dispatch | Public method reimplemented from bdb.py to do some special things.
user_exception | Public method reimplemented to report an exception to the debug server.
user_line | Public method reimplemented to handle the program about to execute a particular line.
user_return | Public method 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.__sendCallTrace

__sendCallTrace(event, fromFrame, toFrame)

Private method to send a call/return trace.

event
  trace event (string)
fromFrame
  originating frame (frame)
toFrame
  destination frame (frame)

#### 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)

Public method 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)

Public method 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)

Public method reimplemented from bdb.py to always call user_exception.

frame
  The current stack frame.
arg
  The arguments

Returns:
  local trace function

Raises bdb.BdbQuit:
  raised to indicate the end of the debug session

#### DebugBase.dispatch_line

dispatch_line(frame)

Public method 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

Raises bdb.BdbQuit:
  raised to indicate the end of the debug session

#### DebugBase.dispatch_return

dispatch_return(frame, arg)

Public method reimplemented from bdb.py to handle passive mode cleanly.

frame
  The current stack frame.
arg
  The arguments

Returns:
  local trace function

Raises bdb.BdbQuit:
  raised to indicate the end of the debug session

#### 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

Returns:
  fixed up file name (string)

#### 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()

Protected 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)

Public method reimplemented from bdb.py to get the first breakpoint of a particular line.

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

filename
  filename of the bp to retrieve (string)
lineno
  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)

Returns:
  reference to the watch point

#### 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
  current stack frame.
event
  trace event (string)
arg
  arguments

Raises RuntimeError:
  raised to indicate too many recursions

#### DebugBase.setRecursionDepth

setRecursionDepth(frame)

Public method to determine the current recursion depth.

frame
  The current stack frame.

#### DebugBase.set_continue

set_continue(special)

Public method 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)

Public method reimplemented from 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)

Public method 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)

Public method 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)

Public method 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)

Public method reimplemented to handle the program about to execute a particular line.

frame
  the frame object

#### DebugBase.user_return

user_return(frame, retval)

Public method 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