gcov support for the Linux kernel (gcov-kernel)
===============================================
Description:
------------
The gcov-kernel patch extends the Linux kernel by a means to extract code
coverage data during runtime. This is achieved by providing a directory
of virtual files (/proc/gcov) which are compatible with gcc's gcov tool
(see manpage of gcov for more information).
The latest gcov-kernel package may be obtained from the 'files' section of the
Linux Test Project homepage at:
http://sourceforge.net/projects/ltp
Configuration options:
----------------------
CONFIG_GCOV_PROFILE
Basic gcov support. Say 'y' here.
CONFIG_GCOV_ALL
Say 'y' here if you want to get gcov data for the entire kernel. Otherwise
add the line
EXTRA_CFLAGS += $(GCOV_FLAGS)
to the respective Makefiles.
CONFIG_GCOV_PROC
Provide /proc/gcov. Say 'y' here.
CONFIG_GCOV_HAMMER
Say 'n' here unless you are using a modified gcc 3.3.x compiler (e.g. shipped
with SUSE SLES9 or Mandrake 10.x). Note: an incorrect setting of this option
may result in compile time errors or in file format errors in /proc/gcov.
gcov data for kernel modules
----------------------------
On Linux 2.4, gcov data for kernel modules is only available when using
a modutils package that has been updated with the provided modutils patch.
On Linux 2.6, gcov data for kernel modules is available without further
changes.
Kernel/module parameters
------------------------
Depending on the value of CONFIG_GCOV_PROC, the following parameters can be
specified in the kernel parameter line (CONFIG_GCOV_PROC=y) or as parameter
to the modprobe command (CONFIG_GCOV_PROC=m):
- gcov_link=0/1 (default is 1): When set to non-zero, symbolic links to
source and gcov graph files are created in /proc/gcov along with the data
files.
- gcov_persist=0/1 (default is 0): When set to non-zero, gcov data for
kernel modules is kept even after those modules are unloaded so that
coverage measurements can be extended to module cleanup code. To clear
this persistent data, write to /proc/vmlinux.
Resetting kernel coverage data
------------------------------
To reset coverage data for a specific file, simply write to the associated data
file in the /proc/gcov hierarchy:
echo 0 > /proc/gcov/kernel/signal.da
To reset all coverage data, write to the extra file '/proc/gcov/vmlinux':
echo 0 > /proc/gcov/vmlinux
Questions and comments
----------------------
If you have further questions regarding the use of this patch, please check
the FAQ file for more information. Also questions or comments may be sent to
the LTP Mailing list at ltp-coverage@lists.sourceforge.net