I looked at the aarch64 failure on Fedora Rawhide using GCC and the master branch.
When I run "./python -m test -v test_gdb -m test_pycfunction" multiple times, I get a different error at each run, and sometimes the test pass, whereas nothing changes between the runs.
* gcc (GCC) 10.2.1 20200723 (Red Hat 10.2.1-1) [gcc-10.2.1-1.fc33.aarch64]
* GNU gdb (GDB) Fedora 9.2-2.fc33 [gdb-9.2-2.fc33.aarch64]
When gdb fails to rebuild the stack file, it logs the message: "opening file=(...)/_testcapi.cpython-310d-aarch64-linux-gnu.so [0]; direct_opencount=1".
It seems to be an issue in gdb, not in Python.
I modified test_gdb.py to get subprocess arguments and output (out/err).
== Logs of a success ==
args=('gdb', '--batch', '-nx', '-iex', 'add-auto-load-safe-path /home/vstinner/python/master/python-gdb.py', '--eval-command=set breakpoint pending yes', '--eval-command=break meth_fastcall', '--eval-command=set print address off', '--eva
l-command=run', '--eval-command=set print entry-values no', '--eval-command=bt', '--eval-command=py-bt', '--args', '/home/vstinner/python/master/python', '-S', '-c', '\nimport _testcapi\ndef foo():\n _testcapi.meth_fastcall()\ndef bar(
):\n foo()\nbar()\n')
--out--
Breakpoint 1 (meth_fastcall) pending.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Breakpoint 1, meth_fastcall (self=<module at remote 0xffffea684e90>, args=, nargs=0) at /home/vstinner/python/master/Modules/_testcapimodule.c:5255
5255 {
#0 meth_fastcall (self=<module at remote 0xffffea684e90>, args=, nargs=0) at /home/vstinner/python/master/Modules/_testcapimodule.c:5255
#1 cfunction_vectorcall_FASTCALL (func=<built-in method meth_fastcall of module object at remote 0xffffea684e90>, args=, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/methodobject.c:424
#2 _PyObject_VectorcallTstate (tstate=, callable=<built-in method meth_fastcall of module object at remote 0xffffea684e90>, args=, nargsf=9223372036854775808, kwnames=0x0) at ./Include/cpython/abstract.h:114
#3 PyObject_Vectorcall (kwnames=0x0, nargsf=9223372036854775808, args=, callable=<built-in method meth_fastcall of module object at remote 0xffffea684e90>) at ./Include/cpython/abstract.h:123
#4 call_function (tstate=, pp_stack=, oparg=0, kwnames=0x0) at Python/ceval.c:5121
#5 _PyEval_EvalFrameDefault (tstate=, f=Frame 0x883070, for file <string>, line 4, in foo (), throwflag=<optimized out>) at Python/ceval.c:3516
#6 _PyEval_EvalFrame (throwflag=0, f=Frame 0x883070, for file <string>, line 4, in foo (), tstate=) at ./Include/internal/pycore_ceval.h:40
#7 function_code_fastcall (tstate=, co=<optimized out>, args=, nargs=0, globals=<optimized out>) at Objects/call.c:329
#8 _PyFunction_Vectorcall (func=<optimized out>, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:366
#9 _PyObject_VectorcallTstate (tstate=, callable=<function at remote 0xffffea711a50>, args=, nargsf=9223372036854775808, kwnames=0x0) at ./Include/cpython/abstract.h:114
#10 PyObject_Vectorcall (kwnames=0x0, nargsf=9223372036854775808, args=, callable=<function at remote 0xffffea711a50>) at ./Include/cpython/abstract.h:123
#11 call_function (tstate=, pp_stack=, oparg=0, kwnames=0x0) at Python/ceval.c:5121
#12 _PyEval_EvalFrameDefault (tstate=, f=Frame 0xffffea67f050, for file <string>, line 6, in bar (), throwflag=<optimized out>) at Python/ceval.c:3547
#13 _PyEval_EvalFrame (throwflag=0, f=Frame 0xffffea67f050, for file <string>, line 6, in bar (), tstate=) at ./Include/internal/pycore_ceval.h:40
#14 function_code_fastcall (tstate=, co=<optimized out>, args=, nargs=0, globals=<optimized out>) at Objects/call.c:329
#15 _PyFunction_Vectorcall (func=<optimized out>, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:366
#16 _PyObject_VectorcallTstate (tstate=, callable=<function at remote 0xffffea682410>, args=, nargsf=9223372036854775808, kwnames=0x0) at ./Include/cpython/abstract.h:114
#17 PyObject_Vectorcall (kwnames=0x0, nargsf=9223372036854775808, args=, callable=<function at remote 0xffffea682410>) at ./Include/cpython/abstract.h:123
#18 call_function (tstate=, pp_stack=, oparg=0, kwnames=0x0) at Python/ceval.c:5121
#19 _PyEval_EvalFrameDefault (tstate=, f=Frame 0xffffea6c15c0, for file <string>, line 7, in <module> (), throwflag=<optimized out>) at Python/ceval.c:3547
(...)
--out--done
--err--
Function "meth_fastcall" not defined.
--err--done
== Logs of a failure ==
args=('gdb', '--batch', '-nx', '-iex', 'add-auto-load-safe-path /home/vstinner/python/master/python-gdb.py', '--eval-command=set breakpoint pending yes', '--eval-command=break meth_fastcall', '--eval-command=set print address off', '--eva
l-command=run', '--eval-command=set print entry-values no', '--eval-command=bt', '--eval-command=py-bt', '--args', '/home/vstinner/python/master/python', '-S', '-c', '\nimport _testcapi\ndef foo():\n _testcapi.meth_fastcall()\ndef bar(
):\n foo()\nbar()\n')
--out--
Breakpoint 1 (meth_fastcall) pending.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Program received signal SIGTRAP, Trace/breakpoint trap.
?? () from /home/vstinner/python/master/build/lib.linux-aarch64-3.10-pydebug/_testcapi.cpython-310d-aarch64-linux-gnu.so
#0 ?? () from /home/vstinner/python/master/build/lib.linux-aarch64-3.10-pydebug/_testcapi.cpython-310d-aarch64-linux-gnu.so
#1 ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
Unable to locate python frame
--out--done
--err--
Function "meth_fastcall" not defined.
1056556: opening file=/home/vstinner/python/master/build/lib.linux-aarch64-3.10-pydebug/_testcapi.cpython-310d-aarch64-linux-gnu.so [0]; direct_opencount=1
1056556:
--err--done |