Open Jaakkonen opened 3 years ago
@Jaakkonen Thanks for the issue! I am unfamiliar with the coverage landscape for C programs but gcov looks to be one popular standard 🤔 but we do not currently support it (as you alluded to above).
I believe people have used the expension with gcov by using lcov to convert the coverage?
So here we will use lcov tool to check line coverage and generate html reports . For this command is as shown below.
lcov --coverage --directory . --output-file main_coverage.info
This will create a coverage report by taking .gcno and .gcda files from ‘.’ i.e. current folder where these files are present and generate an output file with coverage info in file called main_coverage.info .
Now we have coverage info lets display it in html file using below command.
https://medium.com/@naveen.maltesh/generating-code-coverage-report-using-gnu-gcov-lcov-ee54a4de3f11
Let me know if that helps any in the meantime but we could consider gcov support in the future (or if there is already a javscript / typescript package that can convert gcov -> lcov then that would make this addition even easier)!
You can generate xml
with gcvor today and that worked for me without having to do format conversion.
Note that you may have issues with relative paths depending on how your coverage was generated. You can fix that with remotePathResolve
though. For example, in my coverage xml I'm getting <source>..</source>
and had to do setup remotePathResolve
:
"coverage-gutters.remotePathResolve": [
"../src",
"./src",
],
Is your feature request related to a problem? Please describe. Currently it's not possible to see coverage of programs written in C.
Describe the solution you'd like Add support for formats used by
gcov
(.gcna, .gcno) and llvm profiling (.profdata).Describe alternatives you've considered
https://github.com/JacquesLucke/gcov-viewer but that doesn't have same kind of auto detection and less-obstructing UI that coverage-gutters has. One option is to use CLI/TUI programs to do this but it's really nice to be able to edit code and see coverage at the same time.
Additional context Guide for getting coverage with LLVM: https://releases.llvm.org/12.0.1/tools/clang/docs/SourceBasedCodeCoverage.html Gcov trivial example: https://github.com/shenxianpeng/gcov-example Ok-ish explanation how gcov works: https://www.tutorialspoint.com/unix_commands/gcov.htm https://llvm.org/docs/CommandGuide/llvm-profdata.html