Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
Pdb Class Reference
Inheritance diagram for Pdb:
Bdb Cmd

Public Member Functions

def __init__
 
def reset
 
def forget
 
def setup
 
def execRcLines
 
def user_line
 
def user_return
 
def user_exception
 
def interaction
 
def default
 
def precmd
 
def do_EOF
 
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_step
 
def do_next
 
def do_return
 
def do_continue
 
def do_quit
 
def do_args
 
def do_retval
 
def do_p
 
def do_list
 
def do_whatis
 
def do_alias
 
def do_unalias
 
def print_stack_trace
 
def print_stack_entry
 
def help_help
 
def help_h
 
def help_where
 
def help_w
 
def help_down
 
def help_d
 
def help_up
 
def help_u
 
def help_break
 
def help_b
 
def help_clear
 
def help_cl
 
def help_tbreak
 
def help_enable
 
def help_disable
 
def help_ignore
 
def help_condition
 
def help_step
 
def help_s
 
def help_next
 
def help_n
 
def help_return
 
def help_r
 
def help_continue
 
def help_cont
 
def help_c
 
def help_list
 
def help_l
 
def help_args
 
def help_a
 
def help_p
 
def help_exec
 
def help_quit
 
def help_q
 
def help_whatis
 
def help_EOF
 
def help_alias
 
def help_unalias
 
def help_pdb
 
def lookupmodule
 
- Public Member Functions inherited from Bdb
def __init__
 
def canonic
 
def reset
 
def trace_dispatch
 
def dispatch_line
 
def dispatch_call
 
def dispatch_return
 
def dispatch_exception
 
def stop_here
 
def break_here
 
def do_clear
 
def break_anywhere
 
def user_call
 
def user_line
 
def user_return
 
def user_exception
 
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_break
 
def get_breaks
 
def get_file_breaks
 
def get_all_breaks
 
def get_stack
 
def format_stack_entry
 
def run
 
def runeval
 
def runctx
 
def runcall
 
- Public Member Functions inherited from Cmd
def __init__
 
def cmdloop
 
def precmd
 
def postcmd
 
def preloop
 
def postloop
 
def parseline
 
def onecmd
 
def emptyline
 
def default
 
def completedefault
 
def completenames
 
def complete
 
def get_names
 
def complete_help
 
def do_help
 
def print_topics
 

Data Fields

 prompt
 
 aliases
 
 rcLines
 
 lineno
 
 stack
 
 curindex
 
 curframe
 
 lastcmd
 
- Data Fields inherited from Bdb
 breaks
 
 fncache
 
 botframe
 
 stopframe
 
 returnframe
 
 quitting
 
 currentbp
 
- Data Fields inherited from Cmd
 lastcmd
 
 completion_matches
 

Static Public Attributes

 do_h = cmd.Cmd.do_help
 
 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_s = do_step
 
 do_n = do_next
 
 do_r = do_return
 
 do_c = do_continue
 
 do_q = do_quit
 
 do_a = do_args
 
 do_rv = do_retval
 
 do_l = do_list
 
 help_bt = help_w
 
- Static Public Attributes inherited from Cmd
 prompt = PROMPT
 
 identchars = IDENTCHARS
 
string ruler = '='
 
string lastcmd = ''
 
list cmdqueue = []
 
 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"
 
int use_rawinput = 1
 

Detailed Description

Definition at line 46 of file pdb.py.

Constructor & Destructor Documentation

def __init__ (   self)

Definition at line 48 of file pdb.py.

References Bdb.__init__(), and Cmd.__init__().

48 
49  def __init__(self):
50  bdb.Bdb.__init__(self)
52  self.prompt = '(Pdb) '
53  self.aliases = {}
54  # Try to load readline if it exists
55  try:
56  import readline
57  except ImportError:
58  pass
59 
60  # Read $HOME/.pdbrc and ./.pdbrc
61  self.rcLines = []
62  if os.environ.has_key('HOME'):
63  envHome = os.environ['HOME']
64  try:
65  rcFile = open(os.path.join(envHome, ".pdbrc"))
66  except IOError:
67  pass
68  else:
69  for line in rcFile.readlines():
70  self.rcLines.append(line)
71  rcFile.close()
72  try:
73  rcFile = open(".pdbrc")
74  except IOError:
75  pass
76  else:
77  for line in rcFile.readlines():
78  self.rcLines.append(line)
79  rcFile.close()

Member Function Documentation

def checkline (   self,
  filename,
  lineno 
)
Return line number of first line at or after input
argument such that if the input points to a 'def', the
returned line number is the first
non-blank/non-comment line to follow.  If the input
points to a blank or comment line, return 0.  At end
of file, also return 0.

Definition at line 310 of file pdb.py.

References linecache.getline().

