Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes
pdb.Pdb Class Reference
Inheritance diagram for pdb.Pdb:
Inheritance graph
[legend]
Collaboration diagram for pdb.Pdb:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def sigint_handler
def reset
def forget
def setup
def execRcLines
def user_call
def user_line
def bp_commands
def user_return
def user_exception
def preloop
def interaction
def displayhook
def default
def precmd
def onecmd
def handle_command_def
def message
def error
def do_commands
def do_break
def defaultFile
def do_tbreak
def lineinfo
def checkline
def do_enable
def do_disable
def do_condition
def do_ignore
def do_clear
def do_where
def do_up
def do_down
def do_until
def do_step
def do_next
def do_run
def do_return
def do_continue
def do_jump
def do_debug
def do_quit
def do_EOF
def do_args
def do_retval
def do_p
def do_pp
def do_list
def do_longlist
def do_source
def do_whatis
def do_display
def do_undisplay
def do_interact
def do_alias
def do_unalias
def print_stack_trace
def print_stack_entry
def do_help
def help_exec
def help_pdb
def lookupmodule
def canonic
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 break_anywhere
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
def cmdloop
def postcmd
def postloop
def parseline
def emptyline
def completedefault
def completenames
def complete
def get_names
def complete_help
def print_topics
def columnize

Public Attributes

 use_rawinput
 prompt
 aliases
 displaying
 mainpyfile
 tb_lineno
 allow_kbdint
 nosigint
 rcLines
 commands
 commands_doprompt
 commands_silent
 commands_defining
 commands_bnum
 lineno
 stack
 curindex
 curframe
 curframe_locals
 currentbp
 lastcmd
 cmdqueue
 skip
 breaks
 fncache
 botframe
 stoplineno
 stopframe
 returnframe
 quitting
 stdin
 stdout
 completekey
 old_completer
 completion_matches

Static Public Attributes

 do_b = do_break
 do_cl = do_clear
 do_w = do_where
 do_bt = do_where
 do_u = do_up
 do_d = do_down
 do_unt = do_until
 do_s = do_step
 do_n = do_next
 do_restart = do_run
 do_r = do_return
 do_c = do_contdo_continue
 do_j = do_jump
 do_q = do_quit
 do_exit = do_quit
 do_a = do_args
 do_rv = do_retval
 do_print = do_p
 do_l = do_list
 do_ll = do_longlist
list commands_resuming
 do_h = do_help
 identchars = IDENTCHARS
string ruler = '='
 intro = None
string doc_leader = ""
string doc_header = "Documented commands (type help <topic>):"
string misc_header = "Miscellaneous help topics:"
string undoc_header = "Undocumented commands:"
string nohelp = "*** No help on %s"

Private Member Functions

def _cmdloop
def _select_frame
def _getval
def _getval_except
def _print_lines
def _runscript

Private Attributes

 _wait_for_mainpyfile
 _previous_sigint_handler
 _user_requested_quit

Detailed Description

Definition at line 141 of file pdb.py.


Constructor & Destructor Documentation

def pdb.Pdb.__init__ (   self,
  completekey = 'tab',
  stdin = None,
  stdout = None,
  skip = None,
  nosigint = False 
)

Definition at line 144 of file pdb.py.

00144 
00145                  nosigint=False):
00146         bdb.Bdb.__init__(self, skip=skip)
00147         cmd.Cmd.__init__(self, completekey, stdin, stdout)
00148         if stdout:
00149             self.use_rawinput = 0
00150         self.prompt = '(Pdb) '
00151         self.aliases = {}
00152         self.displaying = {}
00153         self.mainpyfile = ''
00154         self._wait_for_mainpyfile = False
00155         self.tb_lineno = {}
00156         # Try to load readline if it exists
00157         try:
00158             import readline
00159         except ImportError:
00160             pass
00161         self.allow_kbdint = False
00162         self.nosigint = nosigint
00163 
00164         # Read $HOME/.pdbrc and ./.pdbrc
00165         self.rcLines = []
00166         if 'HOME' in os.environ:
00167             envHome = os.environ['HOME']
00168             try:
00169                 with open(os.path.join(envHome, ".pdbrc")) as rcFile:
00170                     self.rcLines.extend(rcFile)
00171             except IOError:
00172                 pass
00173         try:
00174             with open(".pdbrc") as rcFile:
00175                 self.rcLines.extend(rcFile)
00176         except IOError:
00177             pass
00178 
00179         self.commands = {} # associates a command list to breakpoint numbers
00180         self.commands_doprompt = {} # for each bp num, tells if the prompt
00181                                     # must be disp. after execing the cmd list
00182         self.commands_silent = {} # for each bp num, tells if the stack trace
00183                                   # must be disp. after execing the cmd list
00184         self.commands_defining = False # True while in the process of defining
00185                                        # a command list
00186         self.commands_bnum = None # The breakpoint number for which we are
00187                                   # defining a list

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

def pdb.Pdb._cmdloop (   self) [private]

Definition at line 309 of file pdb.py.

00309 
00310     def _cmdloop(self):
00311         while True:
00312             try:
00313                 # keyboard interrupts allow for an easy way to cancel
00314                 # the current command, so allow them during interactive input
00315                 self.allow_kbdint = True
00316                 self.cmdloop()
00317                 self.allow_kbdint = False
00318                 break
00319             except KeyboardInterrupt:
00320                 self.message('--KeyboardInterrupt--')

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb._getval (   self,
  arg 
) [private]

Definition at line 1057 of file pdb.py.

01057 
01058     def _getval(self, arg):
01059         try:
01060             return eval(arg, self.curframe.f_globals, self.curframe_locals)
01061         except:
01062             exc_info = sys.exc_info()[:2]
01063             self.error(traceback.format_exception_only(*exc_info)[-1].strip())
01064             raise

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb._getval_except (   self,
  arg,
  frame = None 
) [private]

Definition at line 1065 of file pdb.py.

01065 
01066     def _getval_except(self, arg, frame=None):
01067         try:
01068             if frame is None:
01069                 return eval(arg, self.curframe.f_globals, self.curframe_locals)
01070             else:
01071                 return eval(arg, frame.f_globals, frame.f_locals)
01072         except:
01073             exc_info = sys.exc_info()[:2]
01074             err = traceback.format_exception_only(*exc_info)[-1].strip()
01075             return _rstr('** raised %s **' % err)

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb._print_lines (   self,
  lines,
  start,
  breaks = (),
  frame = None 
) [private]
Print a range of lines.

Definition at line 1176 of file pdb.py.

01176 
01177     def _print_lines(self, lines, start, breaks=(), frame=None):
01178         """Print a range of lines."""
01179         if frame:
01180             current_lineno = frame.f_lineno
01181             exc_lineno = self.tb_lineno.get(frame, -1)
01182         else:
01183             current_lineno = exc_lineno = -1
01184         for lineno, line in enumerate(lines, start):
01185             s = str(lineno).rjust(3)
01186             if len(s) < 4:
01187                 s += ' '
01188             if lineno in breaks:
01189                 s += 'B'
01190             else:
01191                 s += ' '
01192             if lineno == current_lineno:
01193                 s += '->'
01194             elif lineno == exc_lineno:
01195                 s += '>>'
01196             self.message(s + '\t' + line.rstrip())

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb._runscript (   self,
  filename 
) [private]

Definition at line 1413 of file pdb.py.

01413 
01414     def _runscript(self, filename):
01415         # The script has to run in __main__ namespace (or imports from
01416         # __main__ will break).
01417         #
01418         # So we clear up the __main__ and set several special variables
01419         # (this gets rid of pdb's globals and cleans old variables on restarts).
01420         import __main__
01421         __main__.__dict__.clear()
01422         __main__.__dict__.update({"__name__"    : "__main__",
01423                                   "__file__"    : filename,
01424                                   "__builtins__": __builtins__,
01425                                  })
01426 
01427         # When bdb sets tracing, a number of call and line events happens
01428         # BEFORE debugger even reaches user's code (and the exact sequence of
01429         # events depends on python version). So we take special measures to
01430         # avoid stopping before we reach the main script (see user_line and
01431         # user_call for details).
01432         self._wait_for_mainpyfile = True
01433         self.mainpyfile = self.canonic(filename)
01434         self._user_requested_quit = False
01435         with open(filename, "rb") as fp:
01436             statement = "exec(compile(%r, %r, 'exec'))" % \
01437                         (fp.read(), self.mainpyfile)
01438         self.run(statement)
01439 
01440 # Collect all command help into docstring, if not run with -OO

Here is the call graph for this function:

def pdb.Pdb._select_frame (   self,
  number 
) [private]

Definition at line 837 of file pdb.py.

00837 
00838     def _select_frame(self, number):
00839         assert 0 <= number < len(self.stack)
00840         self.curindex = number
00841         self.curframe = self.stack[self.curindex][0]
00842         self.curframe_locals = self.curframe.f_locals
00843         self.print_stack_entry(self.stack[self.curindex])
00844         self.lineno = None

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb.bp_commands (   self,
  frame 
)
Call every command that was set for the current active breakpoint
(if there is one).

Returns True if the normal interaction function must be called,
False otherwise.

Definition at line 265 of file pdb.py.

00265 
00266     def bp_commands(self, frame):
00267         """Call every command that was set for the current active breakpoint
00268         (if there is one).
00269 
00270         Returns True if the normal interaction function must be called,
00271         False otherwise."""
00272         # self.currentbp is set in bdb in Bdb.break_here if a breakpoint was hit
00273         if getattr(self, "currentbp", False) and \
00274                self.currentbp in self.commands:
00275             currentbp = self.currentbp
00276             self.currentbp = 0
00277             lastcmd_back = self.lastcmd
00278             self.setup(frame, None)
00279             for line in self.commands[currentbp]:
00280                 self.onecmd(line)
00281             self.lastcmd = lastcmd_back
00282             if not self.commands_silent[currentbp]:
00283                 self.print_stack_entry(self.stack[self.curindex])
00284             if self.commands_doprompt[currentbp]:
00285                 self._cmdloop()
00286             self.forget()
00287             return
00288         return 1

