This project adds various type formatters to enable more user friendly display of Qt Core Types in LLDB and IDEs that support it.
Load the type formatters in LLDB by executing
command script import lldb_qt_formatters
or alternatively place the above line in a .lldbinit
file in the root of the project, or in your $HOME
directory.
To use a project-specific configuration file
you will need to enable it
VSCode will not source a project .lldbinit
file even if you enable it as above. To automatically load the
config file, add the following to your launch.json
file.
"configurations": [{
"type": "lldb",
...
"initCommands": [
"command source ${workspaceFolder}/.lldbinit"
]
}]
-
QMap<Key, Value>
auto map = QMap<QString , uint32_t>{ {"one", 1}, {"forty-two", 42}, {"1.21 gigawatts", 1210000} };
(lldb) frame variable map (QMap<QString, unsigned int>) map = Size: 3 { [0] = {"forty-two": 42} [1] = {"1.21 gigawatts": 1210000} [2] = {"one": 1} }
-
QMapNode<Key, Value>
-
QString
auto hello = QString("Hello World");
(lldb) frame variable hello (QString) hello = "Hello World"
Contributions are welcomed. See the guide to variable formatting in LLDB, in addition to the existing formatters in the LLDB Source
-
Create a test for your formatter. The tests run LLDB against some sample code and examine the formatted variable output.
-
Implement a new formatter
- Simple types can be supported with a summary string in the
__init__.py
file (eg, see support for theQMapNode<Key, Value>
type) - More complex types can be supported using the Python API (eg
QString
) - Container types such as
QMap<>
require more elaborate use of the Python API to generate "Synthetic Children"
Formatters are registered with their types in the
__init__.py
file. - Simple types can be supported with a summary string in the