Table of Contents

Class: DebugThread ./Debugger/DebugThread.py

Class implementing a debug thread.

It represents a thread in the python interpreter that we are tracing.

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

Base Classes   
bdb.Bdb
Methods   
__init__
bootstrap
break_anywhere
break_here
dispatch_exception
dispatch_return
extract_stack
fix_frame_filename
getCurrentFrame
get_ident
go
set_continue
set_ident
set_quit
step
stepOut
stop_here
traceThread
trace_dispatch
user_exception
user_line
user_return
  __init__ 
__init__ (
        self,
        dbgClient,
        targ=None,
        args=None,
        kwargs=None,
        mainThread=0,
        )

Constructor

Arguments

dbgClient
the owning client
targ
the target method in the run thread
args
arguments to be passed to the thread
kwargs
arguments to be passed to the thread
mainThread
0 if this thread is not the mainscripts thread
  bootstrap 
bootstrap ( self )

Private method to bootstrap the thread.

It wraps the call to the user function to enable tracing before hand.

  break_anywhere 
break_anywhere ( self,  frame )

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

See fix_frame_filename for more info.

Arguments

frame
the frame object

Returns

flag indicating the break status (boolean)

  break_here 
break_here ( self,  frame )

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

See fix_frame_filename for more info.

Arguments

frame
the frame object

Returns

flag indicating the break status (boolean)

  dispatch_exception 
dispatch_exception (
        self,
        frame,
        arg,
        )

Reimplemented from bdb.py to always call user_exception.

Exceptions   
bdb.BdbQuit
  dispatch_return 
dispatch_return (
        self,
        frame,
        arg,
        )

Reimplemented from bdb.py to handle passive mode cleanly.

Exceptions   
bdb.BdbQuit
  extract_stack 
extract_stack ( self,  exctb )

Protected member to return a list of stack frames.

Arguments

exctb
exception traceback

Returns

list of stack frames

  fix_frame_filename 
fix_frame_filename ( self,  frame )

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

fThe 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.

Arguments

frame
the frame object
  getCurrentFrame 
getCurrentFrame ( self )

Public method to return the current frame.

Returns

the current frame

  get_ident 
get_ident ( self )

Public method to return the id for this thread.

Returns

the id of this thread (int)

  go 
go ( self )

Public method to resume the thread.

It resumes the thread stopping only at breakpoints or exceptions.

  set_continue 
set_continue ( self )

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

  set_ident 
set_ident ( self,  id )

Public method to set the id for this thread.

Arguments

id
id for this thread (int)
  set_quit 
set_quit ( self )

Public method to quit thread.

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

  step 
step ( self,  traceMode )

Public method to perform a step operation in this thread.

Arguments

tracemode
if it is non-zero, then the step is a step into, otherwise it is a step over.
  stepOut 
stepOut ( self )

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

  stop_here 
stop_here ( self,  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.

Arguments

frame
the frame object

Returns

flag indicating whether the debugger should stop here

  traceThread 
traceThread ( self )

Private method to setup tracing for this thread.

  trace_dispatch 
trace_dispatch (
        self,
        frame,
        event,
        arg,
        )

Private method wraping the trace_dispatch of bdb.py.

It wraps the call to dispatch tracing into bdb to make sure we have locked the client to prevent multiple threads from entering the client event loop.

Exceptions   
bdb.BdbQuit
  user_exception 
user_exception (
        self,
        frame,
        (,
        unhandled=0,
        )

Reimplemented to report an exception to the debug server.

Arguments

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
  user_line 
user_line ( self,  frame )

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

Arguments

frame
the frame object
  user_return 
user_return (
        self,
        frame,
        retval,
        )

Reimplemented to report program termination to the debug server.

Arguments

frame
the frame object
retval
the return value of the program

Table of Contents

This document was automatically generated on Fri Mar 14 19:54:45 2003 by HappyDoc version 2.1