linux-test-project / lcov

LCOV
GNU General Public License v2.0
866 stars 234 forks source link

how to see the verbose error msg? #288

Closed changyuang closed 3 weeks ago

changyuang commented 2 months ago

when i use lcov in Android,such as following command:

lcov -c -o info -d .

An error occurred, the error message is as follows:

geninfo: ERROR: GCOV failed for xxxxx.gcda!

I want to know the detailed error information and what should I do?

changyuang commented 2 months ago

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

changyuang commented 2 months ago

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?

henry2cox commented 2 months ago

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?

changyuang commented 2 months ago

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.

henry2cox commented 2 months ago

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.

changyuang commented 2 months ago

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!
henry2cox commented 2 months ago

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:

changyuang commented 2 months ago

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?

henry2cox commented 2 months ago

If I understand the question:

henry2cox commented 1 month ago

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.

henry2cox commented 3 weeks ago

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.