Hi there,
          i am working on gcov tool usage for 2 weeks and don't know what to do.
I am trying to build android device kernel and try to use gcov to analyze the code coverage of my driver.
base on the research online and found we do not need patch after 2.6.31.
hence i get the version above that and add some configuration as follow.
 
However, after compile, install and boot the kernel, i successfully found .gcno in desired directory but in device, i only see the sys/kernel/debug/gcov directory and reset file in there.
i stuck at what will be the next step. should i see symbolic link as linux document says or where should i place the source file in the device in order to produce .gcda file?
 
Please help and thank you!!!
 
1.      In kernel configuration file, make sure enable the following information. If it does not exist, please add it.
CONFIG_DEBUG_FS=y
CONFIG_GCOV_KERNEL=y
 
[Optional] get coverage data for the entire kernel.
CONFIG_GCOV_PROFILE_ALL=y
 
2.      in kernel source, give the following command to compile configuration file.
$ make <configuration file>
 
3.      in Linux console, go into kernel source and give the following command to enable the gcov feature.
$ make menuconfig
Choose General setup --> GCOV-based kernel profiling--> Enable gcov-based kernel profiling
 
[Optional]
For coverage the entire kernel, also enable Profile entire Kernel
 
4.      Since the default compiler will overwrite the gcov file name, we need to modify Kconfig file.
For example, if we want to get coverage for directory <kernel source directory>/kernel/gcov,
Open the Kconfig in that directory and delete the line depends on S390 || X86 || (PPC && EXPERIMENTAL) || MICROBLAZE
5.      To enable profiling for specific files or directories, add a line similar to the following to the respective kernel Makefile:
 
        For a single file (e.g. main.o):
                GCOV_PROFILE_main.o := y
 
        For all files in one directory:
                GCOV_PROFILE := y
 
To exclude files from being profiled even when CONFIG_GCOV_PROFILE_ALL is specified, use:
 
                GCOV_PROFILE_main.o := n
        and:
                GCOV_PROFILE := n
 
Only files which are linked to the main kernel image or are compiled as kernel modules are supported by this mechanism.
 
6.      Now you can build kernel by command in kernel source directory.
$ make