GDB -fprofile-arcs -ftest-coverage 选项

39 篇文章 1 订阅
11 篇文章 0 订阅

-fprofile-arcs -ftest-coverage 选项的使用

参考:https://gcc.gnu.org/onlinedocs/gcc-4.4.1/gcc/Debugging-Options.html

 

-fprofile-arcs

Add code so that program flow arcs are instrumented. During execution the program records how many times each branch and call is executed and how many times it is taken or returns. When the compiled program exits it saves this data to a file called auxname.gcda for each source file. The data may be used for profile-directed optimizations (-fbranch-probabilities), or for test coverage analysis (-ftest-coverage). Each object file's auxname is generated from the name of the output file, if explicitly specified and it is not the final executable, otherwise it is the basename of the source file. In both cases any suffix is removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda for output file specified as -o dir/foo.o). See Cross-profiling.

添加代码,以便检测程序流。在执行期间,程序记录每个分支和调用执行了多少次,以及执行或返回了多少次。编译后的程序退出时,对于每个源文件会将数据保存到名为 auxname.gcda。数据可用于配置文件导向的优化(分支概率),或用于测试覆盖率分析(-ftest-coverage)。每个目标文件的 auxname由输出文件的名称生成(如果已明确指定),它不是最终的可执行文件,否则它是源文件的基本名称。在这两种情况下,都删除了任何后缀(例如,foo.gcda 用于输入文件 目录/foo.c, 要么 目录/foo.gcda 对于指定为的输出文件 -o目录/foo.o)。请参阅交叉分析

 

-ftest-coverage

Produce a notes file that the gcov code-coverage utility (see gcov—a Test Coverage Program) can use to show program coverage. Each source file's note file is called auxname.gcno. Refer to the -fprofile-arcs option above for a description of auxname and instructions on how to generate test coverage data. Coverage data will match the source files more closely, if you do not optimize.

产生一个注释文件, gcov 代码覆盖实用程序(请参阅 gcov—测试覆盖率计划)可用于显示计划覆盖率。每个源文件的注释文件称为 辅助名.gcno。请参阅-fprofile-arcs上面的选项可提供关于auxname的描述以及有关如何生成测试覆盖率数据的说明。如果不进行优化,覆盖率数据将与源文件更紧密地匹配。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值