You can try DrCov, a code coverage tool based on DynamRIO, a dynamic instrumentation platform.
So you do not have to recompile the code, so long there is debug information available, and it works on both Linux and Windows.
2. run you application with drcov tool
.\bin32\drrun.exe -t drcov -- .\common.fib.exe
and one drcov log file (e.g. drcov.common.fib.exe.73444.0000.proc.log) per process is generated.
3. run post-processing drcov2lcov on the logfile, something like
D:\src\tmp\DynamoRIO-Windows-5.0.0-9>.\tools\bin32\drcov2lcov.exe -input drcov.common.fib.exe.73444.0000.proc.log -output coverage.info -src_filter "fib" [DRCOV2LCOV] INFO(1): Reading input files...
[DRCOV2LCOV] INFO(1): Enumerating line info...
[DRCOV2LCOV] WARNING(1): Failed to enumerate lines for C:\Windows\syswow64\SspiCli.dll
[DRCOV2LCOV] INFO(1): Writing output file...
and you will get the
coverage.info file, that has the lcov format, something like:
SF:d:\src\cygwin\home\zhaoqin\workspace\dynamorio\dynamorio.git\suite\tests\common\fib.c
DA:60,1
DA:61,1
DA:63,1
DA:64,0
DA:65,1
...
You can use genhtml from lcov to generate the html file.
There is a copy of genhtml from DynamoRIO source code at dynamorio.org.Note, genhtml does not work with the windows path, so you might want to covert the path unix format.
Let me know if you need any help.