Qt Pretty Printers

Qt Creator loads the GDB pretty printers in the following manner.

First, it imports the gdbbridge module by running the following gdb command.

python from gdbbridge import *

The file of the gdbbridge module is c:\Qt5.12.1\Tools\QtCreator\share\qtcreator\debugger\gdbbridge.py. This module creates a python object theDumper of class Dumper.  Then Qt creator uses theDumper to load all dumpers(pretty printers).

python theDumper.loadDumpers()

The dumpers(pretty printers) are scattered in several modules: qttypes, stdtypes, misctypes, boosttypes, opencvtypes, creatortypes, personaltypes. The location of these pretty printer modules is also :\Qt5.12.1\Tools\QtCreator\share\qtcreator\debugger\. Each module contains a certain kind of pretty printers.  For example, qttypes contains the pretty printers for Qt types such as QString. The name of the pretty printer is of the form qdump__xxxx such as qdump__QString. stdtypes contains the debugging helpers for stl types. For example, the pretty printer for list is qdump__std__list. The name takes the form of qdump__NAMESPACE__class. Similarly, boosttypes contains the pretty printers for boost lib and opencvtypes includes the pretty  printers for opencv lib. You can write your own pretty printers in personaltypes.py.

The loadDumpers method will import all these modules. It does not register these pretty printers in the modules to GDB using GDB’s python API, but maintains a map qqDumpers to associate the type like QString with the pretty printer functions like qdump__QString. When need to display a variable of particular type, Qt creator will use the type to look up the map for the printer function then call the function to handle the value of the variable.

 

Did you like this?
Tip admin with Cryptocurrency

Donate Bitcoin to admin

Scan to Donate Bitcoin to admin
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to admin

Scan to Donate Bitcoin Cash to admin
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to admin

Scan to Donate Ethereum to admin
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to admin

Scan to Donate Litecoin to admin
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to admin

Scan to Donate Monero to admin
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to admin

Scan to Donate ZCash to admin
Scan the QR code or copy the address below into your wallet to send some ZCash:
Posted in

Leave a Reply