311  def checkline(self, filename, lineno):
312  """Return line number of first line at or after input
313  argument such that if the input points to a 'def', the
314  returned line number is the first
315  non-blank/non-comment line to follow. If the input
316  points to a blank or comment line, return 0. At end
317  of file, also return 0."""
318 
319  line = linecache.getline(filename, lineno)
320  if not line:
321  print 'End of file'
322  return 0
323  line = line.strip()
324  # Don't allow setting breakpoint at a blank line
325  if ( not line or (line[0] == '#') or
326  (line[:3] == '"""') or line[:3] == "'''" ):
327  print '*** Blank or comment'
328  return 0
329  # When a file is read in and a breakpoint is at
330  # the 'def' statement, the system stops there at
331  # code parse time. We don't want that, so all breakpoints
332  # set at 'def' statements are moved one line onward
333  if line[:3] == 'def':
334  instr = ''
335  brackets = 0
336  while 1:
337  skipone = 0
338  for c in line:
339  if instr:
340  if skipone:
341  skipone = 0
342  elif c == '\\':
343  skipone = 1
344  elif c == instr:
345  instr = ''
346  elif c == '#':
347  break
348  elif c in ('"',"'"):
349  instr = c
350  elif c in ('(','{','['):
351  brackets = brackets + 1
352  elif c in (')','}',']'):
353  brackets = brackets - 1
354  lineno = lineno+1
355  line = linecache.getline(filename, lineno)
356  if not line:
357  print 'end of file'
358  return 0
359  line = line.strip()
360  if not line: continue # Blank line
361  if brackets <= 0 and line[0] not in ('#','"',"'"):
362  break
363  return lineno
def default (   self,
  line 
)

Definition at line 138 of file pdb.py.

References pre.compile().

139  def default(self, line):
140  if line[:1] == '!': line = line[1:]
141  locals = self.curframe.f_locals
142  globals = self.curframe.f_globals
143  try:
144  code = compile(line + '\n', '<stdin>', 'single')
145  exec code in globals, locals
146  except:
147  t, v = sys.exc_info()[:2]
148  if type(t) == type(''):
149  exc_type_name = t
150  else: exc_type_name = t.__name__
151  print '***', exc_type_name + ':', v
def defaultFile (   self)
Produce a reasonable default.

Definition at line 265 of file pdb.py.

266  def defaultFile(self):
267  """Produce a reasonable default."""
268  filename = self.curframe.f_code.co_filename
269  if filename == '<string>' and mainpyfile:
270  filename = mainpyfile
271  return filename
def do_alias (   self,
  arg 
)

Definition at line 608 of file pdb.py.

References Pdb.aliases, and dospath.join().

609  def do_alias(self, arg):
610  args = arg.split()
611  if len(args) == 0:
612  keys = self.aliases.keys()
613  keys.sort()
614  for alias in keys:
615  print "%s = %s" % (alias, self.aliases[alias])
616  return
617  if self.aliases.has_key(args[0]) and len (args) == 1:
618  print "%s = %s" % (args[0], self.aliases[args[0]])
619  else:
620  self.aliases[args[0]] = ' '.join(args[1:])
def do_args (   self,
  arg 
)

Definition at line 501 of file pdb.py.

References Pdb.curframe.

502  def do_args(self, arg):
503  f = self.curframe
504  co = f.f_code
505  dict = f.f_locals
506  n = co.co_argcount
507  if co.co_flags & 4: n = n+1
508  if co.co_flags & 8: n = n+1
509  for i in range(n):
510  name = co.co_varnames[i]
511  print name, '=',
512  if dict.has_key(name): print dict[name]
else: print "*** undefined ***"
def do_break (   self,
  arg,
  temporary = 0 
)

Definition at line 186 of file pdb.py.

References Bdb.breaks, Pdb.checkline(), Pdb.defaultFile(), Bdb.get_breaks(), Pdb.lineinfo(), Pdb.lookupmodule(), string.lstrip(), string.rstrip(), and Bdb.set_break().

