MCPcopy
hub / github.com/mitmproxy/mitmproxy / dump_stacks

Function dump_stacks

mitmproxy/utils/debug.py:114–125  ·  view source on GitHub ↗
(signal=None, frame=None, file=sys.stdout)

Source from the content-addressed store, hash-verified

112
113
114def dump_stacks(signal=None, frame=None, file=sys.stdout):
115 id2name = {th.ident: th.name for th in threading.enumerate()}
116 code = []
117 for threadId, stack in sys._current_frames().items():
118 code.append("\n# Thread: %s(%d)" % (id2name.get(threadId, ""), threadId))
119 for filename, lineno, name, line in traceback.extract_stack(stack):
120 code.append('File: "%s", line %d, in %s' % (filename, lineno, name))
121 if line:
122 code.append(" %s" % (line.strip()))
123 print("\n".join(code), file=file)
124 if os.getenv("MITMPROXY_DEBUG_EXIT"): # pragma: no cover
125 sys.exit(1)
126
127
128def register_info_dumpers():

Callers

nothing calls this directly

Calls 5

exitMethod · 0.80
itemsMethod · 0.45
appendMethod · 0.45
getMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…