linux-test-project / lcov

LCOV
GNU General Public License v2.0
894 stars 240 forks source link

geninfo: ERROR: bad end line 274 for _ZN11FwBusObject15postReadFromBusEv start: 282 #217

Closed yangzhijia1985 closed 1 year ago

yangzhijia1985 commented 1 year ago

When I use the lcov to generate code coverage statistics report, this mistake happen geninfo: ERROR: bad end line 274 for _ZN11FwBusObject15postReadFromBusEv start: 282 my cmd is : lcov --capture --directory ./ --output-file coverage.info and all the .o .gcno .gcda file are In the current directory Who knows why ?

yangzhijia1985 commented 1 year ago

my lcov version is lcov: LCOV version 1.0-1

henry2cox commented 1 year ago

What compiler and version?

Also - there is no 1.0-1 lcov version...and that message comes from code which is in lcov master but not in a release (yet) - so you must have downloaded from github. Good idea to download latest and try again.

The message is telling you that the function data is inconsistent: FwBusObject::postReadFromBus() starts at line 282 and ends at line 274. This is not supposed to happen :-) The data could be coming from gcov - or it could be a bug in my code which tries to derive the end line. There are a couple of possible causes - one of which is if your .info data is inconsistent (say, merged data from multiple jobs which used different versions of code).

Would help, if you could share the content of the .info file for that function. We need all the data from the "SF:..." line above the function name, to the "SF:..." line below the function. (Basically: the extracted coverage information for the source file in question.)

henry2cox commented 1 year ago

FWIW: Peter and I are debugging some issues that come up with very old compilers (gcc/4.8.5, in particular). I ran into exactly this same 'die' in that testing (...so implementing some better workarounds).

My first suggestion is going to be to update to a more modern gcc or LLVM version if you possibly can. There have been a lot of changes and fixes to the compiler's coverage infrastructure over the years. You want to take advantage of that. This particular issue does not seem to happen for gcc version 6.2.0 or newer (but I have not done extensive testing of all gcc versions and cannot tell you which versions do and do not have bugs).

henry2cox commented 1 year ago

Following up on my followup: Your issue may be fixed in f1f5cfdad39 You will need to clone this repo and/or update to latest to try it.

If your issue is resolved: please close this issue. If it is not resolved: please provide a detailed description of the problems you see - and ideally include a testcase which exhibits the issue. (If no updates after a week or two, I will close this issue.) Henry

henry2cox commented 1 year ago

You can now download the lcov 2.0 release (just announced) - and see if the issue is fixed in that. I suspect that it is.

henry2cox commented 1 year ago

Closing now. I believe this is fixed in the lcov 2.0 release.

If you think that there is still a problem, please either reopen this issue or file a new one. Please include a detailed description of the problem, and (ideally) include a testcase which exhibits the issue. Henry