How to make dumpObjectInfo to print debugging information?

I would like to print a dump of object information using the dumpObjectInfo function, but nothing is printed.

There is the following C ++ program that uses Qt:

$ cat main1.cpp #include <QObject> #include <QString> #include <QDebug> #include "ah" int main() { A a; B b; QObject::connect(&b, SIGNAL(sendText(QString)), &a, SLOT(printText(QString))); b.sendSignal(); qDebug() << "print object dump"; a.dumpObjectInfo(); return 0; } 

The following .pro file exists (debug mode is set in CONFIG):

 $ cat qt.pro ###################################################################### # Automatically generated by qmake (2.01a) Tue Aug 28 17:41:22 2012 ###################################################################### TEMPLATE = app TARGET = DEPENDPATH += . INCLUDEPATH += . # Input CONFIG += debug HEADERS += ah SOURCES += main1.cpp 

Compilation:

 $ qmake qt.pro && make clean && make rm -f moc_a.cpp rm -f main1.o moc_a.o rm -f *~ core *.core g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main1.o main1.cpp /usr/bin/moc-qt4 -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. ah -o moc_a.cpp g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o moc_a.o moc_a.cpp g++ -o qt main1.o moc_a.o -L/usr/lib/i386-linux-gnu -lQtGui -lQtCore -lpthread { test -n "" && DESTDIR="" || DESTDIR=.; } && test $(gdb --version | sed -e 's,[^0-9]\+\([0-9]\)\.\([0-9]\).*,\1\2,;q') -gt 72 && gdb --nx --batch --quiet -ex 'set confirm off' -ex "save gdb-index $DESTDIR" -ex quit 'qt' && test -f qt.gdb-index && objcopy --add-section '.gdb_index=qt.gdb-index' --set-section-flags '.gdb_index=readonly' 'qt' 'qt' && rm -f qt.gdb-index || true 

Launching the program:

 $ ./qt Signal text! print object dump $ 

dumpObjectInfo does not print anything because the debugging mode is set in the .pro file. How to make dumpObjectInfo function to print information about an object?

+4
source share
1 answer

This is to be expected if the Qt library itself was not compiled in debug mode. doc says:

This function is useful for debugging, but does nothing if the library was compiled in release mode (i.e. without debugging information).

To do this, you can compile Qt yourself from the source instead (or in addition to) using precompiled packages.

+4
source

All Articles