Lines Matching refs:frame
27 Whether a frame is considered to originate in a certain module
28 is determined by the __name__ in the frame globals.
63 def trace_dispatch(self, frame, event, arg):
69 dispatch a frame, depending on the type of event (passed in as a
90 return self.dispatch_line(frame)
92 return self.dispatch_call(frame, arg)
94 return self.dispatch_return(frame, arg)
96 return self.dispatch_exception(frame, arg)
106 def dispatch_line(self, frame):
113 if self.stop_here(frame) or self.break_here(frame):
114 self.user_line(frame)
118 def dispatch_call(self, frame, arg):
128 self.botframe = frame.f_back # (CT) Note that this may also be None!
130 if not (self.stop_here(frame) or self.break_anywhere(frame)):
134 if self.stopframe and frame.f_code.co_flags & GENERATOR_AND_COROUTINE_FLAGS:
136 self.user_call(frame, arg)
140 def dispatch_return(self, frame, arg):
147 if self.stop_here(frame) or frame == self.returnframe:
149 if self.stopframe and frame.f_code.co_flags & GENERATOR_AND_COROUTINE_FLAGS:
152 self.frame_returning = frame
153 self.user_return(frame, arg)
158 if self.stopframe is frame and self.stoplineno != -1:
162 def dispatch_exception(self, frame, arg):
169 if self.stop_here(frame):
170 # When stepping with next/until/return in a generator frame, skip
173 if not (frame.f_code.co_flags & GENERATOR_AND_COROUTINE_FLAGS
175 self.user_exception(frame, arg)
181 elif (self.stopframe and frame is not self.stopframe
184 self.user_exception(frame, arg)
202 def stop_here(self, frame):
203 "Return True if frame is below the starting frame in the stack."
207 self.is_skipped_module(frame.f_globals.get('__name__')):
209 if frame is self.stopframe:
212 return frame.f_lineno >= self.stoplineno
217 def break_here(self, frame):
223 filename = self.canonic(frame.f_code.co_filename)
226 lineno = frame.f_lineno
230 lineno = frame.f_code.co_firstlineno
235 (bp, flag) = effective(filename, lineno, frame)
251 def break_anywhere(self, frame):
252 """Return True if there is any breakpoint for frame's filename.
254 return self.canonic(frame.f_code.co_filename) in self.breaks
259 def user_call(self, frame, argument_list):
263 def user_line(self, frame):
267 def user_return(self, frame, return_value):
271 def user_exception(self, frame, exc_info):
292 def set_until(self, frame, lineno=None):
294 reached or when returning from current frame."""
297 lineno = frame.f_lineno + 1
298 self._set_stopinfo(frame, frame, lineno)
305 # for performance reasons) when returning from the current frame.
312 def set_next(self, frame):
313 """Stop on the next line in or below the given frame."""
314 self._set_stopinfo(frame, None)
316 def set_return(self, frame):
317 """Stop when returning from the given frame."""
318 if frame.f_code.co_flags & GENERATOR_AND_COROUTINE_FLAGS:
319 self._set_stopinfo(frame, None, -1)
321 self._set_stopinfo(frame.f_back, frame)
323 def set_trace(self, frame=None):
324 """Start debugging from frame.
326 If frame is not specified, debugging starts from caller's frame.
328 if frame is None:
329 frame = sys._getframe().f_back
331 while frame:
332 frame.f_trace = self.trace_dispatch
333 self.botframe = frame
334 frame = frame.f_back
348 frame = sys._getframe().f_back
349 while frame and frame is not self.botframe:
350 del frame.f_trace
351 frame = frame.f_back
529 """Return a list of (frame, lineno) in a stack trace and a size.
531 List starts with original calling frame, if there is one.
554 The stack entry frame_lineno is a (frame, lineno) tuple. The
561 frame, lineno = frame_lineno
562 filename = self.canonic(frame.f_code.co_filename)
564 if frame.f_code.co_name:
565 s += frame.f_code.co_name
569 if '__return__' in frame.f_locals:
570 rv = frame.f_locals['__return__']
574 line = linecache.getline(filename, lineno, frame.f_globals)
653 """Start debugging with a Bdb instance from the caller's frame."""
779 def checkfuncname(b, frame):
784 the one in the frame. If it was set via function name, check if this is
789 if b.line != frame.f_lineno:
796 if frame.f_code.co_name != b.funcname:
800 # We are in the right frame.
803 b.func_first_executable_line = frame.f_lineno
805 if b.func_first_executable_line != frame.f_lineno:
811 def effective(file, line, frame):
828 if not checkfuncname(b, frame):
845 val = eval(b.cond, frame.f_globals, frame.f_locals)
865 def user_call(self, frame, args):
866 name = frame.f_code.co_name
869 def user_line(self, frame):
871 name = frame.f_code.co_name
873 fn = self.canonic(frame.f_code.co_filename)
874 line = linecache.getline(fn, frame.f_lineno, frame.f_globals)
875 print('+++', fn, frame.f_lineno, name, ':', line.strip())
876 def user_return(self, frame, retval):
878 def user_exception(self, frame, exc_stuff):