@@ -68,7 +68,7 @@ def dispatch_exception(self, frame, arg):
6868 return self .trace_dispatch
6969
7070 # Normally derived classes don't override the following
71- # functions , but they may if they want to redefine the
71+ # methods , but they may if they want to redefine the
7272 # definition of stopping and breakpoints.
7373
7474 def stop_here (self , frame ):
@@ -93,28 +93,28 @@ def break_here(self, frame):
9393 def break_anywhere (self , frame ):
9494 return self .breaks .has_key (frame .f_code .co_filename )
9595
96- # Derived classes should override the user_* functions
96+ # Derived classes should override the user_* methods
9797 # to gain control.
9898
9999 def user_call (self , frame , argument_list ):
100- # This function is called when there is the remote possibility
100+ # This method is called when there is the remote possibility
101101 # that we ever need to stop in this function
102102 pass
103103
104104 def user_line (self , frame ):
105- # This function is called when we stop or break at this line
105+ # This method is called when we stop or break at this line
106106 pass
107107
108108 def user_return (self , frame , return_value ):
109- # This function is called when a return trap is set here
109+ # This method is called when a return trap is set here
110110 pass
111111
112112 def user_exception (self , frame , (exc_type , exc_value , exc_traceback )):
113- # This function is called if an exception occurs,
113+ # This method is called if an exception occurs,
114114 # but only if we are to stop at or just below this level
115115 pass
116116
117- # Derived classes and clients can call the following functions
117+ # Derived classes and clients can call the following methods
118118 # to affect the stepping state.
119119
120120 def set_step (self ):
@@ -147,8 +147,8 @@ def set_quit(self):
147147 self .quitting = 1
148148 sys .settrace (None )
149149
150- # Derived classes and clients can call the following functions
151- # to manipulate breakpoints. These functions return an
150+ # Derived classes and clients can call the following methods
151+ # to manipulate breakpoints. These methods return an
152152 # error message is something went wrong, None if all is well.
153153 # Call self.get_*break*() to see the breakpoints.
154154
@@ -196,7 +196,7 @@ def get_file_breaks(self, filename):
196196 def get_all_breaks (self ):
197197 return self .breaks
198198
199- # Derived classes and clients can call the following function
199+ # Derived classes and clients can call the following method
200200 # to get a data structure representing a stack trace.
201201
202202 def get_stack (self , f , t ):
@@ -234,7 +234,7 @@ def format_stack_entry(self, (frame, lineno)):
234234 if line : s = s + ': ' + string .strip (line )
235235 return s
236236
237- # The following two functions can be called by clients to use
237+ # The following two methods can be called by clients to use
238238 # a debugger to debug a statement, given as a string.
239239
240240 def run (self , cmd ):
@@ -253,7 +253,20 @@ def runctx(self, cmd, globals, locals):
253253 finally :
254254 self .quitting = 1
255255 sys .settrace (None )
256- # XXX What to do if the command finishes normally?
256+
257+ # This method is more useful to debug a single function call.
258+
259+ def runcall (self , func , * args ):
260+ self .reset ()
261+ sys .settrace (self .trace_dispatch )
262+ try :
263+ try :
264+ apply (func , args )
265+ except BdbQuit :
266+ pass
267+ finally :
268+ self .quitting = 1
269+ sys .settrace (None )
257270
258271
259272# -------------------- testing --------------------
0 commit comments