Move up or down the stack (for the py-up/py-down command)
(move_up)
| 2005 | PyList() |
| 2006 | |
| 2007 | def 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 | |
| 2041 | class PyUp(gdb.Command): |
no test coverage detected
searching dependent graphs…