Dispatch a trace function for debugged frames based on the event. This function is installed as the trace function for debugged frames. Its return value is the new trace function, which is usually itself. The default implementation decides how to dispatch a frame, de
(self, frame, event, arg)
| 255 | self.enterframe = None |
| 256 | |
| 257 | def trace_dispatch(self, frame, event, arg): |
| 258 | """Dispatch a trace function for debugged frames based on the event. |
| 259 | |
| 260 | This function is installed as the trace function for debugged |
| 261 | frames. Its return value is the new trace function, which is |
| 262 | usually itself. The default implementation decides how to |
| 263 | dispatch a frame, depending on the type of event (passed in as a |
| 264 | string) that is about to be executed. |
| 265 | |
| 266 | The event can be one of the following: |
| 267 | line: A new line of code is going to be executed. |
| 268 | call: A function is about to be called or another code block |
| 269 | is entered. |
| 270 | return: A function or other code block is about to return. |
| 271 | exception: An exception has occurred. |
| 272 | |
| 273 | For all the events, specialized functions (see the dispatch_*() |
| 274 | methods) are called. |
| 275 | |
| 276 | The arg parameter depends on the previous event. |
| 277 | """ |
| 278 | |
| 279 | with self.set_enterframe(frame): |
| 280 | if self.quitting: |
| 281 | return # None |
| 282 | if event == 'line': |
| 283 | return self.dispatch_line(frame) |
| 284 | if event == 'call': |
| 285 | return self.dispatch_call(frame, arg) |
| 286 | if event == 'return': |
| 287 | return self.dispatch_return(frame, arg) |
| 288 | if event == 'exception': |
| 289 | return self.dispatch_exception(frame, arg) |
| 290 | if event == 'opcode': |
| 291 | return self.dispatch_opcode(frame, arg) |
| 292 | print('bdb.Bdb.dispatch: unknown debugging event:', repr(event)) |
| 293 | return self.trace_dispatch |
| 294 | |
| 295 | def dispatch_line(self, frame): |
| 296 | """Invoke user function and return trace function for line event. |
no test coverage detected