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?

Pieter
  • 31,619
  • 76
  • 167
  • 242

1 Answers1

0

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.

Karlson
  • 2,958
  • 1
  • 21
  • 48