Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Member Functions
idlelib.Debugger.Idb Class Reference
Inheritance diagram for idlelib.Debugger.Idb:
Inheritance graph
[legend]
Collaboration diagram for idlelib.Debugger.Idb:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def user_line
def user_exception
def in_rpc_code
def canonic
def reset
def trace_dispatch
def dispatch_line
def dispatch_call
def dispatch_return
def dispatch_exception
def is_skipped_module
def stop_here
def break_here
def do_clear
def break_anywhere
def user_call
def user_return
def set_until
def set_step
def set_next
def set_return
def set_trace
def set_continue
def set_quit
def set_break
def clear_break
def clear_bpbynumber
def clear_all_file_breaks
def clear_all_breaks
def get_bpbynumber
def get_break
def get_breaks
def get_file_breaks
def get_all_breaks
def get_stack
def format_stack_entry
def run
def runeval
def runctx
def runcall

Public Attributes

 gui
 skip
 breaks
 fncache
 botframe
 stoplineno
 currentbp
 stopframe
 returnframe
 quitting

Private Member Functions

def __frame2message

Detailed Description

Definition at line 10 of file Debugger.py.


Constructor & Destructor Documentation

def idlelib.Debugger.Idb.__init__ (   self,
  gui 
)

Reimplemented from bdb.Bdb.

Definition at line 12 of file Debugger.py.

00012 
00013     def __init__(self, gui):
00014         self.gui = gui
00015         bdb.Bdb.__init__(self)

Here is the caller graph for this function:


Member Function Documentation

def idlelib.Debugger.Idb.__frame2message (   self,
  frame 
) [private]

Definition at line 40 of file Debugger.py.

00040 
00041     def __frame2message(self, frame):
00042         code = frame.f_code
00043         filename = code.co_filename
00044         lineno = frame.f_lineno
00045         basename = os.path.basename(filename)
00046         message = "%s:%s" % (basename, lineno)
00047         if code.co_name != "?":
00048             message = "%s: %s()" % (message, code.co_name)
00049         return message
00050 

Here is the caller graph for this function:

def bdb.Bdb.break_anywhere (   self,
  frame 
) [inherited]

Definition at line 144 of file bdb.py.

00144 
00145     def break_anywhere(self, frame):
00146         return self.canonic(frame.f_code.co_filename) in self.breaks

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.break_here (   self,
  frame 
) [inherited]

Definition at line 119 of file bdb.py.

00119 
00120     def break_here(self, frame):
00121         filename = self.canonic(frame.f_code.co_filename)
00122         if filename not in self.breaks:
00123             return False
00124         lineno = frame.f_lineno
00125         if lineno not in self.breaks[filename]:
00126             # The line itself has no breakpoint, but maybe the line is the
00127             # first line of a function with breakpoint set by function name.
00128             lineno = frame.f_code.co_firstlineno
00129             if lineno not in self.breaks[filename]:
00130                 return False
00131 
00132         # flag says ok to delete temp. bp
00133         (bp, flag) = effective(filename, lineno, frame)
00134         if bp:
00135             self.currentbp = bp.number
00136             if (flag and bp.temporary):
00137                 self.do_clear(str(bp.number))
00138             return True
00139         else:
00140             return False

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.canonic (   self,
  filename 
) [inherited]

Definition at line 26 of file bdb.py.

00026 
00027     def canonic(self, filename):
00028         if filename == "<" + filename[1:-1] + ">":
00029             return filename
00030         canonic = self.fncache.get(filename)
00031         if not canonic:
00032             canonic = os.path.abspath(filename)
00033             canonic = os.path.normcase(canonic)
00034             self.fncache[filename] = canonic
00035         return canonic

Here is the caller graph for this function:

def bdb.Bdb.clear_all_breaks (   self) [inherited]

Definition at line 286 of file bdb.py.

00286 
00287     def clear_all_breaks(self):
00288         if not self.breaks:
00289             return 'There are no breakpoints'
00290         for bp in Breakpoint.bpbynumber:
00291             if bp:
00292                 bp.deleteMe()
00293         self.breaks = {}

Here is the caller graph for this function:

def bdb.Bdb.clear_all_file_breaks (   self,
  filename 
) [inherited]

Definition at line 276 of file bdb.py.

00276 
00277     def clear_all_file_breaks(self, filename):
00278         filename = self.canonic(filename)
00279         if filename not in self.breaks:
00280             return 'There are no breakpoints in %s' % filename
00281         for line in self.breaks[filename]:
00282             blist = Breakpoint.bplist[filename, line]
00283             for bp in blist:
00284                 bp.deleteMe()
00285         del self.breaks[filename]

