我正在尝试查看与可执行文件lab13关联的源代码。当我单击KCachegrind中的Source选项卡时,仅看到以下内容:

There is no source available for the following function:
    'main'
This is because no debug information is present.
Recompile source and redo profile run.
The function is located in this ELF object:
    'lab13'


但是,我在-g中使用了makefile调试标志:

lab13:main.o
    g++ -g main.o -o lab13
    ./lab13

main.o:main.cpp EdgeArray.h Edge.h DisjointSets.h Matrix.h experiment.h
    g++ -c -g main.cpp


我使用以下对callgrind.out的调用创建了valgrind文件:

valgrind --tool=callgrind --dsymutil=yes ./lab13


我查看了KCachgrind documentation,但是没有有关如何激活“源”选项卡功能的信息。

我在OSX上编译了程序,并通过X11运行KCachgrind。我正在从与代码相同的目录中读取callgrind.out文件。所有其他KCachgrind功能似乎都可以使用。

如何使“源”选项卡正常工作?

最佳答案

您应该在配置文件(cf)中查找“ fl =”行,并确保源文件在“ fl =”行中指定的路径下可用。

10-07 19:52
查看更多