Here is the call graph for this function:

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 pdb.Pdb.checkline (   self,
  filename,
  lineno 
)
Check whether specified line seems to be executable.

Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
line or EOF). Warning: testing is not comprehensive.

Definition at line 671 of file pdb.py.

00671 
00672     def checkline(self, filename, lineno):
00673         """Check whether specified line seems to be executable.
00674 
00675         Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
00676         line or EOF). Warning: testing is not comprehensive.
00677         """
00678         # this method should be callable before starting debugging, so default
00679         # to "no globals" if there is no current frame
00680         globs = self.curframe.f_globals if hasattr(self, 'curframe') else None
00681         line = linecache.getline(filename, lineno, globs)
00682         if not line:
00683             self.message('End of file')
00684             return 0
00685         line = line.strip()
00686         # Don't allow setting breakpoint at a blank line
00687         if (not line or (line[0] == '#') or
00688              (line[:3] == '"""') or line[:3] == "'''"):
00689             self.error('Blank or comment')
00690             return 0
00691         return lineno

Here is the call graph for this function:

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 cmd.Cmd.cmdloop (   self,
  intro = None 
) [inherited]
Repeatedly issue a prompt, accept input, parse an initial prefix
off the received input, and dispatch to action methods, passing them
the remainder of the line as argument.

Definition at line 98 of file cmd.py.

00098 
00099     def cmdloop(self, intro=None):
00100         """Repeatedly issue a prompt, accept input, parse an initial prefix
00101         off the received input, and dispatch to action methods, passing them
00102         the remainder of the line as argument.
00103 
00104         """
00105 
00106         self.preloop()
00107         if self.use_rawinput and self.completekey:
00108             try:
00109                 import readline
00110                 self.old_completer = readline.get_completer()
00111                 readline.set_completer(self.complete)
00112                 readline.parse_and_bind(self.completekey+": complete")
00113             except ImportError:
00114                 pass
00115         try:
00116             if intro is not None:
00117                 self.intro = intro
00118             if self.intro:
00119                 self.stdout.write(str(self.intro)+"\n")
00120             stop = None
00121             while not stop:
00122                 if self.cmdqueue:
00123                     line = self.cmdqueue.pop(0)
00124                 else:
00125                     if self.use_rawinput:
00126                         try:
00127                             line = input(self.prompt)
00128                         except EOFError:
00129                             line = 'EOF'
00130                     else:
00131                         self.stdout.write(self.prompt)
00132                         self.stdout.flush()
00133                         line = self.stdin.readline()
00134                         if not len(line):
00135                             line = 'EOF'
00136                         else:
00137                             line = line.rstrip('\r\n')
00138                 line = self.precmd(line)
00139                 stop = self.onecmd(line)
00140                 stop = self.postcmd(stop, line)
00141             self.postloop()
00142         finally:
00143             if self.use_rawinput and self.completekey:
00144                 try:
00145                     import readline
00146                     readline.set_completer(self.old_completer)
00147                 except ImportError:
00148                     pass
00149 

Here is the call graph for this function:

Here is the caller graph for this function:

def cmd.Cmd.columnize (   self,
  list,
  displaywidth = 80 
) [inherited]
Display a list of strings as a compact set of columns.

Each column is only as wide as necessary.
Columns are separated by two spaces (one was not legible enough).

Definition at line 344 of file cmd.py.

00344 
00345     def columnize(self, list, displaywidth=80):
00346         """Display a list of strings as a compact set of columns.
00347 
00348         Each column is only as wide as necessary.
00349         Columns are separated by two spaces (one was not legible enough).
00350         """
00351         if not list:
00352             self.stdout.write("<empty>\n")
00353             return
00354 
00355         nonstrings = [i for i in range(len(list))
00356                         if not isinstance(list[i], str)]
00357         if nonstrings:
00358             raise TypeError("list[i] not a string for i in %s"
00359                             % ", ".join(map(str, nonstrings)))
00360         size = len(list)
00361         if size == 1:
00362             self.stdout.write('%s\n'%str(list[0]))
00363             return
00364         # Try every row count from 1 upwards
00365         for nrows in range(1, len(list)):
00366             ncols = (size+nrows-1) // nrows
00367             colwidths = []
00368             totwidth = -2
00369             for col in range(ncols):
00370                 colwidth = 0
00371                 for row in range(nrows):
00372                     i = row + nrows*col
00373                     if i >= size:
00374                         break
00375                     x = list[i]
00376                     colwidth = max(colwidth, len(x))
00377                 colwidths.append(colwidth)
00378                 totwidth += colwidth + 2
00379                 if totwidth > displaywidth:
00380                     break
00381             if totwidth <= displaywidth:
00382                 break
00383         else:
00384             nrows = len(list)
00385             ncols = 1
00386             colwidths = [0]
00387         for row in range(nrows):
00388             texts = []
00389             for col in range(ncols):
00390                 i = row + nrows*col
00391                 if i >= size:
00392                     x = ""
00393                 else:
00394                     x = list[i]
00395                 texts.append(x)
00396             while texts and not texts[-1]:
00397                 del texts[-1]
00398             for col in range(len(texts)):
00399                 texts[col] = texts[col].ljust(colwidths[col])
00400             self.stdout.write("%s\n"%str("  ".join(texts)))

Here is the call graph for this function:

Here is the caller graph for this function:

def cmd.Cmd.complete (   self,
  text,
  state 
) [inherited]
Return the next possible completion for 'text'.

If a command has not been entered, then complete against command list.
Otherwise try to call complete_<command> to get list of completions.

Definition at line 249 of file cmd.py.

00249 
00250     def complete(self, text, state):
00251         """Return the next possible completion for 'text'.
00252 
00253         If a command has not been entered, then complete against command list.
00254         Otherwise try to call complete_<command> to get list of completions.
00255         """
00256         if state == 0:
00257             import readline
00258             origline = readline.get_line_buffer()
00259             line = origline.lstrip()
00260             stripped = len(origline) - len(line)
00261             begidx = readline.get_begidx() - stripped
00262             endidx = readline.get_endidx() - stripped
00263             if begidx>0:
00264                 cmd, args, foo = self.parseline(line)
00265                 if cmd == '':
00266                     compfunc = self.completedefault
00267                 else:
00268                     try:
00269                         compfunc = getattr(self, 'complete_' + cmd)
00270                     except AttributeError:
00271                         compfunc = self.completedefault
00272             else:
00273                 compfunc = self.completenames
00274             self.completion_matches = compfunc(text, line, begidx, endidx)
00275         try:
00276             return self.completion_matches[state]
00277         except IndexError:
00278             return None

Here is the call graph for this function:

def cmd.Cmd.complete_help (   self,
  args 
) [inherited]

Definition at line 284 of file cmd.py.

00284 
00285     def complete_help(self, *args):
00286         commands = set(self.completenames(*args))
00287         topics = set(a[5:] for a in self.get_names()
00288                      if a.startswith('help_' + args[0]))
00289         return list(commands | topics)

Here is the call graph for this function:

def cmd.Cmd.completedefault (   self,
  ignored 
) [inherited]
Method called to complete an input line when no command-specific
complete_*() method is available.

By default, it returns an empty list.

Reimplemented in test.test_cmd.samplecmdclass.

Definition at line 236 of file cmd.py.

00236 
00237     def completedefault(self, *ignored):
00238         """Method called to complete an input line when no command-specific
00239         complete_*() method is available.
00240 
00241         By default, it returns an empty list.
00242 
00243         """
00244         return []

Here is the caller graph for this function:

def cmd.Cmd.completenames (   self,
  text,
  ignored 
) [inherited]

Definition at line 245 of file cmd.py.

00245 
00246     def completenames(self, text, *ignored):
00247         dotext = 'do_'+text
00248         return [a[3:] for a in self.get_names() if a.startswith(dotext)]

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb.default (   self,
  line 
)
Called on an input line when the command prefix is not recognized.

If this method is not overridden, it prints an error message and
returns.

Reimplemented from cmd.Cmd.

Definition at line 353 of file pdb.py.

00353 
00354     def default(self, line):
00355         if line[:1] == '!': line = line[1:]
00356         locals = self.curframe_locals
00357         globals = self.curframe.f_globals
00358         try:
00359             code = compile(line + '\n', '<stdin>', 'single')
00360             save_stdout = sys.stdout
00361             save_stdin = sys.stdin
00362             save_displayhook = sys.displayhook
00363             try:
00364                 sys.stdin = self.stdin
00365                 sys.stdout = self.stdout
00366                 sys.displayhook = self.displayhook
00367                 exec(code, globals, locals)
00368             finally:
00369                 sys.stdout = save_stdout
00370                 sys.stdin = save_stdin
00371                 sys.displayhook = save_displayhook
00372         except:
00373             exc_info = sys.exc_info()[:2]
00374             self.error(traceback.format_exception_only(*exc_info)[-1].strip())

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb.defaultFile (   self)
Produce a reasonable default.

Definition at line 622 of file pdb.py.

00622 
00623     def defaultFile(self):
00624         """Produce a reasonable default."""
00625         filename = self.curframe.f_code.co_filename
00626         if filename == '<string>' and self.mainpyfile:
00627             filename = self.mainpyfile
00628         return filename

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 pdb.Pdb.displayhook (   self,
  obj 
)
Custom displayhook for the exec in default(), which prevents
assignment of the _ variable in the builtins.

Definition at line 345 of file pdb.py.

