|
From: Benjamin M. <be...@me...> - 2007-08-15 22:27:10
|
The last few nights I have been hacking on a coverage tool for valgrind. I have been spending most of the time learning just how to do this. Thanks for all of the docs, I really appreciated it. The main reason I wanted to write this was because the existing solutions out there require too much extra work and why do all that when valgrind could. The other, bigger reason is that using cachegrind will not give you branch information and will mislead you by saying that the following code has 100% coverage when x is only ever 10. if(x > 0) do() bar(); Below is the current output of this tool as it is tonight (run on the attached main.c file with three args) . You pass it the file you want it to record and at finish it outputs all of the line numbers with the branch reports embedded. This will go to the output file. I was thinking that another tool would run on the data and source files to produce output best for the language the source is in and for the output formats (html?). Should I try to output in the same fileformat as callgrind or ...? I saw that this tool was actually listed as one of the suggested tools to write in the docs http://valgrind.org/docs/manual/writing-tools.html#writing- tools.suggestedtools Google didn't return any results so perhaps no one has written such a tool yet? Any suggestions for a name? How about "secretary"? Are there any features that you guys would like to see in such a tool? -Benjamin Meyer ==23127== line:count ==23127== 2: 8 ==23127== 3: 8 ==23127== 6: 8 ==23127== 7: 1 ==23127== 8: 1 ==23127== 9: 1 ==23127== 10: 1 ==23127== 11: 3 ==23127== branch 0 taken 1 times (goto line 12) ==23127== branch 1 taken 0 times (fallthrough) ==23127== 12: 1 ==23127== 14: 3 ==23127== branch 0 taken 1 times (goto line 17) ==23127== branch 1 taken 0 times (goto line 15) ==23127== 17: 34 ==23127== branch 0 taken 10 times (goto line 18) ==23127== branch 1 taken 1 times (goto line 32) ==23127== 18: 40 ==23127== 19: 40 ==23127== branch 0 taken 1 times (goto line 20) ==23127== branch 1 taken 9 times (fallthrough) ==23127== 20: 4 ==23127== 21: 80 ==23127== branch 0 taken 0 times (goto line 23) ==23127== branch 1 taken 10 times (fallthrough) ==23127== branch 0 taken 0 times (goto line 26) ==23127== branch 1 taken 10 times (fallthrough) ==23127== 29: 50 ==23127== 32: 1 ==23127== 33: 1 ==23127== 36: 1 ==23127== 37: 5 |