Skip to content

Commit

Permalink
pythongh-91960: Skip test_gdb if frame is <optimized out>
Browse files Browse the repository at this point in the history
When Python is built with "clang -Og", gdb can fail to retrive the
'frame' parameter of _PyEval_EvalFrameDefault(). In this case, tests
like py_bt() are likely to fail. Without getting access to Python
frames, python-gdb.py is mostly clueless on retrieving the Python
traceback.
  • Loading branch information
vstinner committed Sep 6, 2023
1 parent 39376cb commit fb856e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Lib/test/test_gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ def get_stack_trace(self, source=None, script=None,
for pattern in (
'(frame information optimized out)',
'Unable to read information on python frame',
# gh-91960: On Python built with "clang -Og", gdb gets
# "frame=<optimized out>" for _PyEval_EvalFrameDefault() parameter
'(unable to read python frame information)',
):
if pattern in out:
raise unittest.SkipTest(f"{pattern!r} found in gdb output")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Skip ``test_gdb`` if gdb is unable to retrieve Python frame objects: if a
frame is ``<optimized out>``. When Python is built with "clang -Og", gdb can
fail to retrive the *frame* parameter of ``_PyEval_EvalFrameDefault()``. In
this case, tests like ``py_bt()`` are likely to fail. Without getting access
to Python frames, ``python-gdb.py`` is mostly clueless on retrieving the
Python traceback. Patch by Victor Stinner.

0 comments on commit fb856e1

Please sign in to comment.