if not sysconfig.is_python_build():
raise unittest.SkipTest("test_gdb only works on source builds at the moment.")
-if 'Clang' in platform.python_compiler() and sys.platform == 'darwin':
- raise unittest.SkipTest("test_gdb doesn't work correctly when python is"
- " built with LLVM clang")
-
if ((sysconfig.get_config_var('PGO_PROF_USE_FLAG') or 'xxx') in
(sysconfig.get_config_var('PY_CORE_CFLAGS') or '')):
raise unittest.SkipTest("test_gdb is not reliable on PGO builds")
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")
--- /dev/null
+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. Moreover, ``test_gdb`` is no longer skipped on macOS if
+Python is built with Clang. Patch by Victor Stinner.