Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Callgrind Anotate在OS X 10.10中不工作_C_Macos_Valgrind_Callgrind - Fatal编程技术网

Callgrind Anotate在OS X 10.10中不工作

Callgrind Anotate在OS X 10.10中不工作,c,macos,valgrind,callgrind,C,Macos,Valgrind,Callgrind,我想问你一个问题什么是不正确的 我用C写了一个程序,然后用C翻译 gcc -Wall -pedantic 跑 valgrind --simulate-cache=yes --tool=callgrind ./a.out 创建callgrind.out。[pid编号] 如果我跑 callgrind_annotate callgrind.out.[pid] main.c 我会的 --用户注释的源代码:main.c 尚未收集main.c的任何信息 如何为程序优化工具注释代码和函数调用 注 不

我想问你一个问题什么是不正确的

我用C写了一个程序,然后用C翻译

gcc -Wall -pedantic

valgrind --simulate-cache=yes --tool=callgrind ./a.out
创建callgrind.out。[pid编号] 如果我跑

callgrind_annotate callgrind.out.[pid] main.c
我会的


--用户注释的源代码:main.c


尚未收集main.c的任何信息

如何为程序优化工具注释代码和函数调用

不工作,因为gcc和gprof上的Apple Unported debug选项也不受支持。KDE程序不想在Mac上运行。。。
感谢大家提供了有用的信息如何解决它

当您使用
-pg
编译时,您使用的是
gprof
评测信息。valgrind实际上不需要这些数据来进行分析,它需要的是调试信息

使用valgrind HEAD,我获取了一段简单的代码,并在不使用
-g
的情况下对其进行了编译,得到了与您相同的结果,即
未收集到main.c
的任何信息

当我使用
-g
编译时,我得到了有关
main.c
的有用信息,即使是使用优化编译时,我也得到了有用的信息

长话短说,您需要使用
-g
进行编译,而不是使用
-pg
来让它与callgrind一起工作

gcc -g - pg progrma.c