MCPcopy Index your code
hub / github.com/python/cpython / print_traceback_helper

Function print_traceback_helper

Tools/gdb/libpython.py:2071–2102  ·  view source on GitHub ↗
(full_info)

Source from the content-addressed store, hash-verified

2069
2070
2071def print_traceback_helper(full_info):
2072 frame = Frame.get_selected_python_frame()
2073 interp_frame = PyFramePtr.get_thread_local_frame()
2074 if not frame and not interp_frame:
2075 print('Unable to locate python frame')
2076 return
2077
2078 sys.stdout.write('Traceback (most recent call first):\n')
2079 if frame:
2080 while frame:
2081 frame_index = frame.get_index() if full_info else None
2082 if frame.is_evalframe():
2083 pyop = frame.get_pyop()
2084 if pyop is not None:
2085 # Use the _PyInterpreterFrame from the gdb frame
2086 interp_frame = pyop
2087 if interp_frame:
2088 interp_frame = interp_frame.print_traceback_until_shim(frame_index)
2089 else:
2090 sys.stdout.write(' (unable to read python frame information)\n')
2091 else:
2092 info = frame.is_other_python_frame()
2093 if full_info:
2094 if info:
2095 sys.stdout.write('#%i %s\n' % (frame_index, info))
2096 elif info:
2097 sys.stdout.write(' %s\n' % info)
2098 frame = frame.older()
2099 else:
2100 # Fall back to just using the thread-local frame
2101 while interp_frame:
2102 interp_frame = interp_frame.print_traceback_until_shim()
2103
2104
2105class PyBacktraceFull(gdb.Command):

Callers 2

invokeMethod · 0.85
invokeMethod · 0.85

Calls 9

get_indexMethod · 0.80
is_evalframeMethod · 0.80
get_pyopMethod · 0.80
is_other_python_frameMethod · 0.80
olderMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…