2

I built a Qt project in Debug mode with Qt Creator, ran Callgrind to generate profiling data and tried loading it into Cachegrind. I noticed that I only see profiling information for Qt classes, so I figured I must have forgotten to turn on a crucial flag.

Qt Creator's qmake command looks like this:

qmake /path/to/project/MyProject/MyProject.pro -r -spec linux-g++-64 CONFIG+=debug

Sample compile output for one file:

g++ -c -m64 -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I../Flowchart -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I. -I. -I../Flowchart -I. -o main.o ../Flowchart/main.cpp

The -g flag is there, so debug information should be available. I verified this by running gdb on the executable and trying to look at some random source code with l.

The Callgrind command I used was:

valgrind --tool=callgrind ./MyProject

What am I missing here?

4

1 回答 1

0

你应该做:

valgrind --tool=callgrind --trace-children=yes --demangle=yes ./MyProject

此外,根据 Linux 的发行版,您可能必须确保在要链接的 QT 库中具有调试信息。

于 2012-01-24T17:33:54.123 回答