开发者

How do I let Callgrind access my Qt project's source code?

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

Sa开发者_JAVA技巧mple 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?


You should do:

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

Also depending on the distribution of Linux you may have to make sure that you have the Debug information in the QT libraries you are linking against.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