我使用Qt Creator在Debug模式下构建了一个Qt项目,运行Callgrind生成分析数据并尝试将其加载到Cachegrind中。我注意到我只看到Qt类的分析信息,所以我想我必须忘记打开关键标志。
Qt Creator的qmake
命令如下所示:
qmake /path/to/project/MyProject/MyProject.pro -r -spec linux-g++-64 CONFIG+=debug
一个文件的示例编译输出:
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
-g
标志位于那里,因此调试信息应该可用。我通过在可执行文件上运行gdb
并尝试使用l
查看一些随机源代码来验证这一点。
我使用的Callgrind命令是:
valgrind --tool=callgrind ./MyProject
我在这里缺少什么?
答案 0 :(得分:0)
你应该这样做:
valgrind --tool=callgrind --trace-children=yes --demangle=yes ./MyProject
另外,根据Linux的发行版,您可能需要确保在链接的QT库中包含调试信息。