187  def do_break(self, arg, temporary = 0):
188  # break [ ([filename:]lineno | function) [, "condition"] ]
189  if not arg:
190  if self.breaks: # There's at least one
191  print "Num Type Disp Enb Where"
192  for bp in bdb.Breakpoint.bpbynumber:
193  if bp:
194  bp.bpprint()
195  return
196  # parse arguments; comma has lowest precedence
197  # and cannot occur in filename
198  filename = None
199  lineno = None
200  cond = None
201  comma = arg.find(',')
202  if comma > 0:
203  # parse stuff after comma: "condition"
204  cond = arg[comma+1:].lstrip()
205  arg = arg[:comma].rstrip()
206  # parse stuff before comma: [filename:]lineno | function
207  colon = arg.rfind(':')
208  if colon >= 0:
209  filename = arg[:colon].rstrip()
210  f = self.lookupmodule(filename)
211  if not f:
212  print '*** ', `filename`,
213  print 'not found from sys.path'
214  return
215  else:
216  filename = f
217  arg = arg[colon+1:].lstrip()
218  try:
219  lineno = int(arg)
220  except ValueError, msg:
221  print '*** Bad lineno:', arg
222  return
223  else:
224  # no colon; can be lineno or function
225  try:
226  lineno = int(arg)
227  except ValueError:
228  try:
229  func = eval(arg,
230  self.curframe.f_globals,
231  self.curframe.f_locals)
232  except:
233  func = arg
234  try:
235  if hasattr(func, 'im_func'):
236  func = func.im_func
237  code = func.func_code
238  lineno = code.co_firstlineno
239  filename = code.co_filename
240  except:
241  # last thing to try
242  (ok, filename, ln) = self.lineinfo(arg)
243  if not ok:
244  print '*** The specified object',
245  print `arg`,
246  print 'is not a function'
247  print ('or was not found '
248  'along sys.path.')
249  return
250  lineno = int(ln)
251  if not filename:
252  filename = self.defaultFile()
253  # Check for reasonable breakpoint
254  line = self.checkline(filename, lineno)
255  if line:
256  # now set the break point
257  err = self.set_break(filename, line, temporary, cond)
258  if err: print '***', err
259  else:
260  bp = self.get_breaks(filename, line)[-1]
261  print "Breakpoint %d at %s:%d" % (bp.number,
262  bp.file,
263  bp.line)
def do_clear (   self,
  arg 
)
Three possibilities, tried in this order:
clear -> clear all breaks, ask for confirmation
clear file:lineno -> clear all breaks at file:lineno
clear bpno bpno ... -> clear breakpoints by number

Definition at line 415 of file pdb.py.

References Bdb.clear_all_breaks(), Bdb.clear_bpbynumber(), Bdb.clear_break(), and string.lower().

416  def do_clear(self, arg):
417  """Three possibilities, tried in this order:
418  clear -> clear all breaks, ask for confirmation
419  clear file:lineno -> clear all breaks at file:lineno
420  clear bpno bpno ... -> clear breakpoints by number"""
421  if not arg:
422  try:
423  reply = raw_input('Clear all breaks? ')
424  except EOFError:
425  reply = 'no'
426  reply = reply.strip().lower()
427  if reply in ('y', 'yes'):
428  self.clear_all_breaks()
429  return
430  if ':' in arg:
431  # Make sure it works for "clear C:\foo\bar.py:12"
432  i = arg.rfind(':')
433  filename = arg[:i]
434  arg = arg[i+1:]
435  try:
436  lineno = int(arg)
437  except:
438  err = "Invalid line number (%s)" % arg
439  else:
440  err = self.clear_break(filename, lineno)
441  if err: print '***', err
442  return
443  numberlist = arg.split()
444  for i in numberlist:
445  err = self.clear_bpbynumber(i)
446  if err:
447  print '***', err
448  else:
print 'Deleted breakpoint %s ' % (i,)
def do_condition (   self,
  arg 
)

Definition at line 378 of file pdb.py.

References string.strip().

379  def do_condition(self, arg):
380  # arg is breakpoint number and condition
381  args = arg.split(' ', 1)
382  bpnum = int(args[0].strip())
383  try:
384  cond = args[1]
385  except:
386  cond = None
387  bp = bdb.Breakpoint.bpbynumber[bpnum]
388  if bp:
389  bp.cond = cond
390  if not cond:
391  print 'Breakpoint', bpnum,
392  print 'is now unconditional.'
def do_continue (   self,
  arg 
)

Definition at line 491 of file pdb.py.

References Bdb.set_continue().

492  def do_continue(self, arg):
493  self.set_continue()
return 1
def do_disable (   self,
  arg 
)

Definition at line 371 of file pdb.py.

372  def do_disable(self, arg):
373  args = arg.split()
374  for i in args:
375  bp = bdb.Breakpoint.bpbynumber[int(i)]
376  if bp:
377  bp.disable()
def do_down (   self,
  arg 
)

Definition at line 466 of file pdb.py.

References Pdb.curframe, Pdb.curindex, NetrcParseError.lineno, Pdb.lineno, MissingSectionHeaderError.lineno, Pdb.print_stack_entry(), MultiFile.stack, and Pdb.stack.

467  def do_down(self, arg):
468  if self.curindex + 1 == len(self.stack):
469  print '*** Newest frame'
470  else:
471  self.curindex = self.curindex + 1
472  self.curframe = self.stack[self.curindex][0]
473  self.print_stack_entry(self.stack[self.curindex])
self.lineno = None
def do_enable (   self,
  arg 
)

