diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2021-11-09 11:19:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-09 11:19:47 (GMT) |
commit | f4c03484da59049eb62a9bf7777b963e2267d187 (patch) | |
tree | a1c9d1da40c919a7852e5c690d149d83a135cdf6 /Tools/gdb/libpython.py | |
parent | 6a1cc8bf8a0d88af9c7891c6577508ae9f70e3ef (diff) | |
download | cpython-f4c03484da59049eb62a9bf7777b963e2267d187.zip cpython-f4c03484da59049eb62a9bf7777b963e2267d187.tar.gz cpython-f4c03484da59049eb62a9bf7777b963e2267d187.tar.bz2 |
bpo-45637: Remove broken fallback in gdb helpers to obtain frame variable (GH-29257)
Diffstat (limited to 'Tools/gdb/libpython.py')
-rwxr-xr-x | Tools/gdb/libpython.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py index 54f7232..f4b27f1 100755 --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -1801,17 +1801,13 @@ class Frame(object): frame = PyFramePtr(frame) if not frame.is_optimized_out(): return frame - # gdb is unable to get the "frame" argument of PyEval_EvalFrameEx() - # because it was "optimized out". Try to get "frame" from the frame - # of the caller, _PyEval_Vector(). - orig_frame = frame - caller = self._gdbframe.older() - if caller: - frame = caller.read_var('frame') - frame = PyFramePtr(frame) - if not frame.is_optimized_out(): - return frame - return orig_frame + cframe = self._gdbframe.read_var('cframe') + if cframe is None: + return None + frame = PyFramePtr(cframe["current_frame"].dereference()) + if frame and not frame.is_optimized_out(): + return frame + return None except ValueError: return None |