summaryrefslogtreecommitdiffstats
path: root/Tools/gdb/libpython.py
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-11-09 11:19:47 (GMT)
committerGitHub <noreply@github.com>2021-11-09 11:19:47 (GMT)
commitf4c03484da59049eb62a9bf7777b963e2267d187 (patch)
treea1c9d1da40c919a7852e5c690d149d83a135cdf6 /Tools/gdb/libpython.py
parent6a1cc8bf8a0d88af9c7891c6577508ae9f70e3ef (diff)
downloadcpython-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-xTools/gdb/libpython.py18
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