Closed dilyanpalauzov closed 3 months ago
Looks like your version of llvm/12 is generating invalid lcov syntax.
The record should have been:
BRH:0
There is no valid key called BFH
.
The message from genhtml also tells you what to do, if you want to ignore this error rather than fixing it. There is more information on error management, in the man page.
WRT llvm and gcc - I had added discussion #234 on the topic, some months ago. It may (or may not) help to clarify the issues for you.
If you say BRH:0
is invalid or not defined, then I close this ticket. --ignore-erros format
does the right thing.
Where is the definition of the gcov format and its fields?
Where is the definition of the gcov format and its fields?
There is another long discussion of exactly this in issue #113
The upshot is that this is defined in the source code and is also described in the geninfo
man page.
https://github.com/llvm/llvm-project/commit/9116211d180ca417fa93d4e97e60f4ba849d58d9 changes the export in llvm-cov from BFH
to BRH
. clang-tools, delivered with Visual Studio 2019, are in version 12 and export BFH
.
I suggest replacing on https://github.com/linux-test-project/lcov/discussions/234 the text 9116211d180ca417fa93d4e97e60f4ba849d58d9 with a hyperlink to https://github.com/llvm/llvm-project/commit/9116211d180ca417fa93d4e97e60f4ba849d58d9 and the text 9f2967bcfe2f7d1fc02281f0098306c90c2c10a5 with a hyperlink to https://github.com/llvm/llvm-project/commit/9f2967bcfe2f7d1fc02281f0098306c90c2c10a5 .
The first hyperlink makes easy to understand how to use old clang : substitute BFH
with BRH
.
My understanding is that in fact the substitution BFH
to BRH
in the lcov files is the only necessary change needed, when llvm-cov export -format=lcov
is from llvm 12. The 234-discussion suggests upgrading LLVM, which is correct, but it could also state that the substitution in the files generated by llvm-cov export -format=lcov
is the single change needed to get it running.
My understanding is that in fact the substitution
BFH
toBRH
in the lcov files is the only necessary change needed, whenllvm-cov export -format=lcov
is from llvm 12. The 234-discussion suggests upgrading LLVM, which is correct, but it could also state that the substitution in the files generated byllvm-cov export -format=lcov
is the single change needed to get it running.
Or just tell lcov to --ignore
the format error.
That may or may not be easier than adding a sed
step to fix the text. Also won't change anything, if you later upgrade your compiler.
Seems like the bug is in certain versions of llvm/12 - but was fixed shortly after.
I have these files:
linux-gcc: g++ --coverage u.cpp -o u -g ./u lcov --directory . --capture -o output2 genhtml -o html_report output1 output2
Under Windows I execute
This utilizes clang 12 and then output1 has
In the same directory under Linux (WSL2) I execute
make linux-gcc
, which printsFor reference, the content of output2 is
My understanding is that gcov is somehow interchangeable format between clang, gcc and lcov. But BFH in this format is not understood by lcov.
LCOV version 2.0-1 (as reported on Fedora)
In any case I want to compile code under Windows with either cl.exe or clang-cl.exe and produce code coverage files. Then I want to compile and run the same source code under Linux with g++, produce other coverage files and at the end merge the code coverage files executed under both platforms. I want to see the code, which is never executed.