Hi Peter,
 
Thanks for your feedback.
 
I found that the compile line contains "-g" and "-O2" switches. Doesn't this mean that the "-g" will eliminate -O2 effect ot should I eliminate -O2 at all?
 
 
 
Ahmed Osman Modelsim QA Mentor Graphics


From: Peter Oberparleiter [mailto:oberpar@linux.vnet.ibm.com]
Sent: Tue 10/27/2009 1:51 AM
To: Osman, Ahmed
Cc: ltp-coverage@lists.sourceforge.net
Subject: Re: [Ltp-coverage] LCOV inconsistent results

Osman, Ahmed wrote:
> I'm facing a strange behavior from LCOV. Down you can find that LCOV is
> reporting that function div_iter has 0 hit but when you click on it( the
> bottom snapshot) you will find that the function has been hit many
> times.

There are some reasons why this might happen:
- the source code changed between tests
- the compiler was changed between tests
- gcc was used with optimization flags enabled (-Ox)
- the function was inlined

My suggestion would be to turn of optimization. If that doesn't work,
you can try to run the gcov tool (see man pages) on the file in question
and see if gcov produces the same incorrect output. If that is the case,
you'll need to contact gcc development.

Alternatively, you can try out the latest experimental feature of lcov
which will derive function coverage data from line coverage data,
meaning that in your case, the function would have been marked as hit.
To try that, get the latest version of lcov from CVS [*] (all binaries)
and use the --derive-func-data switch while capturing data. Note that
this feature is still not fully tested and may contain bugs.


Regards,
   Peter Oberparleiter

[*] see http://ltp.sf.net/coverage/lcov.php for instructions