Here is the call graph for this function:

def bdb.Bdb.clear_bpbynumber (   self,
  arg 
) [inherited]

Definition at line 268 of file bdb.py.

00268 
00269     def clear_bpbynumber(self, arg):
00270         try:
00271             bp = self.get_bpbynumber(arg)
00272         except ValueError as err:
00273             return str(err)
00274         bp.deleteMe()
00275         self._prune_breaks(bp.file, bp.line)

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.clear_break (   self,
  filename,
  lineno 
) [inherited]

Definition at line 256 of file bdb.py.

00256 
00257     def clear_break(self, filename, lineno):
00258         filename = self.canonic(filename)
00259         if filename not in self.breaks:
00260             return 'There are no breakpoints in %s' % filename
00261         if lineno not in self.breaks[filename]:
00262             return 'There is no breakpoint at %s:%d' % (filename, lineno)
00263         # If there's only one bp in the list for that file,line
00264         # pair, then remove the breaks entry
00265         for bp in Breakpoint.bplist[filename, lineno][:]:
00266             bp.deleteMe()
00267         self._prune_breaks(filename, lineno)

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.dispatch_call (   self,
  frame,
  arg 
) [inherited]

Definition at line 68 of file bdb.py.

00068 
00069     def dispatch_call(self, frame, arg):
00070         # XXX 'arg' is no longer used
00071         if self.botframe is None:
00072             # First call of dispatch since reset()
00073             self.botframe = frame.f_back # (CT) Note that this may also be None!
00074             return self.trace_dispatch
00075         if not (self.stop_here(frame) or self.break_anywhere(frame)):
00076             # No need to trace this function
00077             return # None
00078         self.user_call(frame, arg)
00079         if self.quitting: raise BdbQuit
00080         return self.trace_dispatch

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.dispatch_exception (   self,
  frame,
  arg 
) [inherited]

Definition at line 87 of file bdb.py.

00087 
00088     def dispatch_exception(self, frame, arg):
00089         if self.stop_here(frame):
00090             self.user_exception(frame, arg)
00091             if self.quitting: raise BdbQuit
00092         return self.trace_dispatch

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.dispatch_line (   self,
  frame 
) [inherited]

Definition at line 62 of file bdb.py.

00062 
00063     def dispatch_line(self, frame):
00064         if self.stop_here(frame) or self.break_here(frame):
00065             self.user_line(frame)
00066             if self.quitting: raise BdbQuit
00067         return self.trace_dispatch

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.dispatch_return (   self,
  frame,
  arg 
) [inherited]

Definition at line 81 of file bdb.py.

00081 
00082     def dispatch_return(self, frame, arg):
00083         if self.stop_here(frame) or frame == self.returnframe:
00084             self.user_return(frame, arg)
00085             if self.quitting: raise BdbQuit
00086         return self.trace_dispatch

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.do_clear (   self,
  arg 
) [inherited]

Reimplemented in pdb.Pdb.

Definition at line 141 of file bdb.py.

00141 
00142     def do_clear(self, arg):
00143         raise NotImplementedError("subclass of bdb must implement do_clear()")

def bdb.Bdb.format_stack_entry (   self,
  frame_lineno,
  lprefix = ': ' 
) [inherited]

Definition at line 351 of file bdb.py.

00351 
00352     def format_stack_entry(self, frame_lineno, lprefix=': '):
00353         import linecache, reprlib
00354         frame, lineno = frame_lineno
00355         filename = self.canonic(frame.f_code.co_filename)
00356         s = '%s(%r)' % (filename, lineno)
00357         if frame.f_code.co_name:
00358             s += frame.f_code.co_name
00359         else:
00360             s += "<lambda>"
00361         if '__args__' in frame.f_locals:
00362             args = frame.f_locals['__args__']
00363         else:
00364             args = None
00365         if args:
00366             s += reprlib.repr(args)
00367         else:
00368             s += '()'
00369         if '__return__' in frame.f_locals:
00370             rv = frame.f_locals['__return__']
00371             s += '->'
00372             s += reprlib.repr(rv)
00373         line = linecache.getline(filename, lineno, frame.f_globals)
00374         if line:
00375             s += lprefix + line.strip()
00376         return s

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.get_all_breaks (   self) [inherited]

Definition at line 327 of file bdb.py.

00327 
00328     def get_all_breaks(self):
00329         return self.breaks

def bdb.Bdb.get_bpbynumber (   self,
  arg 
) [inherited]