Definition at line 364 of file pdb.py.

365  def do_enable(self, arg):
366  args = arg.split()
367  for i in args:
368  bp = bdb.Breakpoint.bpbynumber[int(i)]
369  if bp:
370  bp.enable()
def do_EOF (   self,
  arg 
)

Definition at line 183 of file pdb.py.

184  def do_EOF(self, arg):
185  return 0 # Don't die on EOF
def do_ignore (   self,
  arg 
)
arg is bp number followed by ignore count.

Definition at line 393 of file pdb.py.

References string.strip().

394  def do_ignore(self,arg):
395  """arg is bp number followed by ignore count."""
396  args = arg.split()
397  bpnum = int(args[0].strip())
398  try:
399  count = int(args[1].strip())
400  except:
401  count = 0
402  bp = bdb.Breakpoint.bpbynumber[bpnum]
403  if bp:
404  bp.ignore = count
405  if (count > 0):
406  reply = 'Will ignore next '
407  if (count > 1):
408  reply = reply + '%d crossings' % count
409  else:
410  reply = reply + '1 crossing'
411  print reply + ' of breakpoint %d.' % bpnum
412  else:
413  print 'Will stop next time breakpoint',
414  print bpnum, 'is reached.'
def do_list (   self,
  arg 
)

Definition at line 536 of file pdb.py.

537  def do_list(self, arg):
538  self.lastcmd = 'list'
539  last = None
540  if arg:
541  try:
542  x = eval(arg, {}, {})
543  if type(x) == type(()):
544  first, last = x
545  first = int(first)
546  last = int(last)
547  if last < first:
548  # Assume it's a count
549  last = first + last
550  else:
551  first = max(1, int(x) - 5)
552  except:
553  print '*** Error in argument:', `arg`
554  return
555  elif self.lineno is None:
556  first = max(1, self.curframe.f_lineno - 5)
557  else:
558  first = self.lineno + 1
559  if last is None:
560  last = first + 10
561  filename = self.curframe.f_code.co_filename
562  breaklist = self.get_file_breaks(filename)
563  try:
564  for lineno in range(first, last+1):
565  line = linecache.getline(filename, lineno)
566  if not line:
567  print '[EOF]'
568  break
569  else:
570  s = `lineno`.rjust(3)
571  if len(s) < 4: s = s + ' '
572  if lineno in breaklist: s = s + 'B'
573  else: s = s + ' '
574  if lineno == self.curframe.f_lineno:
575  s = s + '->'
576  print s + '\t' + line,
577  self.lineno = lineno
578  except KeyboardInterrupt:
pass
def do_next (   self,
  arg 
)

Definition at line 481 of file pdb.py.

References Pdb.curframe, and Bdb.set_next().

482  def do_next(self, arg):
483  self.set_next(self.curframe)
return 1
def do_p (   self,
  arg 
)

Definition at line 522 of file pdb.py.

523  def do_p(self, arg):
524  try:
525  value = eval(arg, self.curframe.f_globals,
526  self.curframe.f_locals)
527  except:
528  t, v = sys.exc_info()[:2]
529  if type(t) == type(''):
530  exc_type_name = t
531  else: exc_type_name = t.__name__
532  print '***', exc_type_name + ':', `v`
533  return
534 
535  print `value`
def do_quit (   self,
  arg 
)

Definition at line 496 of file pdb.py.

References Bdb.set_quit().

497  def do_quit(self, arg):
498  self.set_quit()
return 1
def do_return (   self,
  arg 
)

Definition at line 486 of file pdb.py.

References Pdb.curframe, and Bdb.set_return().

487  def do_return(self, arg):
488  self.set_return(self.curframe)
return 1
def do_retval (   self,
  arg 
)

Definition at line 515 of file pdb.py.

516  def do_retval(self, arg):
517  if self.curframe.f_locals.has_key('__return__'):
518  print self.curframe.f_locals['__return__']
519  else:
print '*** Not yet returned!'
def do_step (   self,
  arg 
)

Definition at line 476 of file pdb.py.

References Bdb.set_step().

477  def do_step(self, arg):
478  self.set_step()
return 1
def do_tbreak (   self,
  arg 
)

Definition at line 274 of file pdb.py.

References Pdb.do_break().

275  def do_tbreak(self, arg):
276  self.do_break(arg, 1)
def do_unalias (   self,
  arg 
)

Definition at line 621 of file pdb.py.

References Pdb.aliases.

622  def do_unalias(self, arg):
623  args = arg.split()
624  if len(args) == 0: return
625  if self.aliases.has_key(args[0]):
626  del self.aliases[args[0]]
def do_up (   self,
  arg 
)

Definition at line 456 of file pdb.py.