00345 
00346     def displayhook(self, obj):
00347         """Custom displayhook for the exec in default(), which prevents
00348         assignment of the _ variable in the builtins.
00349         """
00350         # reproduce the behavior of the standard displayhook, not printing None
00351         if obj is not None:
00352             self.message(repr(obj))

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb.do_alias (   self,
  arg 
)
alias [name [command [parameter parameter ...] ]]
Create an alias called 'name' that executes 'command'.  The
command must *not* be enclosed in quotes.  Replaceable
parameters can be indicated by %1, %2, and so on, while %* is
replaced by all the parameters.  If no command is given, the
current alias for name is shown. If no name is given, all
aliases are listed.

Aliases may be nested and can contain anything that can be
legally typed at the pdb prompt.  Note!  You *can* override
internal pdb commands with aliases!  Those internal commands
are then hidden until the alias is removed.  Aliasing is
recursively applied to the first word of the command line; all
other words in the line are left alone.

As an example, here are two useful aliases (especially when
placed in the .pdbrc file):

# Print instance variables (usage "pi classInst")
alias pi for k in %1.__dict__.keys(): print "%1.",k,"=",%1.__dict__[k]
# Print instance variables in self
alias ps pi self

Definition at line 1272 of file pdb.py.

01272 
01273     def do_alias(self, arg):
01274         """alias [name [command [parameter parameter ...] ]]
01275         Create an alias called 'name' that executes 'command'.  The
01276         command must *not* be enclosed in quotes.  Replaceable
01277         parameters can be indicated by %1, %2, and so on, while %* is
01278         replaced by all the parameters.  If no command is given, the
01279         current alias for name is shown. If no name is given, all
01280         aliases are listed.
01281 
01282         Aliases may be nested and can contain anything that can be
01283         legally typed at the pdb prompt.  Note!  You *can* override
01284         internal pdb commands with aliases!  Those internal commands
01285         are then hidden until the alias is removed.  Aliasing is
01286         recursively applied to the first word of the command line; all
01287         other words in the line are left alone.
01288 
01289         As an example, here are two useful aliases (especially when
01290         placed in the .pdbrc file):
01291 
01292         # Print instance variables (usage "pi classInst")
01293         alias pi for k in %1.__dict__.keys(): print "%1.",k,"=",%1.__dict__[k]
01294         # Print instance variables in self
01295         alias ps pi self
01296         """
01297         args = arg.split()
01298         if len(args) == 0:
01299             keys = sorted(self.aliases.keys())
01300             for alias in keys:
01301                 self.message("%s = %s" % (alias, self.aliases[alias]))
01302             return
01303         if args[0] in self.aliases and len(args) == 1:
01304             self.message("%s = %s" % (args[0], self.aliases[args[0]]))
01305         else:
01306             self.aliases[args[0]] = ' '.join(args[1:])

Here is the call graph for this function:

def pdb.Pdb.do_args (   self,
  arg 
)
a(rgs)
Print the argument list of the current function.

Definition at line 1030 of file pdb.py.

01030 
01031     def do_args(self, arg):
01032         """a(rgs)
01033         Print the argument list of the current function.
01034         """
01035         co = self.curframe.f_code
01036         dict = self.curframe_locals
01037         n = co.co_argcount
01038         if co.co_flags & 4: n = n+1
01039         if co.co_flags & 8: n = n+1
01040         for i in range(n):
01041             name = co.co_varnames[i]
01042             if name in dict:
01043                 self.message('%s = %r' % (name, dict[name]))
01044             else:
                self.message('%s = *** undefined ***' % (name,))

Here is the call graph for this function:

def pdb.Pdb.do_break (   self,
  arg,
  temporary = 0 
)
b(reak) [ ([filename:]lineno | function) [, condition] ]
Without argument, list all breaks.

With a line number argument, set a break at this line in the
current file.  With a function name, set a break at the first
executable line of that function.  If a second argument is
present, it is a string specifying an expression which must
evaluate to true before the breakpoint is honored.