Definition at line 294 of file bdb.py.

00294 
00295     def get_bpbynumber(self, arg):
00296         if not arg:
00297             raise ValueError('Breakpoint number expected')
00298         try:
00299             number = int(arg)
00300         except ValueError:
00301             raise ValueError('Non-numeric breakpoint number %s' % arg)
00302         try:
00303             bp = Breakpoint.bpbynumber[number]
00304         except IndexError:
00305             raise ValueError('Breakpoint number %d out of range' % number)
00306         if bp is None:
00307             raise ValueError('Breakpoint %d already deleted' % number)
00308         return bp

Here is the caller graph for this function:

def bdb.Bdb.get_break (   self,
  filename,
  lineno 
) [inherited]

Definition at line 309 of file bdb.py.

00309 
00310     def get_break(self, filename, lineno):
00311         filename = self.canonic(filename)
00312         return filename in self.breaks and \
00313             lineno in self.breaks[filename]

Here is the call graph for this function:

def bdb.Bdb.get_breaks (   self,
  filename,
  lineno 
) [inherited]

Definition at line 314 of file bdb.py.

00314 
00315     def get_breaks(self, filename, lineno):
00316         filename = self.canonic(filename)
00317         return filename in self.breaks and \
00318             lineno in self.breaks[filename] and \
00319             Breakpoint.bplist[filename, lineno] or []

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.get_file_breaks (   self,
  filename 
) [inherited]

Definition at line 320 of file bdb.py.

00320 
00321     def get_file_breaks(self, filename):
00322         filename = self.canonic(filename)
00323         if filename in self.breaks:
00324             return self.breaks[filename]
00325         else:
00326             return []

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.get_stack (   self,
  f,
  t 
) [inherited]

Definition at line 333 of file bdb.py.

00333 
00334     def get_stack(self, f, t):
00335         stack = []
00336         if t and t.tb_frame is f:
00337             t = t.tb_next
00338         while f is not None:
00339             stack.append((f, f.f_lineno))
00340             if f is self.botframe:
00341                 break
00342             f = f.f_back
00343         stack.reverse()
00344         i = max(0, len(stack) - 1)
00345         while t is not None:
00346             stack.append((t.tb_frame, t.tb_lineno))
00347             t = t.tb_next
00348         if f is None:
00349             i = max(0, len(stack) - 1)
00350         return stack, i

Here is the caller graph for this function:

def idlelib.Debugger.Idb.in_rpc_code (   self,
  frame 
)

Definition at line 30 of file Debugger.py.

00030 
00031     def in_rpc_code(self, frame):
00032         if frame.f_code.co_filename.count('rpc.py'):
00033             return True
00034         else:
00035             prev_frame = frame.f_back
00036             if prev_frame.f_code.co_filename.count('Debugger.py'):
00037                 # (that test will catch both Debugger.py and RemoteDebugger.py)
00038                 return False
00039             return self.in_rpc_code(prev_frame)

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.is_skipped_module (   self,
  module_name 
) [inherited]

Definition at line 97 of file bdb.py.

00097 
00098     def is_skipped_module(self, module_name):
00099         for pattern in self.skip:
00100             if fnmatch.fnmatch(module_name, pattern):
00101                 return True
00102         return False

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.reset (   self) [inherited]

Reimplemented in pdb.Pdb.

Definition at line 36 of file bdb.py.

00036 
00037     def reset(self):
00038         import linecache
00039         linecache.checkcache()
00040         self.botframe = None
00041         self._set_stopinfo(None, None)

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.run (   self,
  cmd,
  globals = None,
  locals = None 
) [inherited]

Definition at line 381 of file bdb.py.

00381 
00382     def run(self, cmd, globals=None, locals=None):
00383         if globals is None:
00384             import __main__
00385             globals = __main__.__dict__
00386         if locals is None:
00387             locals = globals
00388         self.reset()
00389         if isinstance(cmd, str):
00390             cmd = compile(cmd, "<string>", "exec")
00391         sys.settrace(self.trace_dispatch)
00392         try:
00393             exec(cmd, globals, locals)
00394         except BdbQuit:
00395             pass
00396         finally:
00397             self.quitting = True
00398             sys.settrace(None)

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.runcall (   self,
  func,
  args,
  kwds 
) [inherited]

Definition at line 421 of file bdb.py.