References Pdb.curframe, Pdb.curindex, NetrcParseError.lineno, Pdb.lineno, MissingSectionHeaderError.lineno, Pdb.print_stack_entry(), MultiFile.stack, and Pdb.stack.

457  def do_up(self, arg):
458  if self.curindex == 0:
459  print '*** Oldest frame'
460  else:
461  self.curindex = self.curindex - 1
462  self.curframe = self.stack[self.curindex][0]
463  self.print_stack_entry(self.stack[self.curindex])
self.lineno = None
def do_whatis (   self,
  arg 
)

Definition at line 581 of file pdb.py.

582  def do_whatis(self, arg):
583  try:
584  value = eval(arg, self.curframe.f_globals,
585  self.curframe.f_locals)
586  except:
587  t, v = sys.exc_info()[:2]
588  if type(t) == type(''):
589  exc_type_name = t
590  else: exc_type_name = t.__name__
591  print '***', exc_type_name + ':', `v`
592  return
593  code = None
594  # Is it a function?
595  try: code = value.func_code
596  except: pass
597  if code:
598  print 'Function', code.co_name
599  return
600  # Is it an instance method?
601  try: code = value.im_func.func_code
602  except: pass
603  if code:
604  print 'Method', code.co_name
605  return
606  # None of the above...
607  print type(value)
def do_where (   self,
  arg 
)

Definition at line 451 of file pdb.py.

References Pdb.print_stack_trace().

452  def do_where(self, arg):
self.print_stack_trace()
def execRcLines (   self)

Definition at line 97 of file pdb.py.

References Cmd.onecmd(), and Pdb.rcLines.

97 
98  def execRcLines(self):
99  if self.rcLines:
100  # Make local copy because of recursion
101  rcLines = self.rcLines
102  # executed only once
103  self.rcLines = []
104  for line in rcLines:
105  line = line[:-1]
106  if len (line) > 0 and line[0] != '#':
107  self.onecmd (line)
def forget (   self)

Definition at line 84 of file pdb.py.

84 
85  def forget(self):
86  self.lineno = None
87  self.stack = []
88  self.curindex = 0
89  self.curframe = None
def help_a (   self)

Definition at line 799 of file pdb.py.

800  def help_a(self):
801  print """a(rgs)
802 Print the arguments of the current function."""
def help_alias (   self)

Definition at line 833 of file pdb.py.

834  def help_alias(self):
835  print """alias [name [command [parameter parameter ...] ]]
836 Creates an alias called 'name' the executes 'command'. The command
837 must *not* be enclosed in quotes. Replaceable parameters are
838 indicated by %1, %2, and so on, while %* is replaced by all the
839 parameters. If no command is given, the current alias for name
840 is shown. If no name is given, all aliases are listed.
841 
842 Aliases may be nested and can contain anything that can be
843 legally typed at the pdb prompt. Note! You *can* override
844 internal pdb commands with aliases! Those internal commands
845 are then hidden until the alias is removed. Aliasing is recursively
846 applied to the first word of the command line; all other words
847 in the line are left alone.
848 
849 Some useful aliases (especially when placed in the .pdbrc file) are:
850 
851 #Print instance variables (usage "pi classInst")
852 alias pi for k in %1.__dict__.keys(): print "%1.",k,"=",%1.__dict__[k]
853 
854 #Print instance variables in self
855 alias ps pi self
856 """
def help_args (   self)

Definition at line 796 of file pdb.py.

References Pdb.help_a().

797  def help_args(self):
798  self.help_a()
def help_b (   self)

Definition at line 693 of file pdb.py.

694  def help_b(self):
695  print """b(reak) ([file:]lineno | function) [, condition]
696 With a line number argument, set a break there in the current
697 file. With a function name, set a break at first executable line
698 of that function. Without argument, list all breaks. If a second
699 argument is present, it is a string specifying an expression
700 which must evaluate to true before the breakpoint is honored.
701 
702 The line number may be prefixed with a filename and a colon,
703 to specify a breakpoint in another file (probably one that
704 hasn't been loaded yet). The file is searched for on sys.path;
705 the .py suffix may be omitted."""
def help_break (   self)

Definition at line 690 of file pdb.py.

References Pdb.help_b().

691  def help_break(self):
692  self.help_b()
def help_c (   self)

Definition at line 780 of file pdb.py.

781  def help_c(self):
782  print """c(ont(inue))
783 Continue execution, only stop when a breakpoint is encountered."""
def help_cl (   self)

Definition at line 709 of file pdb.py.

710  def help_cl(self):
711  print "cl(ear) filename:lineno"
712  print """cl(ear) [bpnumber [bpnumber...]]
713 With a space separated list of breakpoint numbers, clear
714 those breakpoints. Without argument, clear all breaks (but
715 first ask confirmation). With a filename:lineno argument,
716 clear all breaks at that line in that file.
717 
718 Note that the argument is different from previous versions of
719 the debugger (in python distributions 1.5.1 and before) where
720 a linenumber was used instead of either filename:lineno or
721 breakpoint numbers."""
def help_clear (   self)