The line number may be prefixed with a filename and a colon,
to specify a breakpoint in another file (probably one that
hasn't been loaded yet).  The file is searched for on
sys.path; the .py suffix may be omitted.

Definition at line 529 of file pdb.py.

00529 
00530     def do_break(self, arg, temporary = 0):
00531         """b(reak) [ ([filename:]lineno | function) [, condition] ]
00532         Without argument, list all breaks.
00533 
00534         With a line number argument, set a break at this line in the
00535         current file.  With a function name, set a break at the first
00536         executable line of that function.  If a second argument is
00537         present, it is a string specifying an expression which must
00538         evaluate to true before the breakpoint is honored.
00539 
00540         The line number may be prefixed with a filename and a colon,
00541         to specify a breakpoint in another file (probably one that
00542         hasn't been loaded yet).  The file is searched for on
00543         sys.path; the .py suffix may be omitted.
00544         """
00545         if not arg:
00546             if self.breaks:  # There's at least one
00547                 self.message("Num Type         Disp Enb   Where")
00548                 for bp in bdb.Breakpoint.bpbynumber:
00549                     if bp:
00550                         self.message(bp.bpformat())
00551             return
00552         # parse arguments; comma has lowest precedence
00553         # and cannot occur in filename
00554         filename = None
00555         lineno = None
00556         cond = None
00557         comma = arg.find(',')
00558         if comma > 0:
00559             # parse stuff after comma: "condition"
00560             cond = arg[comma+1:].lstrip()
00561             arg = arg[:comma].rstrip()
00562         # parse stuff before comma: [filename:]lineno | function
00563         colon = arg.rfind(':')
00564         funcname = None
00565         if colon >= 0:
00566             filename = arg[:colon].rstrip()
00567             f = self.lookupmodule(filename)
00568             if not f:
00569                 self.error('%r not found from sys.path' % filename)
00570                 return
00571             else:
00572                 filename = f
00573             arg = arg[colon+1:].lstrip()
00574             try:
00575                 lineno = int(arg)
00576             except ValueError:
00577                 self.error('Bad lineno: %s' % arg)
00578                 return
00579         else:
00580             # no colon; can be lineno or function
00581             try:
00582                 lineno = int(arg)
00583             except ValueError:
00584                 try:
00585                     func = eval(arg,
00586                                 self.curframe.f_globals,
00587                                 self.curframe_locals)
00588                 except:
00589                     func = arg
00590                 try:
00591                     if hasattr(func, '__func__'):
00592                         func = func.__func__
00593                     code = func.__code__
00594                     #use co_name to identify the bkpt (function names
00595                     #could be aliased, but co_name is invariant)
00596                     funcname = code.co_name
00597                     lineno = code.co_firstlineno
00598                     filename = code.co_filename
00599                 except:
00600                     # last thing to try
00601                     (ok, filename, ln) = self.lineinfo(arg)
00602                     if not ok:
00603                         self.error('The specified object %r is not a function '
00604                                    'or was not found along sys.path.' % arg)
00605                         return
00606                     funcname = ok # ok contains a function name
00607                     lineno = int(ln)
00608         if not filename:
00609             filename = self.defaultFile()
00610         # Check for reasonable breakpoint
00611         line = self.checkline(filename, lineno)
00612         if line:
00613             # now set the break point
00614             err = self.set_break(filename, line, temporary, cond, funcname)
00615             if err:
00616                 self.error(err, file=self.stdout)
00617             else:
00618                 bp = self.get_breaks(filename, line)[-1]
00619                 self.message("Breakpoint %d at %s:%d" %
00620                              (bp.number, bp.file, bp.line))

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb.do_clear (   self,
  arg 
)
cl(ear) filename:lineno\ncl(ear) [bpnumber [bpnumber...]]
With a space separated list of breakpoint numbers, clear
those breakpoints.  Without argument, clear all breaks (but
first ask confirmation).  With a filename:lineno argument,
clear all breaks at that line in that file.

Reimplemented from bdb.Bdb.

Definition at line 779 of file pdb.py.

00779 
00780     def do_clear(self, arg):
00781         """cl(ear) filename:lineno\ncl(ear) [bpnumber [bpnumber...]]
00782         With a space separated list of breakpoint numbers, clear
00783         those breakpoints.  Without argument, clear all breaks (but
00784         first ask confirmation).  With a filename:lineno argument,
00785         clear all breaks at that line in that file.
00786         """
00787         if not arg:
00788             try:
00789                 reply = input('Clear all breaks? ')
00790             except EOFError:
00791                 reply = 'no'
00792             reply = reply.strip().lower()
00793             if reply in ('y', 'yes'):
00794                 bplist = [bp for bp in bdb.Breakpoint.bpbynumber if bp]
00795                 self.clear_all_breaks()
00796                 for bp in bplist:
00797                     self.message('Deleted %s' % bp)
00798             return
00799         if ':' in arg:
00800             # Make sure it works for "clear C:\foo\bar.py:12"
00801             i = arg.rfind(':')
00802             filename = arg[:i]
00803             arg = arg[i+1:]
00804             try:
00805                 lineno = int(arg)
00806             except ValueError:
00807                 err = "Invalid line number (%s)" % arg
00808             else:
00809                 bplist = self.get_breaks(filename, lineno)
00810                 err = self.clear_break(filename, lineno)
00811             if err:
00812                 self.error(err)
00813             else:
00814                 for bp in bplist:
00815                     self.message('Deleted %s' % bp)
00816             return
00817         numberlist = arg.split()
00818         for i in numberlist:
00819             try:
00820                 bp = self.get_bpbynumber(i)
00821             except ValueError as err:
00822                 self.error(err)
00823             else:
00824                 self.clear_bpbynumber(i)
                self.message('Deleted %s' % bp)

Here is the call graph for this function:

def pdb.Pdb.do_commands (   self,
  arg 
)
commands [bpnumber]
(com) ...
(com) end
(Pdb)

Specify a list of commands for breakpoint number bpnumber.
The commands themselves are entered on the following lines.
Type a line containing just 'end' to terminate the commands.
The commands are executed when the breakpoint is hit.

To remove all commands from a breakpoint, type commands and
follow it immediately with end; that is, give no commands.

With no bpnumber argument, commands refers to the last
breakpoint set.

You can use breakpoint commands to start your program up
again.  Simply use the continue command, or step, or any other
command that resumes execution.

Specifying any command resuming execution (currently continue,
step, next, return, jump, quit and their abbreviations)
terminates the command list (as if that command was
immediately followed by end).  This is because any time you
resume execution (even with a simple next or step), you may
encounter another breakpoint -- which could have its own
command list, leading to ambiguities about which list to
execute.

If you use the 'silent' command in the command list, the usual
message about stopping at a breakpoint is not printed.  This
may be desirable for breakpoints that are to print a specific
message and then continue.  If none of the other commands
print anything, you will see no sign that the breakpoint was
reached.

Definition at line 452 of file pdb.py.

00452 
00453     def do_commands(self, arg):
00454         """commands [bpnumber]
00455         (com) ...
00456         (com) end
00457         (Pdb)
00458 
00459         Specify a list of commands for breakpoint number bpnumber.
00460         The commands themselves are entered on the following lines.
00461         Type a line containing just 'end' to terminate the commands.
00462         The commands are executed when the breakpoint is hit.
00463 
00464         To remove all commands from a breakpoint, type commands and
00465         follow it immediately with end; that is, give no commands.
00466 
00467         With no bpnumber argument, commands refers to the last
00468         breakpoint set.
00469 
00470         You can use breakpoint commands to start your program up
00471         again.  Simply use the continue command, or step, or any other
00472         command that resumes execution.
00473 
00474         Specifying any command resuming execution (currently continue,
00475         step, next, return, jump, quit and their abbreviations)
00476         terminates the command list (as if that command was
00477         immediately followed by end).  This is because any time you
00478         resume execution (even with a simple next or step), you may
00479         encounter another breakpoint -- which could have its own
00480         command list, leading to ambiguities about which list to
00481         execute.
00482 
00483         If you use the 'silent' command in the command list, the usual
00484         message about stopping at a breakpoint is not printed.  This
00485         may be desirable for breakpoints that are to print a specific
00486         message and then continue.  If none of the other commands
00487         print anything, you will see no sign that the breakpoint was
00488         reached.
00489         """
00490         if not arg:
00491             bnum = len(bdb.Breakpoint.bpbynumber) - 1
00492         else:
00493             try:
00494                 bnum = int(arg)
00495             except:
00496                 self.error("Usage: commands [bnum]\n        ...\n        end")
00497                 return
00498         self.commands_bnum = bnum
00499         # Save old definitions for the case of a keyboard interrupt.
00500         if bnum in self.commands:
00501             old_command_defs = (self.commands[bnum],
00502                                 self.commands_doprompt[bnum],
00503                                 self.commands_silent[bnum])
00504         else:
00505             old_command_defs = None
00506         self.commands[bnum] = []
00507         self.commands_doprompt[bnum] = True
00508         self.commands_silent[bnum] = False
00509 
00510         prompt_back = self.prompt
00511         self.prompt = '(com) '
00512         self.commands_defining = True
00513         try:
00514             self.cmdloop()
00515         except KeyboardInterrupt:
00516             # Restore old definitions.
00517             if old_command_defs:
00518                 self.commands[bnum] = old_command_defs[0]
00519                 self.commands_doprompt[bnum] = old_command_defs[1]
00520                 self.commands_silent[bnum] = old_command_defs[2]
00521             else:
00522                 del self.commands[bnum]
00523                 del self.commands_doprompt[bnum]
00524                 del self.commands_silent[bnum]
00525             self.error('command definition aborted, old commands restored')
00526         finally:
00527             self.commands_defining = False
00528             self.prompt = prompt_back

Here is the call graph for this function:

def pdb.Pdb.do_condition (   self,
  arg 
)
condition bpnumber [condition]
Set a new condition for the breakpoint, an expression which
must evaluate to true before the breakpoint is honored.  If
condition is absent, any existing condition is removed; i.e.,
the breakpoint is made unconditional.

Definition at line 725 of file pdb.py.

00725 
00726     def do_condition(self, arg):
00727         """condition bpnumber [condition]
00728         Set a new condition for the breakpoint, an expression which
00729         must evaluate to true before the breakpoint is honored.  If
00730         condition is absent, any existing condition is removed; i.e.,
00731         the breakpoint is made unconditional.
00732         """
00733         args = arg.split(' ', 1)
00734         try:
00735             cond = args[1]
00736         except IndexError:
00737             cond = None
00738         try:
00739             bp = self.get_bpbynumber(args[0].strip())
00740         except ValueError as err:
00741             self.error(err)
00742         else:
00743             bp.cond = cond
00744             if not cond:
00745                 self.message('Breakpoint %d is now unconditional.' % bp.number)
00746             else:
00747                 self.message('New condition set for breakpoint %d.' % bp.number)

Here is the call graph for this function:

def pdb.Pdb.do_continue (   self,
  arg 
)
c(ont(inue))
Continue execution, only stop when a breakpoint is encountered.

Definition at line 953 of file pdb.py.

00953 
00954     def do_continue(self, arg):
00955         """c(ont(inue))
00956         Continue execution, only stop when a breakpoint is encountered.
00957         """
00958         if not self.nosigint:
00959             self._previous_sigint_handler = \
00960                 signal.signal(signal.SIGINT, self.sigint_handler)
00961         self.set_continue()
        return 1
def pdb.Pdb.do_debug (   self,
  arg 
)
debug code
Enter a recursive debugger that steps through the code
argument (which is an arbitrary expression or statement to be
executed in the current environment).

Definition at line 993 of file pdb.py.

00993 
00994     def do_debug(self, arg):
00995         """debug code
00996         Enter a recursive debugger that steps through the code
00997         argument (which is an arbitrary expression or statement to be
00998         executed in the current environment).
00999         """
01000         sys.settrace(None)
01001         globals = self.curframe.f_globals
01002         locals = self.curframe_locals
01003         p = Pdb(self.completekey, self.stdin, self.stdout)
01004         p.prompt = "(%s) " % self.prompt.strip()
01005         self.message("ENTERING RECURSIVE DEBUGGER")
01006         sys.call_tracing(p.run, (arg, globals, locals))
01007         self.message("LEAVING RECURSIVE DEBUGGER")
01008         sys.settrace(self.trace_dispatch)
01009         self.lastcmd = p.lastcmd

Here is the call graph for this function:

def pdb.Pdb.do_disable (   self,
  arg 
)
disable bpnumber [bpnumber ...]
Disables the breakpoints given as a space separated list of
breakpoint numbers.  Disabling a breakpoint means it cannot
cause the program to stop execution, but unlike clearing a
breakpoint, it remains in the list of breakpoints and can be
(re-)enabled.

Definition at line 707 of file pdb.py.

00707 
00708     def do_disable(self, arg):
00709         """disable bpnumber [bpnumber ...]
00710         Disables the breakpoints given as a space separated list of
00711         breakpoint numbers.  Disabling a breakpoint means it cannot
00712         cause the program to stop execution, but unlike clearing a
00713         breakpoint, it remains in the list of breakpoints and can be
00714         (re-)enabled.
00715         """
00716         args = arg.split()
00717         for i in args:
00718             try:
00719                 bp = self.get_bpbynumber(i)
00720             except ValueError as err:
00721                 self.error(err)
00722             else:
00723                 bp.disable()
00724                 self.message('Disabled %s' % bp)

Here is the call graph for this function:

def pdb.Pdb.do_display (   self,
  arg 
)
display [expression]

Display the value of the expression if it changed, each time execution
stops in the current frame.

Without expression, list all display expressions for the current frame.

Definition at line 1230 of file pdb.py.

01230 
01231     def do_display(self, arg):
01232         """display [expression]
01233 
01234         Display the value of the expression if it changed, each time execution
01235         stops in the current frame.
01236 
01237         Without expression, list all display expressions for the current frame.
01238         """
01239         if not arg:
01240             self.message('Currently displaying:')
01241             for item in self.displaying.get(self.curframe, {}).items():
01242                 self.message('%s: %r' % item)
01243         else:
01244             val = self._getval_except(arg)
01245             self.displaying.setdefault(self.curframe, {})[arg] = val
01246             self.message('display %s: %r' % (arg, val))

Here is the call graph for this function:

def pdb.Pdb.do_down (   self,
  arg 
)
d(own) [count]
Move the current frame count (default one) levels down in the
stack trace (to a newer frame).

Definition at line 865 of file pdb.py.

00865 
00866     def do_down(self, arg):
00867         """d(own) [count]
00868         Move the current frame count (default one) levels down in the
00869         stack trace (to a newer frame).
00870         """
00871         if self.curindex + 1 == len(self.stack):
00872             self.error('Newest frame')
00873             return
00874         try:
00875             count = int(arg or 1)
00876         except ValueError:
00877             self.error('Invalid frame count (%s)' % arg)
00878             return
00879         if count < 0:
00880             newframe = len(self.stack) - 1
00881         else:
00882             newframe = min(len(self.stack) - 1, self.curindex + count)
        self._select_frame(newframe)

Here is the call graph for this function:

def pdb.Pdb.do_enable (   self,
  arg 
)
enable bpnumber [bpnumber ...]
Enables the breakpoints given as a space separated list of
breakpoint numbers.

Definition at line 692 of file pdb.py.

00692 
00693     def do_enable(self, arg):
00694         """enable bpnumber [bpnumber ...]
00695         Enables the breakpoints given as a space separated list of
00696         breakpoint numbers.
00697         """
00698         args = arg.split()
00699         for i in args:
00700             try:
00701                 bp = self.get_bpbynumber(i)
00702             except ValueError as err:
00703                 self.error(err)
00704             else:
00705                 bp.enable()
00706                 self.message('Enabled %s' % bp)

Here is the call graph for this function:

def pdb.Pdb.do_EOF (   self,
  arg 
)
EOF
Handles the receipt of EOF as a command.

Definition at line 1021 of file pdb.py.

01021 
01022     def do_EOF(self, arg):
01023         """EOF
01024         Handles the receipt of EOF as a command.
01025         """
01026         self.message('')
01027         self._user_requested_quit = True
01028         self.set_quit()
01029         return 1

Here is the call graph for this function:

def pdb.Pdb.do_help (   self,
  arg 
)
h(elp)
Without argument, print the list of available commands.
With a command name as argument, print help about that command.
"help pdb" shows the full pdb documentation.
"help exec" gives help on the ! command.

Reimplemented from cmd.Cmd.

Definition at line 1346 of file pdb.py.

01346 
01347     def do_help(self, arg):
01348         """h(elp)
01349         Without argument, print the list of available commands.
01350         With a command name as argument, print help about that command.
01351         "help pdb" shows the full pdb documentation.
01352         "help exec" gives help on the ! command.
01353         """
01354         if not arg:
01355             return cmd.Cmd.do_help(self, arg)
01356         try:
01357             try:
01358                 topic = getattr(self, 'help_' + arg)
01359                 return topic()
01360             except AttributeError:
01361                 command = getattr(self, 'do_' + arg)
01362         except AttributeError:
01363             self.error('No help for %r' % arg)
01364         else:
01365             if sys.flags.optimize >= 2:
01366                 self.error('No help for %r; please do not run Python with -OO '
01367                            'if you need command help' % arg)
01368                 return
01369             self.message(command.__doc__.rstrip())

Here is the call graph for this function:

def pdb.Pdb.do_ignore (   self,
  arg 
)
ignore bpnumber [count]
Set the ignore count for the given breakpoint number.  If
count is omitted, the ignore count is set to 0.  A breakpoint
becomes active when the ignore count is zero.  When non-zero,
the count is decremented each time the breakpoint is reached
and the breakpoint is not disabled and any associated
condition evaluates to true.

Definition at line 748 of file pdb.py.

00748 
00749     def do_ignore(self, arg):
00750         """ignore bpnumber [count]
00751         Set the ignore count for the given breakpoint number.  If
00752         count is omitted, the ignore count is set to 0.  A breakpoint
00753         becomes active when the ignore count is zero.  When non-zero,
00754         the count is decremented each time the breakpoint is reached
00755         and the breakpoint is not disabled and any associated
00756         condition evaluates to true.
00757         """
00758         args = arg.split()
00759         try:
00760             count = int(args[1].strip())
00761         except:
00762             count = 0
00763         try:
00764             bp = self.get_bpbynumber(args[0].strip())
00765         except ValueError as err:
00766             self.error(err)
00767         else:
00768             bp.ignore = count
00769             if count > 0:
00770                 if count > 1:
00771                     countstr = '%d crossings' % count
00772                 else:
00773                     countstr = '1 crossing'
00774                 self.message('Will ignore next %s of breakpoint %d.' %
00775                              (countstr, bp.number))
00776             else:
00777                 self.message('Will stop next time breakpoint %d is reached.'
00778                              % bp.number)

Here is the call graph for this function:

def pdb.Pdb.do_interact (   self,
  arg 
)
interact

Start an interative interpreter whose global namespace
contains all the (global and local) names found in the current scope.

Definition at line 1262 of file pdb.py.

01262 
01263     def do_interact(self, arg):
01264         """interact
01265 
01266         Start an interative interpreter whose global namespace
01267         contains all the (global and local) names found in the current scope.
01268         """
01269         ns = self.curframe.f_globals.copy()
01270         ns.update(self.curframe_locals)
01271         code.interact("*interactive*", local=ns)

def pdb.Pdb.do_jump (   self,
  arg 
)
j(ump) lineno
Set the next line that will be executed.  Only available in
the bottom-most frame.  This lets you jump back and execute
code again, or jump forward to skip code that you don't want
to run.

It should be noted that not all jumps are allowed -- for
instance it is not possible to jump into the middle of a
for loop or out of a finally clause.

Definition at line 964 of file pdb.py.

00964 
00965     def do_jump(self, arg):
00966         """j(ump) lineno
00967         Set the next line that will be executed.  Only available in
00968         the bottom-most frame.  This lets you jump back and execute
00969         code again, or jump forward to skip code that you don't want
00970         to run.
00971 
00972         It should be noted that not all jumps are allowed -- for
00973         instance it is not possible to jump into the middle of a
00974         for loop or out of a finally clause.
00975         """
00976         if self.curindex + 1 != len(self.stack):
00977             self.error('You can only jump within the bottom frame')
00978             return
00979         try:
00980             arg = int(arg)
00981         except ValueError:
00982             self.error("The 'jump' command requires a line number")
00983         else:
00984             try:
00985                 # Do the jump, fix up our copy of the stack, and display the
00986                 # new position
00987                 self.curframe.f_lineno = arg
00988                 self.stack[self.curindex] = self.stack[self.curindex][0], arg
00989                 self.print_stack_entry(self.stack[self.curindex])
00990             except ValueError as e:
                self.error('Jump failed: %s' % e)

Here is the call graph for this function:

def pdb.Pdb.do_list (   self,
  arg 
)
l(ist) [first [,last] | .]

List source code for the current file.  Without arguments,
list 11 lines around the current line or continue the previous
listing.  With . as argument, list 11 lines around the current
line.  With one argument, list 11 lines starting at that line.
With two arguments, list the given range; if the second
argument is less than the first, it is a count.

The current line in the current frame is indicated by "->".
If an exception is being debugged, the line where the
exception was originally raised or propagated is indicated by
">>", if it differs from the current line.

Definition at line 1096 of file pdb.py.

01096 
01097     def do_list(self, arg):
01098         """l(ist) [first [,last] | .]
01099 
01100         List source code for the current file.  Without arguments,
01101         list 11 lines around the current line or continue the previous
01102         listing.  With . as argument, list 11 lines around the current
01103         line.  With one argument, list 11 lines starting at that line.
01104         With two arguments, list the given range; if the second
01105         argument is less than the first, it is a count.
01106 
01107         The current line in the current frame is indicated by "->".
01108         If an exception is being debugged, the line where the
01109         exception was originally raised or propagated is indicated by
01110         ">>", if it differs from the current line.
01111         """
01112         self.lastcmd = 'list'
01113         last = None
01114         if arg and arg != '.':
01115             try:
01116                 if ',' in arg:
01117                     first, last = arg.split(',')
01118                     first = int(first.strip())
01119                     last = int(last.strip())
01120                     if last < first:
01121                         # assume it's a count
01122                         last = first + last
01123                 else:
01124                     first = int(arg.strip())
01125                     first = max(1, first - 5)
01126             except ValueError:
01127                 self.error('Error in argument: %r' % arg)
01128                 return
01129         elif self.lineno is None or arg == '.':
01130             first = max(1, self.curframe.f_lineno - 5)
01131         else:
01132             first = self.lineno + 1
01133         if last is None:
01134             last = first + 10
01135         filename = self.curframe.f_code.co_filename
01136         breaklist = self.get_file_breaks(filename)
01137         try:
01138             lines = linecache.getlines(filename, self.curframe.f_globals)
01139             self._print_lines(lines[first-1:last], first, breaklist,
01140                               self.curframe)
01141             self.lineno = min(last, len(lines))
01142             if len(lines) < last:
01143                 self.message('[EOF]')
01144         except KeyboardInterrupt:
            pass

Here is the call graph for this function:

def pdb.Pdb.do_longlist (   self,
  arg 
)
longlist | ll
List the whole source code for the current function or frame.

Definition at line 1147 of file pdb.py.

01147 
01148     def do_longlist(self, arg):
01149         """longlist | ll
01150         List the whole source code for the current function or frame.
01151         """
01152         filename = self.curframe.f_code.co_filename
01153         breaklist = self.get_file_breaks(filename)
01154         try:
01155             lines, lineno = getsourcelines(self.curframe)
01156         except IOError as err:
01157             self.error(err)
01158             return
        self._print_lines(lines, lineno, breaklist, self.curframe)

Here is the call graph for this function:

def pdb.Pdb.do_next (   self,
  arg 
)
n(ext)
Continue execution until the next line in the current function
is reached or it returns.

Definition at line 919 of file pdb.py.

00919 
00920     def do_next(self, arg):
00921         """n(ext)
00922         Continue execution until the next line in the current function
00923         is reached or it returns.
00924         """
00925         self.set_next(self.curframe)
        return 1

Here is the call graph for this function:

def pdb.Pdb.do_p (   self,
  arg 
)
p(rint) expression
Print the value of the expression.

Definition at line 1076 of file pdb.py.

01076 
01077     def do_p(self, arg):
01078         """p(rint) expression
01079         Print the value of the expression.
01080         """
01081         try:
01082             self.message(repr(self._getval(arg)))
01083         except:
            pass

Here is the call graph for this function:

def pdb.Pdb.do_pp (   self,
  arg 
)
pp expression
Pretty-print the value of the expression.

Definition at line 1087 of file pdb.py.

01087 
01088     def do_pp(self, arg):
01089         """pp expression
01090         Pretty-print the value of the expression.
01091         """
01092         try:
01093             self.message(pprint.pformat(self._getval(arg)))
01094         except:
01095             pass

Here is the call graph for this function:

def pdb.Pdb.do_quit (   self,
  arg 
)
q(uit)\nexit
Quit from the debugger. The program being executed is aborted.

Definition at line 1010 of file pdb.py.

01010 
01011     def do_quit(self, arg):
01012         """q(uit)\nexit
01013         Quit from the debugger. The program being executed is aborted.
01014         """
01015         self._user_requested_quit = True
01016         self.set_quit()
01017         return 1

def pdb.Pdb.do_return (   self,
  arg 
)
r(eturn)
Continue execution until the current function returns.

Definition at line 945 of file pdb.py.

00945 
00946     def do_return(self, arg):
00947         """r(eturn)
00948         Continue execution until the current function returns.
00949         """
00950         self.set_return(self.curframe)
        return 1

Here is the call graph for this function:

def pdb.Pdb.do_retval (   self,
  arg 
)
retval
Print the return value for the last return of a function.

Definition at line 1047 of file pdb.py.

01047 
01048     def do_retval(self, arg):
01049         """retval
01050         Print the return value for the last return of a function.
01051         """
01052         if '__return__' in self.curframe_locals:
01053             self.message(repr(self.curframe_locals['__return__']))
01054         else:
            self.error('Not yet returned!')

Here is the call graph for this function:

def pdb.Pdb.do_run (   self,
  arg 
)
run [args...]
Restart the debugged python program. If a string is supplied
it is splitted with "shlex", and the result is used as the new
sys.argv.  History, breakpoints, actions and debugger options
are preserved.  "restart" is an alias for "run".

Definition at line 928 of file pdb.py.

00928 
00929     def do_run(self, arg):
00930         """run [args...]
00931         Restart the debugged python program. If a string is supplied
00932         it is splitted with "shlex", and the result is used as the new
00933         sys.argv.  History, breakpoints, actions and debugger options
00934         are preserved.  "restart" is an alias for "run".
00935         """
00936         if arg:
00937             import shlex
00938             argv0 = sys.argv[0:1]
00939             sys.argv = shlex.split(arg)
00940             sys.argv[:0] = argv0
00941         # this is caught in the main debugger loop
00942         raise Restart

Here is the call graph for this function:

def pdb.Pdb.do_source (   self,
  arg 
)
source expression
Try to get source code for the given object and display it.

Definition at line 1161 of file pdb.py.

01161 
01162     def do_source(self, arg):
01163         """source expression
01164         Try to get source code for the given object and display it.
01165         """
01166         try:
01167             obj = self._getval(arg)
01168         except:
01169             return
01170         try:
01171             lines, lineno = getsourcelines(obj)
01172         except (IOError, TypeError) as err:
01173             self.error(err)
01174             return
01175         self._print_lines(lines, lineno)

Here is the call graph for this function:

def pdb.Pdb.do_step (   self,
  arg 
)
s(tep)
Execute the current line, stop at the first possible occasion
(either in a function that is called or in the current
function).

Definition at line 909 of file pdb.py.

00909 
00910     def do_step(self, arg):
00911         """s(tep)
00912         Execute the current line, stop at the first possible occasion
00913         (either in a function that is called or in the current
00914         function).
00915         """
00916         self.set_step()
        return 1

Here is the call graph for this function:

def pdb.Pdb.do_tbreak (   self,
  arg 
)
tbreak [ ([filename:]lineno | function) [, condition] ]
Same arguments as break, but sets a temporary breakpoint: it
is automatically deleted when first hit.

Definition at line 631 of file pdb.py.

00631 
00632     def do_tbreak(self, arg):
00633         """tbreak [ ([filename:]lineno | function) [, condition] ]
00634         Same arguments as break, but sets a temporary breakpoint: it
00635         is automatically deleted when first hit.
00636         """
00637         self.do_break(arg, 1)

Here is the call graph for this function:

def pdb.Pdb.do_unalias (   self,
  arg 
)
unalias name
Delete the specified alias.

Definition at line 1307 of file pdb.py.

01307 
01308     def do_unalias(self, arg):
01309         """unalias name
01310         Delete the specified alias.
01311         """
01312         args = arg.split()
01313         if len(args) == 0: return
01314         if args[0] in self.aliases:
01315             del self.aliases[args[0]]

def pdb.Pdb.do_undisplay (   self,
  arg 
)
undisplay [expression]

Do not display the expression any more in the current frame.

Without expression, clear all display expressions for the current frame.

Definition at line 1247 of file pdb.py.

01247 
01248     def do_undisplay(self, arg):
01249         """undisplay [expression]
01250 
01251         Do not display the expression any more in the current frame.
01252 
01253         Without expression, clear all display expressions for the current frame.
01254         """
01255         if arg:
01256             try:
01257                 del self.displaying.get(self.curframe, {})[arg]
01258             except KeyError:
01259                 self.error('not displaying %s' % arg)
01260         else:
01261             self.displaying.pop(self.curframe, None)

Here is the call graph for this function:

def pdb.Pdb.do_until (   self,
  arg 
)
unt(il) [lineno]
Without argument, continue execution until the line with a
number greater than the current one is reached.  With a line
number, continue execution until a line with a number greater
or equal to that is reached.  In both cases, also stop when
the current frame returns.

Definition at line 885 of file pdb.py.

00885 
00886     def do_until(self, arg):
00887         """unt(il) [lineno]
00888         Without argument, continue execution until the line with a
00889         number greater than the current one is reached.  With a line
00890         number, continue execution until a line with a number greater
00891         or equal to that is reached.  In both cases, also stop when
00892         the current frame returns.
00893         """
00894         if arg:
00895             try:
00896                 lineno = int(arg)
00897             except ValueError:
00898                 self.error('Error in argument: %r' % arg)
00899                 return
00900             if lineno <= self.curframe.f_lineno:
00901                 self.error('"until" line number is smaller than current '
00902                            'line number')
00903                 return
00904         else:
00905             lineno = None
00906         self.set_until(self.curframe, lineno)
        return 1

Here is the call graph for this function:

def pdb.Pdb.do_up (   self,
  arg 
)
u(p) [count]
Move the current frame count (default one) levels up in the
stack trace (to an older frame).

Definition at line 845 of file pdb.py.

00845 
00846     def do_up(self, arg):
00847         """u(p) [count]
00848         Move the current frame count (default one) levels up in the
00849         stack trace (to an older frame).
00850         """
00851         if self.curindex == 0:
00852             self.error('Oldest frame')
00853             return
00854         try:
00855             count = int(arg or 1)
00856         except ValueError:
00857             self.error('Invalid frame count (%s)' % arg)
00858             return
00859         if count < 0:
00860             newframe = 0
00861         else:
00862             newframe = max(0, self.curindex - count)
        self._select_frame(newframe)

Here is the call graph for this function:

def pdb.Pdb.do_whatis (   self,
  arg 
)
whatis arg
Print the type of the argument.

Definition at line 1197 of file pdb.py.

01197 
01198     def do_whatis(self, arg):
01199         """whatis arg
01200         Print the type of the argument.
01201         """
01202         try:
01203             value = self._getval(arg)
01204         except:
01205             # _getval() already printed the error
01206             return
01207         code = None
01208         # Is it a function?
01209         try:
01210             code = value.__code__
01211         except Exception:
01212             pass
01213         if code:
01214             self.message('Function %s' % code.co_name)
01215             return
01216         # Is it an instance method?
01217         try:
01218             code = value.__func__.__code__
01219         except Exception:
01220             pass
01221         if code:
01222             self.message('Method %s' % code.co_name)
01223             return
01224         # Is it a class?
01225         if value.__class__ is type:
01226             self.message('Class %s.%s' % (value.__module__, value.__name__))
01227             return
01228         # None of the above...
01229         self.message(type(value))

Here is the call graph for this function:

def pdb.Pdb.do_where (   self,
  arg 
)
w(here)
Print a stack trace, with the most recent frame at the bottom.
An arrow indicates the "current frame", which determines the
context of most commands.  'bt' is an alias for this command.

Definition at line 827 of file pdb.py.

00827 
00828     def do_where(self, arg):
00829         """w(here)
00830         Print a stack trace, with the most recent frame at the bottom.
00831         An arrow indicates the "current frame", which determines the
00832         context of most commands.  'bt' is an alias for this command.
00833         """
        self.print_stack_trace()

Here is the call graph for this function:

def cmd.Cmd.emptyline (   self) [inherited]
Called when an empty line is entered in response to the prompt.

If this method is not overridden, it repeats the last nonempty
command entered.

Definition at line 217 of file cmd.py.

00217 
00218     def emptyline(self):
00219         """Called when an empty line is entered in response to the prompt.
00220 
00221         If this method is not overridden, it repeats the last nonempty
00222         command entered.
00223 
00224         """
00225         if self.lastcmd:
00226             return self.onecmd(self.lastcmd)

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb.error (   self,
  msg 
)

Definition at line 445 of file pdb.py.

00445 
00446     def error(self, msg):
00447         print('***', msg, file=self.stdout)

Here is the caller graph for this function:

def pdb.Pdb.execRcLines (   self)

Definition at line 226 of file pdb.py.

00226 
00227     def execRcLines(self):
00228         if not self.rcLines:
00229             return
00230         # local copy because of recursion
00231         rcLines = self.rcLines
00232         rcLines.reverse()
00233         # execute every line only once
00234         self.rcLines = []
00235         while rcLines:
00236             line = rcLines.pop().strip()
00237             if line and line[0] != '#':
00238                 if self.onecmd(line):
00239                     # if onecmd returns True, the command wants to exit
00240                     # from the interaction, save leftover rc lines
00241                     # to execute before next interaction
00242                     self.rcLines += reversed(rcLines)
00243                     return True

Here is the call graph for this function:

def pdb.Pdb.forget (   self)

Definition at line 201 of file pdb.py.

00201 
00202     def forget(self):
00203         self.lineno = None
00204         self.stack = []
00205         self.curindex = 0
00206         self.curframe = None
00207         self.tb_lineno.clear()

Here is the caller graph for this function:

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 cmd.Cmd.get_names (   self) [inherited]

Definition at line 279 of file cmd.py.

00279 
00280     def get_names(self):
00281         # This method used to pull in base class attributes
00282         # at a time dir() didn't do it yet.
00283         return dir(self.__class__)

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 pdb.Pdb.handle_command_def (   self,
  line 
)
Handles one command line during command list definition.

Definition at line 412 of file pdb.py.

00412 
00413     def handle_command_def(self, line):
00414         """Handles one command line during command list definition."""
00415         cmd, arg, line = self.parseline(line)
00416         if not cmd:
00417             return
00418         if cmd == 'silent':
00419             self.commands_silent[self.commands_bnum] = True
00420             return # continue to handle other cmd def in the cmd list
00421         elif cmd == 'end':
00422             self.cmdqueue = []
00423             return 1 # end of cmd list
00424         cmdlist = self.commands[self.commands_bnum]
00425         if arg:
00426             cmdlist.append(cmd+' '+arg)
00427         else:
00428             cmdlist.append(cmd)
00429         # Determine if we must stop
00430         try:
00431             func = getattr(self, 'do_' + cmd)
00432         except AttributeError:
00433             func = self.default
00434         # one of the resuming commands
00435         if func.__name__ in self.commands_resuming:
00436             self.commands_doprompt[self.commands_bnum] = False
00437             self.cmdqueue = []
00438             return 1
00439         return

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb.help_exec (   self)
(!) statement
Execute the (one-line) statement in the context of the current
stack frame.  The exclamation point can be omitted unless the
first word of the statement resembles a debugger command.  To
assign to a global variable you must always prefix the command
with a 'global' command, e.g.:
(Pdb) global list_options; list_options = ['-l']
(Pdb)

Definition at line 1372 of file pdb.py.

01372 
01373     def help_exec(self):
01374         """(!) statement
01375         Execute the (one-line) statement in the context of the current
01376         stack frame.  The exclamation point can be omitted unless the
01377         first word of the statement resembles a debugger command.  To
01378         assign to a global variable you must always prefix the command
01379         with a 'global' command, e.g.:
01380         (Pdb) global list_options; list_options = ['-l']
01381         (Pdb)
01382         """
01383         self.message((self.help_exec.__doc__ or '').strip())

Here is the call graph for this function:

def pdb.Pdb.help_pdb (   self)

Definition at line 1384 of file pdb.py.

01384 
01385     def help_pdb(self):
01386         help()

Here is the call graph for this function:

def pdb.Pdb.interaction (   self,
  frame,
  traceback 
)

Definition at line 335 of file pdb.py.

00335 
00336     def interaction(self, frame, traceback):
00337         if self.setup(frame, traceback):
00338             # no interaction desired at this time (happens if .pdbrc contains
00339             # a command like "continue")
00340             self.forget()
00341             return
00342         self.print_stack_entry(self.stack[self.curindex])
00343         self._cmdloop()
00344         self.forget()

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 pdb.Pdb.lineinfo (   self,
  identifier 
)

Definition at line 638 of file pdb.py.

00638 
00639     def lineinfo(self, identifier):
00640         failed = (None, None, None)
00641         # Input is identifier, may be in single quotes
00642         idstring = identifier.split("'")
00643         if len(idstring) == 1:
00644             # not in single quotes
00645             id = idstring[0].strip()
00646         elif len(idstring) == 3:
00647             # quoted
00648             id = idstring[1].strip()
00649         else:
00650             return failed
00651         if id == '': return failed
00652         parts = id.split('.')
00653         # Protection for derived debuggers
00654         if parts[0] == 'self':
00655             del parts[0]
00656             if len(parts) == 0:
00657                 return failed
00658         # Best first guess at file to look at
00659         fname = self.defaultFile()
00660         if len(parts) == 1:
00661             item = parts[0]
00662         else:
00663             # More than one part.
00664             # First is module, second is method/class
00665             f = self.lookupmodule(parts[0])
00666             if f:
00667                 fname = f
00668             item = parts[1]
00669         answer = find_function(item, fname)
00670         return answer or failed

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb.lookupmodule (   self,
  filename 
)
Helper function for break/clear parsing -- may be overridden.

lookupmodule() translates (possibly incomplete) file or module name
into an absolute file name.

Definition at line 1389 of file pdb.py.

01389 
01390     def lookupmodule(self, filename):
01391         """Helper function for break/clear parsing -- may be overridden.
01392 
01393         lookupmodule() translates (possibly incomplete) file or module name
01394         into an absolute file name.
01395         """
01396         if os.path.isabs(filename) and  os.path.exists(filename):
01397             return filename
01398         f = os.path.join(sys.path[0], filename)
01399         if  os.path.exists(f) and self.canonic(f) == self.mainpyfile:
01400             return f
01401         root, ext = os.path.splitext(filename)
01402         if ext == '':
01403             filename = filename + '.py'
01404         if os.path.isabs(filename):
01405             return filename
01406         for dirname in sys.path:
01407             while os.path.islink(dirname):
01408                 dirname = os.readlink(dirname)
01409             fullname = os.path.join(dirname, filename)
01410             if os.path.exists(fullname):
01411                 return fullname
01412         return None

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb.message (   self,
  msg 
)

Definition at line 442 of file pdb.py.

00442 
00443     def message(self, msg):
00444         print(msg, file=self.stdout)

Here is the caller graph for this function:

def pdb.Pdb.onecmd (   self,
  line 
)
Interpret the argument as though it had been typed in response
to the prompt.

Checks whether this line is typed at the normal prompt or in
a breakpoint command list definition.

Reimplemented from cmd.Cmd.

Definition at line 400 of file pdb.py.

00400 
00401     def onecmd(self, line):
00402         """Interpret the argument as though it had been typed in response
00403         to the prompt.
00404 
00405         Checks whether this line is typed at the normal prompt or in
00406         a breakpoint command list definition.
00407         """
00408         if not self.commands_defining:
00409             return cmd.Cmd.onecmd(self, line)
00410         else:
00411             return self.handle_command_def(line)

Here is the call graph for this function:

def cmd.Cmd.parseline (   self,
  line 
) [inherited]
Parse the line into a command name and a string containing
the arguments.  Returns a tuple containing (command, args, line).
'command' and 'args' may be None if the line couldn't be parsed.

Definition at line 172 of file cmd.py.

00172 
00173     def parseline(self, line):
00174         """Parse the line into a command name and a string containing
00175         the arguments.  Returns a tuple containing (command, args, line).
00176         'command' and 'args' may be None if the line couldn't be parsed.
00177         """
00178         line = line.strip()
00179         if not line:
00180             return None, None, line
00181         elif line[0] == '?':
00182             line = 'help ' + line[1:]
00183         elif line[0] == '!':
00184             if hasattr(self, 'do_shell'):
00185                 line = 'shell ' + line[1:]
00186             else:
00187                 return None, None, line
00188         i, n = 0, len(line)
00189         while i < n and line[i] in self.identchars: i = i+1
00190         cmd, arg = line[:i], line[i:].strip()
00191         return cmd, arg, line

Here is the caller graph for this function:

def cmd.Cmd.postcmd (   self,
  stop,
  line 
) [inherited]
Hook method executed just after a command dispatch is finished.

Reimplemented in pstats.ProfileBrowser.

Definition at line 157 of file cmd.py.

00157 
00158     def postcmd(self, stop, line):
00159         """Hook method executed just after a command dispatch is finished."""
00160         return stop

def cmd.Cmd.postloop (   self) [inherited]
Hook method executed once when the cmdloop() method is about to
return.

Reimplemented in test.test_cmd.samplecmdclass.

Definition at line 165 of file cmd.py.

00165 
00166     def postloop(self):
00167         """Hook method executed once when the cmdloop() method is about to
00168         return.
00169 
00170         """
00171         pass

def pdb.Pdb.precmd (   self,
  line 
)
Handle alias expansion and ';;' separator.

Reimplemented from cmd.Cmd.

Definition at line 375 of file pdb.py.

00375 
00376     def precmd(self, line):
00377         """Handle alias expansion and ';;' separator."""
00378         if not line.strip():
00379             return line
00380         args = line.split()
00381         while args[0] in self.aliases:
00382             line = self.aliases[args[0]]
00383             ii = 1
00384             for tmpArg in args[1:]:
00385                 line = line.replace("%" + str(ii),
00386                                       tmpArg)
00387                 ii += 1
00388             line = line.replace("%*", ' '.join(args[1:]))
00389             args = line.split()
00390         # split into ';;' separated commands
00391         # unless it's an alias command
00392         if args[0] != 'alias':
00393             marker = line.find(';;')
00394             if marker >= 0:
00395                 # queue up everything after marker
00396                 next = line[marker+2:].lstrip()
00397                 self.cmdqueue.append(next)
00398                 line = line[:marker].rstrip()
00399         return line

def pdb.Pdb.preloop (   self)
Hook method executed once when the cmdloop() method is called.

Reimplemented from cmd.Cmd.

Definition at line 322 of file pdb.py.

00322 
00323     def preloop(self):
00324         displaying = self.displaying.get(self.curframe)
00325         if displaying:
00326             for expr, oldvalue in displaying.items():
00327                 newvalue = self._getval_except(expr)
00328                 # check for identity first; this prevents custom __eq__ to
00329                 # be called at every loop, and also prevents instances whose
00330                 # fields are changed to be displayed
00331                 if newvalue is not oldvalue and newvalue != oldvalue:
00332                     displaying[expr] = newvalue
00333                     self.message('display %s: %r  [old: %r]' %
00334                                  (expr, newvalue, oldvalue))

Here is the call graph for this function:

def pdb.Pdb.print_stack_entry (   self,
  frame_lineno,
  prompt_prefix = line_prefix 
)

Definition at line 1335 of file pdb.py.

01335 
01336     def print_stack_entry(self, frame_lineno, prompt_prefix=line_prefix):
01337         frame, lineno = frame_lineno
01338         if frame is self.curframe:
01339             prefix = '> '
01340         else:
01341             prefix = '  '
01342         self.message(prefix +
01343                      self.format_stack_entry(frame_lineno, prompt_prefix))

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb.print_stack_trace (   self)

Definition at line 1328 of file pdb.py.

01328 
01329     def print_stack_trace(self):
01330         try:
01331             for frame_lineno in self.stack:
01332                 self.print_stack_entry(frame_lineno)
01333         except KeyboardInterrupt:
01334             pass

Here is the call graph for this function:

Here is the caller graph for this function:

def cmd.Cmd.print_topics (   self,
  header,
  cmds,
  cmdlen,
  maxcol 
) [inherited]

Definition at line 336 of file cmd.py.

00336 
00337     def print_topics(self, header, cmds, cmdlen, maxcol):
00338         if cmds:
00339             self.stdout.write("%s\n"%str(header))
00340             if self.ruler:
00341                 self.stdout.write("%s\n"%str(self.ruler * len(header)))
00342             self.columnize(cmds, maxcol-1)
00343             self.stdout.write("\n")

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb.reset (   self)

Reimplemented from bdb.Bdb.

Definition at line 197 of file pdb.py.

00197 
00198     def reset(self):
00199         bdb.Bdb.reset(self)
00200         self.forget()

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 pdb.Pdb.setup (   self,
  f,
  tb 
)

Definition at line 208 of file pdb.py.

00208 
00209     def setup(self, f, tb):
00210         self.forget()
00211         self.stack, self.curindex = self.get_stack(f, tb)
00212         while tb:
00213             # when setting up post-mortem debugging with a traceback, save all
00214             # the original line numbers to be displayed along the current line
00215             # numbers (which can be different, e.g. due to finally clauses)
00216             lineno = lasti2lineno(tb.tb_frame.f_code, tb.tb_lasti)
00217             self.tb_lineno[tb.tb_frame] = lineno
00218             tb = tb.tb_next
00219         self.curframe = self.stack[self.curindex][0]
00220         # The f_locals dictionary is updated from the actual frame
00221         # locals whenever the .f_locals accessor is called, so we
00222         # cache it here to ensure that modifications are not overwritten.
00223         self.curframe_locals = self.curframe.f_locals
00224         return self.execRcLines()

Here is the call graph for this function:

Here is the caller graph for this function:

def pdb.Pdb.sigint_handler (   self,
  signum,
  frame 
)

Definition at line 188 of file pdb.py.

00188 
00189     def sigint_handler(self, signum, frame):
00190         if self.allow_kbdint:
00191             raise KeyboardInterrupt
00192         self.message("\nProgram interrupted. (Use 'cont' to resume).")
00193         self.set_step()
00194         self.set_trace(frame)
00195         # restore previous signal handler
00196         signal.signal(signal.SIGINT, self._previous_sigint_handler)

Here is the call 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 pdb.Pdb.user_call (   self,
  frame,
  argument_list 
)
This method is called when there is the remote possibility
that we ever need to stop in this function.

Reimplemented from bdb.Bdb.

Definition at line 246 of file pdb.py.

00246 
00247     def user_call(self, frame, argument_list):
00248         """This method is called when there is the remote possibility
00249         that we ever need to stop in this function."""
00250         if self._wait_for_mainpyfile:
00251             return
00252         if self.stop_here(frame):
00253             self.message('--Call--')
00254             self.interaction(frame, None)

Here is the call graph for this function:

def pdb.Pdb.user_exception (   self,
  frame,
  exc_info 
)
This function 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 297 of file pdb.py.

00297 
00298     def user_exception(self, frame, exc_info):
00299         """This function is called if an exception occurs,
00300         but only if we are to stop at or just below this level."""
00301         if self._wait_for_mainpyfile:
00302             return
00303         exc_type, exc_value, exc_traceback = exc_info
00304         frame.f_locals['__exception__'] = exc_type, exc_value
00305         self.message(traceback.format_exception_only(exc_type,
00306                                                      exc_value)[-1].strip())
00307         self.interaction(frame, exc_traceback)

Here is the call graph for this function:

def pdb.Pdb.user_line (   self,
  frame 
)
This function is called when we stop or break at this line.

Reimplemented from bdb.Bdb.

Definition at line 255 of file pdb.py.

00255 
00256     def user_line(self, frame):
00257         """This function is called when we stop or break at this line."""
00258         if self._wait_for_mainpyfile:
00259             if (self.mainpyfile != self.canonic(frame.f_code.co_filename)
00260                 or frame.f_lineno <= 0):
00261                 return
00262             self._wait_for_mainpyfile = False
00263         if self.bp_commands(frame):
00264             self.interaction(frame, None)

Here is the call graph for this function:

def pdb.Pdb.user_return (   self,
  frame,
  return_value 
)
This function is called when a return trap is set here.

Reimplemented from bdb.Bdb.

Definition at line 289 of file pdb.py.

00289 
00290     def user_return(self, frame, return_value):
00291         """This function is called when a return trap is set here."""
00292         if self._wait_for_mainpyfile:
00293             return
00294         frame.f_locals['__return__'] = return_value
00295         self.message('--Return--')
00296         self.interaction(frame, None)

Here is the call graph for this function:


Member Data Documentation

Definition at line 958 of file pdb.py.

Definition at line 1014 of file pdb.py.

Definition at line 153 of file pdb.py.

Definition at line 150 of file pdb.py.

Definition at line 160 of file pdb.py.

bdb.Bdb.botframe [inherited]

Definition at line 39 of file bdb.py.

bdb.Bdb.breaks [inherited]

Definition at line 23 of file bdb.py.

Reimplemented from cmd.Cmd.

Definition at line 421 of file pdb.py.

Definition at line 178 of file pdb.py.

Definition at line 185 of file pdb.py.

Definition at line 183 of file pdb.py.

Definition at line 179 of file pdb.py.

Initial value:
['do_continue', 'do_step', 'do_next', 'do_return',
                         'do_quit', 'do_jump']

Definition at line 1317 of file pdb.py.

Definition at line 181 of file pdb.py.

cmd.Cmd.completekey [inherited]

Definition at line 96 of file cmd.py.

Definition at line 273 of file cmd.py.

Definition at line 205 of file pdb.py.

Definition at line 222 of file pdb.py.

Definition at line 204 of file pdb.py.

Reimplemented from bdb.Bdb.

Definition at line 275 of file pdb.py.

Definition at line 151 of file pdb.py.

pdb.Pdb.do_a = do_args [static]

Definition at line 1045 of file pdb.py.

pdb.Pdb.do_b = do_break [static]

Definition at line 629 of file pdb.py.

pdb.Pdb.do_bt = do_where [static]

Definition at line 835 of file pdb.py.

pdb.Pdb.do_c = do_contdo_continue [static]

Definition at line 962 of file pdb.py.

pdb.Pdb.do_cl = do_clear [static]

Definition at line 825 of file pdb.py.

pdb.Pdb.do_d = do_down [static]

Definition at line 883 of file pdb.py.

Definition at line 1019 of file pdb.py.

pdb.Pdb.do_h = do_help [static]

Definition at line 1370 of file pdb.py.

pdb.Pdb.do_j = do_jump [static]

Definition at line 991 of file pdb.py.

pdb.Pdb.do_l = do_list [static]

Definition at line 1145 of file pdb.py.

Definition at line 1159 of file pdb.py.

pdb.Pdb.do_n = do_next [static]

Definition at line 926 of file pdb.py.

pdb.Pdb.do_print = do_p [static]

Definition at line 1085 of file pdb.py.

pdb.Pdb.do_q = do_quit [static]

Definition at line 1018 of file pdb.py.

pdb.Pdb.do_r = do_return [static]

Definition at line 951 of file pdb.py.

Definition at line 943 of file pdb.py.

Definition at line 1055 of file pdb.py.

pdb.Pdb.do_s = do_step [static]

Definition at line 917 of file pdb.py.

pdb.Pdb.do_u = do_up [static]

Definition at line 863 of file pdb.py.

Definition at line 907 of file pdb.py.

pdb.Pdb.do_w = do_where [static]

Definition at line 834 of file pdb.py.

string cmd.Cmd.doc_header = "Documented commands (type help <topic>):" [static, inherited]

Definition at line 70 of file cmd.py.

string cmd.Cmd.doc_leader = "" [static, inherited]

Definition at line 69 of file cmd.py.

bdb.Bdb.fncache [inherited]

Definition at line 24 of file bdb.py.

cmd.Cmd.identchars = IDENTCHARS [static, inherited]

Definition at line 65 of file cmd.py.

cmd.Cmd.intro = None [static, inherited]

Definition at line 68 of file cmd.py.

Reimplemented from cmd.Cmd.

Definition at line 280 of file pdb.py.

Definition at line 202 of file pdb.py.

Definition at line 152 of file pdb.py.

string cmd.Cmd.misc_header = "Miscellaneous help topics:" [static, inherited]

Definition at line 71 of file cmd.py.

string cmd.Cmd.nohelp = "*** No help on %s" [static, inherited]

Definition at line 73 of file cmd.py.

Definition at line 161 of file pdb.py.

cmd.Cmd.old_completer [inherited]

Definition at line 109 of file cmd.py.

Reimplemented from cmd.Cmd.

Definition at line 149 of file pdb.py.

bdb.Bdb.quitting [inherited]

Definition at line 171 of file bdb.py.

Definition at line 164 of file pdb.py.

bdb.Bdb.returnframe [inherited]

Definition at line 170 of file bdb.py.

string cmd.Cmd.ruler = '=' [static, inherited]

Definition at line 66 of file cmd.py.

bdb.Bdb.skip [inherited]

Definition at line 22 of file bdb.py.

Definition at line 203 of file pdb.py.

cmd.Cmd.stdin [inherited]

Definition at line 88 of file cmd.py.

cmd.Cmd.stdout [inherited]

Definition at line 92 of file cmd.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.

Definition at line 154 of file pdb.py.

string cmd.Cmd.undoc_header = "Undocumented commands:" [static, inherited]

Definition at line 72 of file cmd.py.

Reimplemented from cmd.Cmd.

Reimplemented in doctest._OutputRedirectingPdb.

Definition at line 148 of file pdb.py.


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