00421 
00422     def runcall(self, func, *args, **kwds):
00423         self.reset()
00424         sys.settrace(self.trace_dispatch)
00425         res = None
00426         try:
00427             res = func(*args, **kwds)
00428         except BdbQuit:
00429             pass
00430         finally:
00431             self.quitting = True
00432             sys.settrace(None)
00433         return res
00434 

Here is the call graph for this function:

def bdb.Bdb.runctx (   self,
  cmd,
  globals,
  locals 
) [inherited]

Definition at line 415 of file bdb.py.

00415 
00416     def runctx(self, cmd, globals, locals):
00417         # B/W compatibility
00418         self.run(cmd, globals, locals)

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.runeval (   self,
  expr,
  globals = None,
  locals = None 
) [inherited]

Definition at line 399 of file bdb.py.

00399 
00400     def runeval(self, expr, globals=None, locals=None):
00401         if globals is None:
00402             import __main__
00403             globals = __main__.__dict__
00404         if locals is None:
00405             locals = globals
00406         self.reset()
00407         sys.settrace(self.trace_dispatch)
00408         try:
00409             return eval(expr, globals, locals)
00410         except BdbQuit:
00411             pass
00412         finally:
00413             self.quitting = True
00414             sys.settrace(None)

Here is the call graph for this function:

def bdb.Bdb.set_break (   self,
  filename,
  lineno,
  temporary = False,
  cond = None,
  funcname = None 
) [inherited]

Definition at line 239 of file bdb.py.

00239 
00240                   funcname=None):
00241         filename = self.canonic(filename)
00242         import linecache # Import as late as possible
00243         line = linecache.getline(filename, lineno)
00244         if not line:
00245             return 'Line %s:%d does not exist' % (filename, lineno)
00246         list = self.breaks.setdefault(filename, [])
00247         if lineno not in list:
00248             list.append(lineno)
00249         bp = Breakpoint(filename, lineno, temporary, cond, funcname)

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.set_continue (   self) [inherited]

Reimplemented in doctest._OutputRedirectingPdb.

Definition at line 214 of file bdb.py.

00214 
00215     def set_continue(self):
00216         # Don't stop except at breakpoints or when finished
00217         self._set_stopinfo(self.botframe, None, -1)
00218         if not self.breaks:
00219             # no breakpoints; run without debugger overhead
00220             sys.settrace(None)
00221             frame = sys._getframe().f_back
00222             while frame and frame is not self.botframe:
00223                 del frame.f_trace
00224                 frame = frame.f_back

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.set_next (   self,
  frame 
) [inherited]
Stop on the next line in or below the given frame.

Definition at line 191 of file bdb.py.

00191 
00192     def set_next(self, frame):
00193         """Stop on the next line in or below the given frame."""
00194         self._set_stopinfo(frame, None)

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.set_quit (   self) [inherited]

Definition at line 225 of file bdb.py.

00225 
00226     def set_quit(self):
00227         self.stopframe = self.botframe
00228         self.returnframe = None
00229         self.quitting = True
00230         sys.settrace(None)

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.set_return (   self,
  frame 
) [inherited]
Stop when returning from the given frame.

Definition at line 195 of file bdb.py.

00195 
00196     def set_return(self, frame):
00197         """Stop when returning from the given frame."""
00198         self._set_stopinfo(frame.f_back, frame)

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.set_step (   self) [inherited]
Stop after one line of code.

Definition at line 187 of file bdb.py.

00187 
00188     def set_step(self):
00189         """Stop after one line of code."""
00190         self._set_stopinfo(None, None)

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.set_trace (   self,
  frame = None 
) [inherited]
Start debugging from `frame`.

If frame is not specified, debugging starts from caller's frame.

Reimplemented in doctest._OutputRedirectingPdb.

Definition at line 199 of file bdb.py.

00199 
00200     def set_trace(self, frame=None):
00201         """Start debugging from `frame`.
00202 
00203         If frame is not specified, debugging starts from caller's frame.
00204         """
00205         if frame is None:
00206             frame = sys._getframe().f_back
00207         self.reset()
00208         while frame:
00209             frame.f_trace = self.trace_dispatch
00210             self.botframe = frame
00211             frame = frame.f_back
00212         self.set_step()
00213         sys.settrace(self.trace_dispatch)

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.set_until (   self,
  frame,
  lineno = None 
) [inherited]
Stop when the line with the line no greater than the current one is
reached or when returning from current frame

Definition at line 179 of file bdb.py.

00179 
00180     def set_until(self, frame, lineno=None):
00181         """Stop when the line with the line no greater than the current one is
00182         reached or when returning from current frame"""
00183         # the name "until" is borrowed from gdb
00184         if lineno is None:
00185             lineno = frame.f_lineno + 1
00186         self._set_stopinfo(frame, frame, lineno)

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.stop_here (   self,
  frame 
) [inherited]

