编译使用的gcc版本和gcov的版本对不上的话,使用lcov和gcov的时候会报错
lcov的错误:
[xx@localhost XXX]$ lcov --capture --directory cov --output-file xxx.info --test-name xxx
Capturing coverage data from cov
Found gcov version: 4.8.5
Scanning cov for .gcda files ...
Found 35 data files in cov
Processing XXX.gcda
geninfo: ERROR: XXX.gcno: reached unexpected end of file
gcov的错误:
[xxx@localhost xxx]$ gcov -o cov ./xxx.c
cov/xxx.gcno:版本‘405 ’,首选‘408R’
gcov: out of memory allocating 16030351984 bytes after a total of 135168 bytes
确保gcc和gcov版本一样即可