|
From: Josef W. <Jos...@gm...> - 2005-04-26 21:43:19
|
On Tuesday 26 April 2005 20:13, Benoit Peccatte wrote: > Hi, > > This is a first version of my coverage tool. > You can find it at http://b.peccatte.free.fr/cover-0.01.tgz Cool, it even compiles with VG 2.4.0 without problems. > To build it : > - extract cover.tgz into the valgrind directory > - add cover to Makefile.am in the 'TOOL = ...' line I needed to add the directory also at the end of configure.in, so that configure creates the Makefile. I think the script (cover) should be installed, too, via a bin_SCRIPT line in Makefile.am. > To use it simply call valgrind withe --tool=cover > This produces a cover.pid file. This file can be read with cg_annotate This works good if you rename it to "cachegrind.out.*" (aside from the warnings because of the "ob=" lines). Especially the source annotation looks good. Small example for a small test loop: ==================================== ... hasDebug executed execCount . . . int main() 1 1 1 { 1 1 1 int i, j=0; . . . 1 1 2 printf("Hello World!\n"); . . . 2 2 202 for(i=0;i<100;i++) 1 1 200 j += a(i); . . . 1 1 1 return j; 1 1 1 } ... ======================================= What is the exact semantic of the numbers? I am curious because of "executed=2" for the printf line, "hasDebug=2" on the for() line, and "execCount=200" on the loop body line. > or kcachegrind. This works fine out of the box, with function grouping according to object file and similar annotation as above. The function overview is currently limited to show only one event type... Regarding a patch for iterators for debug info for Valgrind: best is to send it to the mailing list (or a link to it if it's long), and ask for inclusion. Josef > This is not really tested. It currently produces warnings > because I use ob= inappropriatly. > > I made a script to get clean summary of coverage information. > Simply run > ./cover cover.pid > ./cover -h will give you explanations on how to use it. > > Benoit |