我想获取代码覆盖率信息。在运行只有一个功能。 例如,我只想知道“run()”经历了哪些行。
TEST.CPP:
#include "..."
int main(){
init();
gcov_start_recording();
run();
gcov_end_recording();
return 0;
}
答案 0 :(得分:1)
It is unable to get source code information from a normal binary file. My basic idea is : 1. Executable should be complied as debug version , which keep the symbol infomation. 2. You need a external wrapper script for GDB. set break point at entry and exit of the function. collect trace output from GDB . filter the duplicate line in the output . finally you will get the code cover information .