MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / trace_dispatch

Method trace_dispatch

tools/python-3.11.9-amd64/Lib/bdb.py:63–104  ·  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 fram

(self, frame, event, arg)

Source from the content-addressed store, hash-verified

61 self._set_stopinfo(None, None)
62
63 def trace_dispatch(self, frame, event, arg):
64 """Dispatch a trace function for debugged frames based on the event.
65
66 This function is installed as the trace function for debugged
67 frames. Its return value is the new trace function, which is
68 usually itself. The default implementation decides how to
69 dispatch a frame, depending on the type of event (passed in as a
70 string) that is about to be executed.
71
72 The event can be one of the following:
73 line: A new line of code is going to be executed.
74 call: A function is about to be called or another code block
75 is entered.
76 return: A function or other code block is about to return.
77 exception: An exception has occurred.
78 c_call: A C function is about to be called.
79 c_return: A C function has returned.
80 c_exception: A C function has raised an exception.
81
82 For the Python events, specialized functions (see the dispatch_*()
83 methods) are called. For the C events, no action is taken.
84
85 The arg parameter depends on the previous event.
86 """
87 if self.quitting:
88 return # None
89 if event == 'line':
90 return self.dispatch_line(frame)
91 if event == 'call':
92 return self.dispatch_call(frame, arg)
93 if event == 'return':
94 return self.dispatch_return(frame, arg)
95 if event == 'exception':
96 return self.dispatch_exception(frame, arg)
97 if event == 'c_call':
98 return self.trace_dispatch
99 if event == 'c_exception':
100 return self.trace_dispatch
101 if event == 'c_return':
102 return self.trace_dispatch
103 print('bdb.Bdb.dispatch: unknown debugging event:', repr(event))
104 return self.trace_dispatch
105
106 def dispatch_line(self, frame):
107 """Invoke user function and return trace function for line event.

Callers

nothing calls this directly

Calls 5

dispatch_lineMethod · 0.95
dispatch_callMethod · 0.95
dispatch_returnMethod · 0.95
dispatch_exceptionMethod · 0.95
printFunction · 0.50

Tested by

no test coverage detected