iPhone:无法让模拟器生成 .gcda 分析数据文件
我正在尝试使用 iPhone 模拟器分析我的代码。我已启用生成测试覆盖率文件和仪器程序流程,并将-lgcov添加到链接器标志中。根据我读过的所有内容,这应该是我在设置方面需要做的全部工作。
更新:生成测试覆盖率文件触发-ftest-coverage标志,仪器程序流程触发-fprofile-arcs > 旗帜。我检查了构建日志,它们是在编译时设置的。
执行程序我可以看到 .gcno 文件出现在 .o 编译好的代码在build/.build/Debug-iphonesimulator/.build/Objects-normal/i386目录下。
但是当我在模拟器中运行该应用程序时,我没有出现任何 *.gcda 文件。
我的理解是这些文件包含来自仪器的数据。但我在计算机上找不到它们。
我知道它们可以生成并与 *.gcno 文件一起出现,因为我有一个旧的已废弃的 buil 目录,其中确实有它们。我只是不知道我必须做什么才能让他们出现并记录跑步。
任何帮助表示赞赏。
I'm attempting to profile my code using the iPhone simulator. I've enabled Generate Test Coverage File and Instrument Program Flow and added -lgcov to the linker flags. According to everything I've read that should be all I need to do in terms of setup.
Update: Generate Test Coverage File triggers the -ftest-coverage flag and Instrument Program Flow triggers the -fprofile-arcs flag. I've checked the build logs and they are being set when compiling.
Executing the program I can see the .gcno files appearing along side the .o compiled code in the build/.build/Debug-iphonesimulator/.build/Objects-normal/i386 directory.
But when I run the app in the simulator I do not get any *.gcda files appearing.
My understanding is that these files contain the data from the instrumentation. But I cannot find them anywhere on the computer.
I know they can be produced and appear along side the *.gcno files because I have an old trashed buil directory which does have them. I just cannot figure out what I have to do to get them to appear and record the run.
Any help appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我希望这个链接能给您一些想法。探索我找到的链接
所以可能您正在使用一些错误的设置进行构建。 http://gcc 上提到了该信息.gnu.org/onlinedocs/gcc/Gcov-Data-Files.html#Gcov-Data-Files
I hope this link would give you some idea. Exploring the link I found
So may be you are building with some wrong settings. The information is mentioned on http://gcc.gnu.org/onlinedocs/gcc/Gcov-Data-Files.html#Gcov-Data-Files
此链接可能有答案,基本上 gcda 文件是直到您的应用程序正确退出后才会生成。它提供了两种可能的解决方案:
将其添加到您的plist(但不适用于发布版本):
This link may have the answer, basically gcda files are not generated until your app exits properly. It gives two possible solutions:
add this to your plist (but not for release builds):