Definition at line 706 of file pdb.py.

References Pdb.help_cl().

707  def help_clear(self):
708  self.help_cl()
def help_condition (   self)

Definition at line 744 of file pdb.py.

745  def help_condition(self):
746  print """condition bpnumber str_condition
747 str_condition is a string specifying an expression which
748 must evaluate to true before the breakpoint is honored.
749 If str_condition is absent, any existing condition is removed;
750 i.e., the breakpoint is made unconditional."""
def help_cont (   self)

Definition at line 777 of file pdb.py.

References Pdb.help_c().

778  def help_cont(self):
779  self.help_c()
def help_continue (   self)

Definition at line 774 of file pdb.py.

References Pdb.help_c().

775  def help_continue(self):
776  self.help_c()
def help_d (   self)

Definition at line 677 of file pdb.py.

678  def help_d(self):
679  print """d(own)
680 Move the current frame one level down in the stack trace
681 (to an older frame)."""
def help_disable (   self)

Definition at line 731 of file pdb.py.

732  def help_disable(self):
733  print """disable bpnumber [bpnumber ...]
734 Disables the breakpoints given as a space separated list of
735 bp numbers."""
def help_down (   self)

Definition at line 674 of file pdb.py.

References Pdb.help_d().

675  def help_down(self):
676  self.help_d()
def help_enable (   self)

Definition at line 726 of file pdb.py.

727  def help_enable(self):
728  print """enable bpnumber [bpnumber ...]
729 Enables the breakpoints given as a space separated list of
730 bp numbers."""
def help_EOF (   self)

Definition at line 829 of file pdb.py.

830  def help_EOF(self):
831  print """EOF
832 Handles the receipt of EOF as a command."""
def help_exec (   self)

Definition at line 807 of file pdb.py.

808  def help_exec(self):
809  print """(!) statement
810 Execute the (one-line) statement in the context of
811 the current stack frame.
812 The exclamation point can be omitted unless the first word
813 of the statement resembles a debugger command.
814 To assign to a global variable you must always prefix the
815 command with a 'global' command, e.g.:
816 (Pdb) global list_options; list_options = ['-l']
817 (Pdb)"""
def help_h (   self)

Definition at line 656 of file pdb.py.

657  def help_h(self):
658  print """h(elp)
659 Without argument, print the list of available commands.
660 With a command name as argument, print help about that command
661 "help pdb" pipes the full documentation file to the $PAGER
662 "help exec" gives help on the ! command"""
def help_help (   self)

Definition at line 653 of file pdb.py.

References Pdb.help_h().

654  def help_help(self):
655  self.help_h()
def help_ignore (   self)

Definition at line 736 of file pdb.py.

737  def help_ignore(self):
738  print """ignore bpnumber count
739 Sets the ignore count for the given breakpoint number. A breakpoint
740 becomes active when the ignore count is zero. When non-zero, the
741 count is decremented each time the breakpoint is reached and the
742 breakpoint is not disabled and any associated condition evaluates
743 to true."""
def help_l (   self)

Definition at line 787 of file pdb.py.

788  def help_l(self):
789  print """l(ist) [first [,last]]
790 List source code for the current file.
791 Without arguments, list 11 lines around the current line
792 or continue the previous listing.
793 With one argument, list 11 lines starting at that line.
794 With two arguments, list the given range;
795 if the second argument is less than the first, it is a count."""
def help_list (   self)

Definition at line 784 of file pdb.py.

References Pdb.help_l().

785  def help_list(self):
786  self.help_l()
def help_n (   self)

Definition at line 762 of file pdb.py.

763  def help_n(self):
764  print """n(ext)
765 Continue execution until the next line in the current function
766 is reached or it returns."""
def help_next (   self)

Definition at line 759 of file pdb.py.

References Pdb.help_n().

760  def help_next(self):
761  self.help_n()
def help_p (   self)

Definition at line 803 of file pdb.py.

804  def help_p(self):
805  print """p expression
806 Print the value of the expression."""
def help_pdb (   self)

Definition at line 861 of file pdb.py.

References pdb.help().

862  def help_pdb(self):
863  help()
def help_q (   self)

Definition at line 821 of file pdb.py.

822  def help_q(self):
823  print """q(uit) Quit from the debugger.
824 The program being executed is aborted."""
def help_quit (   self)

Definition at line 818 of file pdb.py.

References Pdb.help_q().

819  def help_quit(self):
820  self.help_q()
def help_r (   self)

Definition at line 770 of file pdb.py.

