Re: Gcov and lcov

From: Peter Oberparleiter
Date: Wed Aug 26 2009 - 08:28:03 EST


Hi,

Michal Simek wrote:
First of all there should be DEBUG_FS instead of DEBUG in documentation.
diff --git a/Documentation/gcov.txt b/Documentation/gcov.txt
index 40ec633..e7ca647 100644
--- a/Documentation/gcov.txt
+++ b/Documentation/gcov.txt
@@ -47,7 +47,7 @@ Possible uses:

Configure the kernel with:

- CONFIG_DEBUGFS=y
+ CONFIG_DEBUG_FS=y
CONFIG_GCOV_KERNEL=y

Thanks for pointing this out. This was reported before and will be fixed in a future kernel release.

I am missing any option to be possible to stop capture coveradge data.

There is currently no way to turn gcov-based profiling off during run-time.

I am running in on Microblaze and it takes me a lot of time to grap all
gcda data from debugfs.

If you don't need coverage data for all of the kernel source, you can turn off option CONFIG_GCOV_PROFILE_ALL and only enable profiling for those directories or files which are of interest to you. This should greatly reduce the number of files that you need to copy and also the overall kernel-slowdown.

See the help text for configuration option CONFIG_GCOV_KERNEL for a description of how to turn profiling on for single directories or files.

Then I would like to use lcov and generate html sites. This could be
possible but I haven't found
a way how to do it.

I used lcov --capture --directory . --output-file out

There is this mishmash in version string
/home/projects/xils/_full/software/linux-monstr_eu-commit/kernel/spinlock.gcno:version
'401*', prefer '401p'
/home/projects/xils/_full/software/linux-monstr_eu-commit/kernel/spinlock.gcda:version
'401*', prefer version '401p'

and then genhtml out which end with fault because my out file contain
wrong patches where is part of path repeated.
arch/microblaze/kernel/arch/microblaze/kernel

The warning messages you are seeing indicate that the version of gcov used for analyzing and the version of gcc used for compiling differ. You need to specify the correct gcov tool binary (the one that comes with the compiler used to compile the kernel) by using lcov's --gcov-tool option.

Also current lcov releases only contain support for the gcov-kernel infrastructure as provided by the external gcov-kernel patch. I added support for the new upstream infrastructure to the CVS version[*] of lcov.

Using the CVS version, you can do the following:

On the test machine:
lcov -c --to-package coveragedata

This will create a file coveragedata which includes all .gcda files. Copy this file to the build machine and do:
lcov -c --from-package coveragedata -o data.info

This will allow you to do the actual analysis of coverage data on the build machine. See the man page for lcov for a detailed description of this approach.


Regards,
Peter Oberparleiter

[*] See http://ltp.sourceforge.net/coverage/lcov.php for instructions on how to obtain the CVS version of lcov

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/