Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#4 coverage information for module_exit function

Márton Németh

As a new module is loaded into the kernel, the counters are also allocated. The counters can be read out as long as the module is in the memory.

However, the module_exit function is only executed when the module is unloaded. Once the module is unloaded, the counters are also free()d, so the coverage information of the module_exit is lost.

I could imagine a solution what keeps the counter values in the memory until they are not zeroed out by 'lcov -z', but I don't know if this would be the right solution for the problem.


  • Logged In: YES
    Originator: NO

    This feature has already been implemented. Quote from the gcov-kernel README (http://ltp.cvs.sourceforge.net/*checkout*/ltp/utils/analysis/gcov-kernel/README):

    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

    - 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.

  • Subrata Modak
    Subrata Modak

    • status: open --> closed