771  def help_r(self):
772  print """r(eturn)
773 Continue execution until the current function returns."""
def help_return (   self)

Definition at line 767 of file pdb.py.

References Pdb.help_r().

768  def help_return(self):
769  self.help_r()
def help_s (   self)

Definition at line 754 of file pdb.py.

755  def help_s(self):
756  print """s(tep)
757 Execute the current line, stop at the first possible occasion
758 (either in a function that is called or in the current function)."""
def help_step (   self)

Definition at line 751 of file pdb.py.

References Pdb.help_s().

752  def help_step(self):
753  self.help_s()
def help_tbreak (   self)

Definition at line 722 of file pdb.py.

723  def help_tbreak(self):
724  print """tbreak same arguments as break, but breakpoint is
725 removed when first hit."""
def help_u (   self)

Definition at line 685 of file pdb.py.

686  def help_u(self):
687  print """u(p)
688 Move the current frame one level up in the stack trace
689 (to a newer frame)."""
def help_unalias (   self)

Definition at line 857 of file pdb.py.

858  def help_unalias(self):
859  print """unalias name
860 Deletes the specified alias."""
def help_up (   self)

Definition at line 682 of file pdb.py.

References Pdb.help_u().

683  def help_up(self):
684  self.help_u()
def help_w (   self)

Definition at line 666 of file pdb.py.

667  def help_w(self):
668  print """w(here)
669 Print a stack trace, with the most recent frame at the bottom.
670 An arrow indicates the "current frame", which determines the
671 context of most commands. 'bt' is an alias for this command."""
def help_whatis (   self)

Definition at line 825 of file pdb.py.

826  def help_whatis(self):
827  print """whatis arg
828 Prints the type of the argument."""
def help_where (   self)

Definition at line 663 of file pdb.py.

References Pdb.help_w().

664  def help_where(self):
665  self.help_w()
def interaction (   self,
  frame,
  traceback 
)

Definition at line 132 of file pdb.py.

References Cmd.cmdloop(), Pdb.curindex, Pdb.forget(), Pdb.print_stack_entry(), Pdb.setup(), MultiFile.stack, and Pdb.stack.

133  def interaction(self, frame, traceback):
134  self.setup(frame, traceback)
135  self.print_stack_entry(self.stack[self.curindex])
136  self.cmdloop()
137  self.forget()
def lineinfo (   self,
  identifier 
)

Definition at line 277 of file pdb.py.

References Pdb.defaultFile(), pdb.find_function(), Pdb.lookupmodule(), and string.strip().

278  def lineinfo(self, identifier):
279  failed = (None, None, None)
280  # Input is identifier, may be in single quotes
281  idstring = identifier.split("'")
282  if len(idstring) == 1:
283  # not in single quotes
284  id = idstring[0].strip()
285  elif len(idstring) == 3:
286  # quoted
287  id = idstring[1].strip()
288  else:
289  return failed
290  if id == '': return failed
291  parts = id.split('.')
292  # Protection for derived debuggers
293  if parts[0] == 'self':
294  del parts[0]
295  if len(parts) == 0:
296  return failed
297  # Best first guess at file to look at
298  fname = self.defaultFile()
299  if len(parts) == 1:
300  item = parts[0]
301  else:
302  # More than one part.
303  # First is module, second is method/class
304  f = self.lookupmodule(parts[0])
305  if f:
306  fname = f
307  item = parts[1]
308  answer = find_function(item, fname)
309  return answer or failed
def lookupmodule (   self,
  filename 
)
Helper function for break/clear parsing -- may be overridden.

Definition at line 864 of file pdb.py.

865  def lookupmodule(self, filename):
866  """Helper function for break/clear parsing -- may be overridden."""
867  root, ext = os.path.splitext(filename)
868  if ext == '':
869  filename = filename + '.py'
870  if os.path.isabs(filename):
871  return filename
872  for dirname in sys.path:
873  while os.path.islink(dirname):
874  dirname = os.readlink(dirname)
875  fullname = os.path.join(dirname, filename)
876  if os.path.exists(fullname):
877  return fullname
878  return None
879 
880 # Simplified interface
def precmd (   self,
  line 
)
Handle alias expansion and ';;' separator.

Definition at line 152 of file pdb.py.

References Pdb.aliases, dospath.join(), string.lstrip(), string.rstrip(), and locale.str().

153  def precmd(self, line):
154  """Handle alias expansion and ';;' separator."""
155  if not line:
156  return line
157  args = line.split()
158  while self.aliases.has_key(args[0]):
159  line = self.aliases[args[0]]
160  ii = 1
161  for tmpArg in args[1:]:
162  line = line.replace("%" + str(ii),
163  tmpArg)
164  ii = ii + 1
165  line = line.replace("%*", ' '.join(args[1:]))
166  args = line.split()
167  # split into ';;' separated commands
168  # unless it's an alias command
169  if args[0] != 'alias':
170  marker = line.find(';;')
171  if marker >= 0:
172  # queue up everything after marker
173  next = line[marker+2:].lstrip()
174  self.cmdqueue.append(next)
175  line = line[:marker].rstrip()
176  return line
def print_stack_entry (   self,
  frame_lineno,
  prompt_prefix = line_prefix 
)

