Hi Josef,
Gcov is not available under my current system, and currently not supported
yet.

I've been able to tried out Covergrind, with Valgrind version 3.2.1. There's
a guy asked about this before:
http://www.nabble.com/code-coverage-with-Valgrind-%2B-Covergrind-td15308871.html
.

It turned out that though the output of Covergrind is similar to Callgrind,
but rather at line level:

fl=(10) /program-path
...
fn=10
fl=(10)
52 1
53 1
...
As above, each line that has been "touched" will be maked at 1 (and the
number can only be 1).

I've written a little test program and result is quite inspiring. So I think
the only thing I need to do now is to write a script
to count the total line within a program (better to remove #include file
lines and comment lines). And then compare the count with the sum that can
be calculated based on the above output.

Am I right about this?

Thanks~

-Fei


On Mon, Jul 27, 2009 at 5:11 PM, Josef Weidendorfer <
[email protected]> wrote:

> On Monday 27 July 2009, He fei wrote:
> > Hi Josef,
> > Thanks for your input~
> >
> > So you mean there doesn't actually exist a real code coverage tool within
> > Valgrind that can act like gconv?
>
> I suppose you talk about "gcov". Actually, AFAIK, no.
>
> > Then what about execute valgrind with the target program and then gconv
> it
> > (with gconv option turned on during gcc compilation)?
>
> If you recompile your code for use with gcov, why would you use a Valgrind
> tool at all? What is the expected benefit?
>
> Perhaps I misunderstood your request: I never used gcov myself.
>
> Josef
>
> >
> > Will this does the trick?
> >
> > Regards,
> >
> > -Fei
> >
> > On Mon, Jul 27, 2009 at 3:43 PM, Josef Weidendorfer <
> > [email protected]> wrote:
> >
> > > On Monday 27 July 2009, He fei wrote:
> > > > Hi All,
> > > > My current project works on a unit testing with Valgrind. In order to
> > > better
> > > > test the code, a code coverage output with Valgrind is desired.
> > > > I've looked into Cachegrind and Callgrind and I believe callgrind is
> more
> > > > close to what I need.
> > > >
> > > > But after running callgrind, I was dissapointted as it doesn't
> provide a
> > > > general code percentile summary (like how many lines have been
> covered),
> > > but
> > > > rather how many instruction covered.
> > >
> > > Because Cachegrind/Callgrind never touches code which was not executed,
> you
> > > can not
> > > calculate a percentile summary of covered code. There needs to be a
> > > detection phase
> > > of what source code lines exist even if no code was executed from them.
> > > This could
> > > then be combined with Callgrinds/Cachegrinds data to provide the
> summary
> > > you want.
> > >
> > > > I googled online and found no clue info regarding this. The most
> possible
> > > > approach will be
> http://www.brainmurders.eclipse.co.uk/covergrind.html,
> > > > which will require extra effort in compiling and add-on.
> > >
> > > In Covergrind, I only see the metric "LinesTouched". No idea if it
> provides
> > > "LinesNotTouched" which would be required.
> > >
> > > Josef
> > >
> > > >
> > > > I wonder if there's option or combined method within current Valgrind
> > > > framework that this can be done.
> > > >
> > > > Best regards,
> > > >
> > >
> > >
> > >
> >
> >
>
>
>


-- 
Fei He
Graduate Student
Information Networking Institute
Carnegie Mellon University

[email protected]
+1 412 330 8051
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to