Just summarize the steps for the answer @Himanshu already shared in case someone is looking for the exact steps to do this:
Install gcc 4.6
sudo apt-get-install -y gcc-4.6
I could not find locv version 1.10 out of the box, so I compiled it myself:
git clone https://github.com/linux-test-project/lcov.git
cd lcov
Switch to a new branch with a commit that posted lcov 1.10 as a base
git checkout -b 1_10 b5c1bdd
Compile lcov
sudo make install
Make sure lcov 1.10 is installed
lcov --version
Given all these things, use the command:
lcov --gcov-tool /usr/bin/gcov-4.6 --capture -d gcov_data/ -o gcov_data/coverage.info
This avoids working with the default gcov in the system.
Then generate a visual coverage file
genhtml -o gcov_data/html gcov_data/coverage.info
where gcov_data is the folder containing the gcno and gcda .
source share