diff options
-rw-r--r-- | Lib/test/test_gdb.py | 2 | ||||
-rwxr-xr-x | Tools/gdb/libpython.py | 18 |
2 files changed, 9 insertions, 11 deletions
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index 2805eaf..eaeb6fb 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -823,6 +823,8 @@ Traceback \(most recent call first\): 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 = ''' 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 |