Description
Bug report
Bug description:
GDB stack trace is incomplete when enabling Perf support under specific optimization options on x86_64. It seems that through various changes the stack trace was broken and/or fixed. I've bisected the relevant commits.
Perf 6.13.4, GDB 16.2, GCC 14.2.1 on x86_64, Fedora 41.
With frame pointers using -X perf:
./configure --enable-shared --without-static-libpython && CFLAGS="-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -<optmization>" make
Run LD_LIBRARY_PATH=$PWD gdb -args ./python -X perf -m test -vv test_sys
and within the GDB shell run
.
Press ctrl+c during execution and run bt
. On specific configurations the stack trace is trimmed, usually right after the unknown frames.
python3.12:
- -O3, -O1, -O0, -Og:
Complete gdb stack trace. - -O2:
Incomplete gdb stack trace (stops at the unknown frames). (Didn't work from the beginning, resolved in 3.13)
python3.13:
-
-O3, -O2, -O0, -Og:
Complete gdb stack trace. -
-O1:
Incomplete gdb stack trace (stops at the unknown frames). (regressed on 3.13 here and fixed again in 3.14 here)
python3.14:
-
-O3, -O2, -Og:
Incomplete gdb stack trace (stops at the unknown frames). (-O3, -O2 regressed here, -Og regressed here) -
-O1, -O0:
Complete gdb stack trace.
Without frame pointers using -X perf_jit
./configure --enable-shared --without-static-libpython && CFLAGS="-<optmization>" make
Run LD_LIBRARY_PATH=$PWD gdb -args ./python -X perf_jit -m test -vv test_sys
and within the GDB shell run
.
Press ctrl+c during execution and run bt
. On specific configurations the stack trace is trimmed, usually right after the unknown frames.
python3.12:
- Not supported
python3.13:
-
-O3:
Incomplete gdb stack trace (stops at the unknown frames). (Worked initially, regressed here, fixed in 3.14) -
-O2, -O1, -Og:
Complete gdb stack trace. -
-O0:
Complete gdb stack trace.
Python functions are not visible in Perf output.
python3.14:
-
-O3, -O2, -O1:
Complete gdb stack trace. -
-Og:
Incomplete gdb stack trace (stops at the unknown frames). (Regressed here, same as with frame pointers) -
-O0:
Complete gdb stack trace.
Python functions are not visible in Perf output.
CPython versions tested on:
CPython main branch, 3.14, 3.13, 3.12
Operating systems tested on:
Linux