Definition at line 103 of file bdb.py.

00103 
00104     def stop_here(self, frame):
00105         # (CT) stopframe may now also be None, see dispatch_call.
00106         # (CT) the former test for None is therefore removed from here.
00107         if self.skip and \
00108                self.is_skipped_module(frame.f_globals.get('__name__')):
00109             return False
00110         if frame is self.stopframe:
00111             if self.stoplineno == -1:
00112                 return False
00113             return frame.f_lineno >= self.stoplineno
00114         while frame is not None and frame is not self.stopframe:
00115             if frame is self.botframe:
00116                 return True
00117             frame = frame.f_back
00118         return False

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.trace_dispatch (   self,
  frame,
  event,
  arg 
) [inherited]

Definition at line 42 of file bdb.py.

00042 
00043     def trace_dispatch(self, frame, event, arg):
00044         if self.quitting:
00045             return # None
00046         if event == 'line':
00047             return self.dispatch_line(frame)
00048         if event == 'call':
00049             return self.dispatch_call(frame, arg)
00050         if event == 'return':
00051             return self.dispatch_return(frame, arg)
00052         if event == 'exception':
00053             return self.dispatch_exception(frame, arg)
00054         if event == 'c_call':
00055             return self.trace_dispatch
00056         if event == 'c_exception':
00057             return self.trace_dispatch
00058         if event == 'c_return':
00059             return self.trace_dispatch
00060         print('bdb.Bdb.dispatch: unknown debugging event:', repr(event))
00061         return self.trace_dispatch

Here is the call graph for this function:

Here is the caller graph for this function:

def bdb.Bdb.user_call (   self,
  frame,
  argument_list 
) [inherited]
This method is called when there is the remote possibility
that we ever need to stop in this function.

Reimplemented in bdb.Tdb, and pdb.Pdb.

Definition at line 150 of file bdb.py.

00150 
00151     def user_call(self, frame, argument_list):
00152         """This method is called when there is the remote possibility
00153         that we ever need to stop in this function."""
00154         pass

Here is the caller graph for this function:

def idlelib.Debugger.Idb.user_exception (   self,
  frame,
  exc_info 
)
This method is called if an exception occurs,
but only if we are to stop at or just below this level.

Reimplemented from bdb.Bdb.

Definition at line 23 of file Debugger.py.

00023 
00024     def user_exception(self, frame, info):
00025         if self.in_rpc_code(frame):
00026             self.set_step()
00027             return
00028         message = self.__frame2message(frame)
00029         self.gui.interaction(message, frame, info)

Here is the call graph for this function:

def idlelib.Debugger.Idb.user_line (   self,
  frame 
)
This method is called when we stop or break at this line.

Reimplemented from bdb.Bdb.

Definition at line 16 of file Debugger.py.

00016 
00017     def user_line(self, frame):
00018         if self.in_rpc_code(frame):
00019             self.set_step()
00020             return
00021         message = self.__frame2message(frame)
00022         self.gui.interaction(message, frame)

Here is the call graph for this function:

def bdb.Bdb.user_return (   self,
  frame,
  return_value 
) [inherited]
This method is called when a return trap is set here.

Reimplemented in bdb.Tdb, and pdb.Pdb.

Definition at line 159 of file bdb.py.

00159 
00160     def user_return(self, frame, return_value):
00161         """This method is called when a return trap is set here."""
00162         pass

Here is the caller graph for this function:


Member Data Documentation

bdb.Bdb.botframe [inherited]

Definition at line 39 of file bdb.py.

bdb.Bdb.breaks [inherited]

Definition at line 23 of file bdb.py.

bdb.Bdb.currentbp [inherited]

Reimplemented in pdb.Pdb.

Definition at line 134 of file bdb.py.

bdb.Bdb.fncache [inherited]

Definition at line 24 of file bdb.py.

Definition at line 13 of file Debugger.py.

bdb.Bdb.quitting [inherited]

Definition at line 171 of file bdb.py.

bdb.Bdb.returnframe [inherited]

Definition at line 170 of file bdb.py.

bdb.Bdb.skip [inherited]

Definition at line 22 of file bdb.py.

bdb.Bdb.stopframe [inherited]

Definition at line 169 of file bdb.py.

bdb.Bdb.stoplineno [inherited]

Definition at line 110 of file bdb.py.


The documentation for this class was generated from the following file: