Comments (11)
The .gcov file can be generated successfully using gcov, but it fails using lcov
from lcov.
when i use gcov,The following information will appear, but the .gcov file will eventually be generated
aosp/metrics_reporter_android.gcno:no lines for '_ZN7android6fs_mgr15MetadataBuilderD2Ev'
aosp/metrics_reporter_android.gcno:no lines for '_ZN7android6fs_mgr14PartitionGroupD2Ev'
aosp/metrics_reporter_android.gcno:no lines for '_ZN7android6fs_mgr9PartitionD2Ev'
aosp/metrics_reporter_android.gcno:no lines for '_ZN22chromeos_update_engine24MetricsReporterInterfaceC2Ev'
aosp/metrics_reporter_android.gcno:no lines for '_ZN7android6fs_mgr10LpMetadataD2Ev'
Could this be the reason why lcov failed?
from lcov.
Which version of lcov are you using? Similarly, which compiler and compiler version?
A quick check of the code indicates that lcov --capture ...
should emit gcov's stderr gcov returned an error code, and that lcov --capture -v -v ...
will print stdout as well.
Do you have a testcase which exhibits the issue?
from lcov.
lcov version is 1.10,and i use file command to check gcno and gcda file,the version displayed is as follows
main.gcno: GCC gcno coverage (-ftest-coverage), version 4.8
main.gcno: GCC gcno coverage (-ftest-coverage), version 4.8
aosp/metrics_reporter_android.gcda: GCC gcda coverage (-fprofile-arcs), version 4.8
aosp/metrics_reporter_android.gcno: GCC gcno coverage (-ftest-coverage), version 4.8
when i delete metrics_reporter_android.gcda and metrics_reporter_android.gcno file, lcov command succeed. I want to know why some files will fail and some will succeed.
from lcov.
lcov/1.10 pre-dates the switch to github - so is prior to 2015.
You need to update to a newer version where your issue may already be fixed.
from lcov.
i have changed the lcov version to 1.16,but it also failed as follows.How should i proceed?
Capturing coverage data from .
Found gcov version: 4.8.5
Scanning . for .gcda files ...
Found 2 data files in .
Processing aosp/metrics_reporter_android.gcda
geninfo: ERROR: GCOV failed for /media/work/update_engine/aosp/metrics_reporter_android.gcda!
from lcov.
From your error message: it appears that gcov is not happy - say, is returning an error code when processing 'metrics_reporter_android.gcda'. Old lcov versions saw that as a fatal error, and stopped. Newer versions can be configured to ignore the issue and keep going.
However: the gcov data is very likely still wrong/not captured correctly by gcov - and hence not processed by lcov even if you update to the latest release.
To address this: you very likely need a newer gcc which doesn't have the bug. As with your lcov/1.10 problem: gcc/4.8.X is very old at this point.
However: you may or may not be able to update your toolchain - or, at least I can think of a lot of really good reasons why you would not be able to update your compiler and toolchain.
I think you have at least 3 alternatives:
-
update tool versions.
Current LCOV release is 2.1 (two years and many, many code changes newer than 1.16.) If you can update to that: then you can probably bypass the gcov issue and generate a coverage report (but with incomplete data - see above).
Current GCC is 13.X, and current LLVM is 18.X.
It is quite likely that your gcov bug was fixed in gcc/9.X (or later). There were a lot of changes in gcc/9. -
Exclude this file - and all the other files which see similar issues from the set that
lcov --capture
sees.
In old lcov versions, the only way I know to do that is to run a script to delete or rename the offending files.
Of course - if you remove or ignore the files, then your coverage report will contain no data from those compilation units. -
Copy your data (the .gcda and .gcno files) to a different machine - say, a linux box where you can install lcov/2.1 - and then run your capture command there. You may also need to run genhtml on that machine as well (...so you may need your source code as well as the coverage data files), as the data files generated by lcov are slightly different between 2.0/2.1 and older lcov releases. (Backward compatible - but not forward compatible.)
from lcov.
Thanks for your answer! I'll try out those methods. I have another question to ask: where can I find the corresponding versions between gcc, llvm, and gcno?
from lcov.
If I understand the question:
-
gcov
is part of the gcc toolchain - and a compatible gcov version will be in the same place as the correspondinggcc
/g++
executable.
Generally: gcov will complain if it finds a gcda/gcno file with the wrong magic number. -
similarly,
llvm-cov
is part of the llvm toochain - and will be found where yourclang
,llvm-objdump
, etc. executables are found. Again: you should use compatible toolchain components.
It is also true that the gcov data that llvm produces is compatible with gcov/4.2 (or was nearly compatible).
Despite that compatibility, I think that it is a really bad idea to use 'gcov' from some gcc install with the data generated by llvm. It might work - or might appear to work - but you are playing with fire.
We care very deeply about code quality as well as correctness of the reports we are relying on - and so would not take that risk.
from lcov.
No updates in a couple of months.
I presume that this means that the issue is resolved (or you no longer care about it).
In a few days, I will go ahead and close this issue - unless there is something more that needs to be done.
from lcov.
Closing this issue now.
If there is still a problem, please feel free to reopen this issue or file a new one.
Please describe the problem in detail and provide a testcase which illustrates the issue, if possible.
from lcov.
Related Issues (20)
- genhtml: --keep-going doesn't work for ERROR: <file> is not readable or doesn't exist. HOT 8
- LCOV 2.1 not compatible with Codecov HOT 9
- LCOV coverage.dat file has "DA:0:0" HOT 3
- lcov on x86 HOT 9
- genhtml: ERROR: Can't call method "branchElem" on an undefined value HOT 2
- Duplicate folder structure (--prefix does not help) HOT 2
- gcov error:std::bad_alloc HOT 8
- lcov fails with gcc 14 HOT 1
- perl2lcov: unexpected data type 'time' HOT 6
- genhtml package removed from PyPI HOT 1
- RPM 2.1-1 does not install on Rocky Linux 8 or Centos7 HOT 1
- Unable to generate gcda file for cc_library_shared module HOT 4
- inconsistent branch coverage summary HOT 1
- Build of example fails on Ubuntu 22.04.4 LTS due to Makefile using SHELL of /bin/sh (softlink to /bin/dash) HOT 1
- Build of examples fails if part of path is a softlink HOT 4
- Option geninfo_external from a user-provided lcovrc file gets ignored HOT 4
- Incorrect #line directives cause Perl warnings HOT 1
- lcov fails with "(inconsistent) mismatched end line" for googletest code HOT 1
- lcov --no-external behaves incorrectly with 2 or more -d
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lcov.