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

Function move_in_stack

Tools/gdb/libpython.py:2007–2038  ·  view source on GitHub ↗

Move up or down the stack (for the py-up/py-down command)

(move_up)

Source from the content-addressed store, hash-verified

2005PyList()
2006
2007def move_in_stack(move_up):
2008 '''Move up or down the stack (for the py-up/py-down command)'''
2009 # Important:
2010 # The amount of frames that are printed out depends on how many frames are inlined
2011 # in the same evaluation loop. As this command links directly the C stack with the
2012 # Python stack, the results are sensitive to the number of inlined frames and this
2013 # is likely to change between versions and optimizations.
2014 frame = Frame.get_selected_python_frame()
2015 if not frame:
2016 print('Unable to locate python frame')
2017 return
2018 while frame:
2019 if move_up:
2020 iter_frame = frame.older()
2021 else:
2022 iter_frame = frame.newer()
2023
2024 if not iter_frame:
2025 break
2026
2027 if iter_frame.is_python_frame():
2028 # Result:
2029 if iter_frame.select():
2030 iter_frame.print_summary()
2031 return
2032
2033 frame = iter_frame
2034
2035 if move_up:
2036 print('Unable to find an older python frame')
2037 else:
2038 print('Unable to find a newer python frame')
2039
2040
2041class PyUp(gdb.Command):

Callers 2

invokeMethod · 0.85
invokeMethod · 0.85

Calls 6

olderMethod · 0.80
newerMethod · 0.80
is_python_frameMethod · 0.80
print_summaryMethod · 0.80
selectMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…