277 @type depends on the previous event parameter |
277 @type depends on the previous event parameter |
278 @return local trace function |
278 @return local trace function |
279 @rtype trace function or None |
279 @rtype trace function or None |
280 @exception bdb.BdbQuit |
280 @exception bdb.BdbQuit |
281 """ |
281 """ |
282 if self.quitting: |
|
283 return # None |
|
284 |
|
285 # give the client a chance to push through new break points. |
282 # give the client a chance to push through new break points. |
286 if self.eventPollFlag: |
283 if self.eventPollFlag: |
287 self._dbgClient.eventPoll() |
284 self._dbgClient.eventPoll() |
288 self.eventPollFlag = False |
285 self.eventPollFlag = False |
|
286 |
|
287 if self.quitting: |
|
288 raise bdb.BdbQuit |
289 |
289 |
290 if event == 'line': |
290 if event == 'line': |
291 if self.stop_here(frame) or self.break_here(frame): |
291 if self.stop_here(frame) or self.break_here(frame): |
292 self.user_line(frame) |
292 self.user_line(frame) |
293 if self.quitting: |
|
294 raise bdb.BdbQuit |
|
295 return |
293 return |
296 |
294 |
297 if event == 'call': |
295 if event == 'call': |
298 if self.botframe is None: |
296 if self.botframe is None: |
299 # First call of dispatch since reset() |
297 # First call of dispatch since reset() |
304 if not (self.stop_here(frame) or |
302 if not (self.stop_here(frame) or |
305 self.__checkBreakInFrame(frame) or |
303 self.__checkBreakInFrame(frame) or |
306 Watch.watches != []): |
304 Watch.watches != []): |
307 # No need to trace this function |
305 # No need to trace this function |
308 return |
306 return |
309 if self.quitting: |
|
310 raise bdb.BdbQuit |
|
311 return self.trace_dispatch |
307 return self.trace_dispatch |
312 |
308 |
313 if event == 'return': |
309 if event == 'return': |
314 if self.stop_here(frame) or frame == self.returnframe: |
310 if self.stop_here(frame) or frame == self.returnframe: |
315 # Ignore return events in generator except when stepping. |
311 # Ignore return events in generator except when stepping. |
335 # triggered by a subiterator run with the 'yield from' |
331 # triggered by a subiterator run with the 'yield from' |
336 # statement. |
332 # statement. |
337 if not (frame.f_code.co_flags & CO_GENERATOR and |
333 if not (frame.f_code.co_flags & CO_GENERATOR and |
338 arg[0] is StopIteration and arg[2] is None): |
334 arg[0] is StopIteration and arg[2] is None): |
339 self.user_exception(frame, arg) |
335 self.user_exception(frame, arg) |
340 if self.quitting: |
|
341 raise bdb.BdbQuit |
|
342 # Stop at the StopIteration or GeneratorExit exception when the |
336 # Stop at the StopIteration or GeneratorExit exception when the |
343 # user has set stopframe in a generator by issuing a return |
337 # user has set stopframe in a generator by issuing a return |
344 # command, or a next/until command at the last statement in the |
338 # command, or a next/until command at the last statement in the |
345 # generator before the exception. |
339 # generator before the exception. |
346 elif (self.stopframe and frame is not self.stopframe and |
340 elif (self.stopframe and frame is not self.stopframe and |
347 self.stopframe.f_code.co_flags & CO_GENERATOR and |
341 self.stopframe.f_code.co_flags & CO_GENERATOR and |
348 arg[0] in (StopIteration, GeneratorExit)): |
342 arg[0] in (StopIteration, GeneratorExit)): |
349 self.user_exception(frame, arg) |
343 self.user_exception(frame, arg) |
350 if self.quitting: |
|
351 raise bdb.BdbQuit |
|
352 return |
344 return |
353 |
345 |
354 if event == 'c_call': |
346 if event == 'c_call': |
355 return |
347 return |
356 if event == 'c_exception': |
348 if event == 'c_exception': |