Set up GDB pretty printers
It would ease onboarding of new contributors if kde-builder could set up GDB pretty printers automatically, as without them debugging our code can be quite painful.
Having the pretty printers set up allows contributors to see the contents of Qt and KDE classes and variables in a human-readable format, which makes debugging much easier.
There is mention of setting up pretty printers in the wiki, though it is not especially clear how to do it and can be quite a source of friction for new contributors.
The pretty printers are available in the KDevelop repository.
I think this should happen by default if the user doesn't already have a ~/.gdbinit
file. If they do have one but it doesn't contain the necessary commands to load the pretty printers, perhaps we should ask them if they want this to be set up automatically.
It should be possible to:
- Download the pretty printers from the KDevelop repository
- Install them somewhere (user's home directory, under
kde/usr
or similar) - Create the
~/.gdbinit
file with the necessary commands to load the pretty printers
It has been some time since I set this up for myself, but for reference, the contents of my ~/.gdbinit
file is:
python
import sys, os.path
sys.path.insert(0, os.path.expanduser("~/.qtpp"))
from qt import register_qt_printers
from kde import register_kde_printers
register_qt_printers (None)
register_kde_printers (None)
end
set print pretty on
set debuginfod enabled on
For me the pretty printers are installed in ~/.qtpp
, but I think we should consider where would be best to install them.
Having this process automated would be a great improvement to the developer experience for new contributors.