Skip to content

Commit

Permalink
bpo-45637: Remove broken fallback in gdb helpers to obtain frame vari…
Browse files Browse the repository at this point in the history
…able (GH-29257)
  • Loading branch information
pablogsal authored Nov 9, 2021
1 parent 6a1cc8b commit f4c0348
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 2 additions & 0 deletions Lib/test/test_gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,8 @@ def test_bt_full(self):
foo\(1, 2, 3\)
''')

@unittest.skipIf(python_is_optimized(),
"Python was compiled with optimizations")
def test_threads(self):
'Verify that "py-bt" indicates threads that are waiting for the GIL'
cmd = '''
Expand Down
18 changes: 7 additions & 11 deletions Tools/gdb/libpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -1801,17 +1801,13 @@ def get_pyop(self):
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

Expand Down

0 comments on commit f4c0348

Please sign in to comment.