Definition at line 642 of file pdb.py.

References Pdb.curframe, and Bdb.format_stack_entry().

643  def print_stack_entry(self, frame_lineno, prompt_prefix=line_prefix):
644  frame, lineno = frame_lineno
645  if frame is self.curframe:
646  print '>',
647  else:
648  print ' ',
649  print self.format_stack_entry(frame_lineno, prompt_prefix)
650 
def print_stack_trace (   self)

Definition at line 635 of file pdb.py.

References Pdb.print_stack_entry(), MultiFile.stack, and Pdb.stack.

636  def print_stack_trace(self):
637  try:
638  for frame_lineno in self.stack:
639  self.print_stack_entry(frame_lineno)
640  except KeyboardInterrupt:
641  pass
def reset (   self)

Definition at line 80 of file pdb.py.

References Pdb.forget(), and Bdb.reset().

80 
81  def reset(self):
82  bdb.Bdb.reset(self)
83  self.forget()
def setup (   self,
  f,
  t 
)

Definition at line 90 of file pdb.py.

References Pdb.curframe, Pdb.curindex, Pdb.execRcLines(), Pdb.forget(), Bdb.get_stack(), MultiFile.stack, and Pdb.stack.

90 
91  def setup(self, f, t):
92  self.forget()
93  self.stack, self.curindex = self.get_stack(f, t)
94  self.curframe = self.stack[self.curindex][0]
95  self.execRcLines()
def user_exception (   self,
  frame,
  exc_type,
  exc_value,
  exc_traceback 
)
This function is called if an exception occurs,
but only if we are to stop at or just below this level.

Definition at line 120 of file pdb.py.

References Pdb.interaction().

121  def user_exception(self, frame, (exc_type, exc_value, exc_traceback)):
122  """This function is called if an exception occurs,
123  but only if we are to stop at or just below this level."""
124  frame.f_locals['__exception__'] = exc_type, exc_value
125  if type(exc_type) == type(''):
126  exc_type_name = exc_type
127  else: exc_type_name = exc_type.__name__
128  print exc_type_name + ':', _saferepr(exc_value)
129  self.interaction(frame, exc_traceback)
def user_line (   self,
  frame 
)
This function is called when we stop or break at this line.

Definition at line 110 of file pdb.py.

References Pdb.interaction().

111  def user_line(self, frame):
112  """This function is called when we stop or break at this line."""
113  self.interaction(frame, None)
def user_return (   self,
  frame,
  return_value 
)
This function is called when a return trap is set here.

Definition at line 114 of file pdb.py.

References Pdb.interaction().

115  def user_return(self, frame, return_value):
116  """This function is called when a return trap is set here."""
117  frame.f_locals['__return__'] = return_value
118  print '--Return--'
119  self.interaction(frame, None)

Field Documentation

aliases

Definition at line 52 of file pdb.py.

curframe

Definition at line 88 of file pdb.py.

curindex

Definition at line 87 of file pdb.py.

do_a = do_args
static

Definition at line 513 of file pdb.py.

do_b = do_break
static

Definition at line 272 of file pdb.py.

do_bt = do_where
static

Definition at line 454 of file pdb.py.

do_c = do_continue
static

Definition at line 494 of file pdb.py.

do_cl = do_clear
static

Definition at line 449 of file pdb.py.

do_d = do_down
static

Definition at line 474 of file pdb.py.

do_h = cmd.Cmd.do_help
static

Definition at line 181 of file pdb.py.

do_l = do_list
static

Definition at line 579 of file pdb.py.

do_n = do_next
static

Definition at line 484 of file pdb.py.

do_q = do_quit
static

Definition at line 499 of file pdb.py.

do_r = do_return
static

Definition at line 489 of file pdb.py.

do_rv = do_retval
static

Definition at line 520 of file pdb.py.

do_s = do_step
static

Definition at line 479 of file pdb.py.

do_u = do_up
static

Definition at line 464 of file pdb.py.

do_w = do_where
static

Definition at line 453 of file pdb.py.

help_bt = help_w
static

Definition at line 672 of file pdb.py.

lastcmd

Definition at line 537 of file pdb.py.

lineno

Definition at line 85 of file pdb.py.

prompt

Definition at line 51 of file pdb.py.

rcLines

Definition at line 60 of file pdb.py.

stack

Definition at line 86 of file pdb.py.


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