Giter Club home page Giter Club logo

Comments (11)

changyuang avatar changyuang commented on August 17, 2024

The .gcov file can be generated successfully using gcov, but it fails using lcov

from lcov.

changyuang avatar changyuang commented on August 17, 2024

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.

henry2cox avatar henry2cox commented on August 17, 2024

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.

changyuang avatar changyuang commented on August 17, 2024

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.

henry2cox avatar henry2cox commented on August 17, 2024

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.

changyuang avatar changyuang commented on August 17, 2024

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.

henry2cox avatar henry2cox commented on August 17, 2024

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.

changyuang avatar changyuang commented on August 17, 2024

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.

henry2cox avatar henry2cox commented on August 17, 2024

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 corresponding gcc/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 your clang, 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.

henry2cox avatar henry2cox commented on August 17, 2024

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.

henry2cox avatar henry2cox commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.