If you have conducted a thorough and routine testing of your product or application and spent a lot of effort on it. If your goal is to get a code coverage report using lcov and gcov, but gcno files were deleted by mistake. You can regenerate gcno files by recompiling the code, but it will be generated with a new timestamp and gcov will report an error indicating “marker mismatch with the graphic file” and no code coverage report will be generated. This will result in all of your testing efforts being wasted.
There is a shortcut to generate a code coverage report. This is just a workaround, and you cannot rely on it all the time. It is recommended that you save * .gcno files until testing is complete.
Write down your version of gcc (gcc -v) and download its source code from one of the mirror sites. For example, ftp://gd.tuwien.ac.at/gnu/sourceware/gcc/releases/gcc-4.4.6/gcc-4.4 .6.tar.bz2
After extracting the downloaded gcc file, the folder structure will be as follows: GCC-4.4.6 GCC-4.4.6 / GCC
If you go straight into gcc-4.4.6 / gcc and try to do it. / configure and compile (make), then you will encounter a problem below build / genmodes -h> tmp-modes.h / bin / sh: build / genmodes: There is no such file or directory
The decision is made. / configure and make from gcc-4.4.6, and no errors will be shown related to genmodes. This will compile all modules, including gcc. You may need to install the mpfr and gmp modules that gcc needs if there is any error shown. / configure
goto gcc-4.4.6 / gcc / gcov.c and the comment below the lines, then recompile with the command
/* if (tag != bbg_stamp) { fnotice (stderr, "%s:stamp mismatch with graph file\n", da_file_name); goto cleanup; }*/
An example of the path of the new gcov binary after compilation is gcc-4.4.6 / host-x86_64-unknown-linux-gnu / gcc / gcov
Put this binary in / usr / bin and update the code coverage report with the command as shown below. lcov --capture --directory./--output-file coverage.info; genhtml coverage.info --output-directory / var / www / html / coverage
Now you should not get the error "marker mismatch with the graphic file", and you will get a report on code coverage