MCPcopy Index your code
hub / github.com/RustPython/RustPython / trace_dispatch

Method trace_dispatch

Lib/bdb.py:257–302  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 c_call: A C function is about to be called.
273 c_return: A C function has returned.
274 c_exception: A C function has raised an exception.
275
276 For the Python events, specialized functions (see the dispatch_*()
277 methods) are called. For the C events, no action is taken.
278
279 The arg parameter depends on the previous event.
280 """
281
282 with self.set_enterframe(frame):
283 if self.quitting:
284 return # None
285 if event == 'line':
286 return self.dispatch_line(frame)
287 if event == 'call':
288 return self.dispatch_call(frame, arg)
289 if event == 'return':
290 return self.dispatch_return(frame, arg)
291 if event == 'exception':
292 return self.dispatch_exception(frame, arg)
293 if event == 'c_call':
294 return self.trace_dispatch
295 if event == 'c_exception':
296 return self.trace_dispatch
297 if event == 'c_return':
298 return self.trace_dispatch
299 if event == 'opcode':
300 return self.dispatch_opcode(frame, arg)
301 print('bdb.Bdb.dispatch: unknown debugging event:', repr(event))
302 return self.trace_dispatch
303
304 def dispatch_line(self, frame):
305 """Invoke user function and return trace function for line event.

Callers

nothing calls this directly

Calls 8

set_enterframeMethod · 0.95
dispatch_lineMethod · 0.95
dispatch_callMethod · 0.95
dispatch_returnMethod · 0.95
dispatch_exceptionMethod · 0.95
dispatch_opcodeMethod · 0.95
reprFunction · 0.85
printFunction · 0.50

Tested by

no test coverage detected