On system python2 on Debian 11 bullseye, when you try py-bt on gdb, session, frames are optimized out:
(gdb) py-bt
Traceback (most recent call first):
(frame information optimized out)
According to https://www.podoliaka.org/2016/04/10/debugging-cpython-gdb/ , this is because gdb wasn't able to figure out the location of PyFrameObject data structure in a given stack frame
.
So, to fix this, you can rebuild python2 without PGO.
- https://salsa.debian.org/cpython-team/python2/-/merge_requests/7
- https://github.com/cielavenir/salsa-python2/releases/tag/2.7.18-13.0.1
Note that system Python 3.9 does not have issue.