This directory contains GDB pretty printers for displaying Qt types in a human-readable format.
In GDB:
source /path/to/qgroundcontrol/tools/debuggers/gdb-pretty-printers/qt6.pyAdd to your ~/.gdbinit:
python
import sys
sys.path.insert(0, '/path/to/qgroundcontrol/tools/debuggers/gdb-pretty-printers')
from qt6 import register_qt_printers
register_qt_printers(None)
endThe .vscode/launch.json in this repository is already configured to load these printers automatically.
- Strings: QString, QByteArray
- Containers: QList, QVector, QMap, QHash
- Geometry: QPoint, QPointF, QSize, QSizeF, QRect, QRectF
- Other: QVariant, QUrl, QSharedPointer
(gdb) print myString
$1 = "Hello, World!"
(gdb) print myList
$2 = QList<int> (size=3)
[0] = 1
[1] = 2
[2] = 3
(gdb) print myPoint
$3 = (100, 200)
(gdb) print myRect
$4 = [(0, 0) 800x600]
For LLDB (macOS), Qt provides built-in formatters. You can also use:
# In ~/.lldbinit
command script import /path/to/qt6/plugins/lldb/qt6lldb.pyOr check if your Qt installation includes LLDB formatters in $QT_ROOT/plugins/lldb/.