
2017-02-28 20:38 GMT+01:00 Alexander Belopolsky <alexander.belopolsky@gmail.com>:
First, I had to rename python-gdb.py to python3.6-gdb.py to make it load.
There is nothing specific to Python here, the file command of gdb (or gdb file) tries to load "file-gdb.py". So if your program is called python3.6, gdb looks for python3.6-gdb.py, yeah.
Then running backtrace gave me a bunch of error messages: (...) except gdb.error: AttributeError: 'module' object has no attribute 'error'
Oh, I never tried python-gdb.py on RHEL. Sadly, I know that the Python binding of gdb changes depending on the gdb version, but I also suspect that it changes depending on the OS! I'm quite sure that Fedora backports gdb changes for its Python API. I'm only using python-gdb.py on Fedora, usually even the latest Fedora version. Fedora always has bleeding edge versions of development tools! It shouldn't be hard to catch this "except gdb.error:" line. We should find the right exception and patch libpython.py.
It looks like there is a mismatch between python-gdb.py and the gdb module that I assume comes with gdb.
python-gdb.py (libpython.py) should work on any gdb version. It shouldn't be hard to support multiple gdb versions in same code base, we already support Python 2 and Python 3 in the same code base! (Depending on the OS and OS version, gdb may use Python 2 or Python 3 to run python-gdb.py, this script is run by gdb, not by test debugged Python binary! ;-)) Victor