GCOV Code coverage

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GCOV Code coverage

1,063 Views
fadilahali90
Contributor I

How to get code coverage(gcov) for Linux kernel(Android) in i.MX 8M evaluation kit? I share based on my study 


CASE 1:(specific directory)
I configure in config file as below:

CONFIG_DEBUG_FS=y 
CONFIG_GCOV_KERNEL=y
CONFIG_GCOV_FORMAT_AUTODETECT=y 

In specific directory I would like to get coverage, I configure the Makefile as below:
GCOV_PROFILE := y

Result: Board cannot boot up, keep rebooting until hangup

***if did not configure the Makefile(GCOV_PROFILE := y) ..then the gcov folder will be successfully created under directory /sys/kernel/debug/gcov.

CASE 2:(entire kernel)
I configure in config file as below:

CONFIG_DEBUG_FS=y 
CONFIG_GCOV_KERNEL=y 
CONFIG_GCOV_FORMAT_AUTODETECT=y

CONFIG_GCOV_PROFILE_ALL=y
Result: Error during patching by uuu tools because the img file is too big

Tags (2)
0 Kudos
2 Replies

879 Views
gusarambula
NXP TechSupport
NXP TechSupport

Hello  Fadilah Mohd Ali,

Gcov is not supported by the BSP so we do not have documentation on how to set it up.

That being said, please make sure that the filesystem in which it will run it’s not read-only (this may be a bit tricky on Android) and you may increase the .img file, but you need to declare it on the latest Android versions and edit the UUU script to reflect this change.

Hopefully another Community user may provide more insight from their own experience setting up gcov.

Regards,

0 Kudos

879 Views
fadilahali90
Contributor I

Hi, 

I try to debug the kernel log of the CASE 1 above.

I found that, the error "Unable to handle kernel paging request at virtual address adbf1650"

this error return by  gcov_info_filename function in the gcc_4_7.c file. The function is referring to the address adbf1650 

Finally it will trigger error "[    1.410724] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b"

1.407082] [<ffff000008ed55a0>] strlen+0x60/0x84
[ 1.407090] [<ffff0000081a5920>] gcov_event+0x208/0x388
[ 1.407095] [<ffff0000081a4cf8>] gcov_enable_events+0x30/0x5c
[ 1.407103] [<ffff00000951a550>] gcov_fs_init+0x9c/0xcc
[ 1.407110] [<ffff000008083cbc>] do_one_initcall+0x48/0x14c
[ 1.407117] [<ffff000009500e88>] kernel_init_freeable+0x1bc/0x270
[ 1.407122] [<ffff000008eebc48>] kernel_init+0x10/0x140
[ 1.407127] [<ffff000008085080>] ret_from_fork+0x10/0x18
[ 1.407133] Code: 8b4c0c00 d65f03c0 f10020ff cb0703e7 (a8c10c22)
[ 1.407145] ---[ end trace 59de2c94e9f472ee ]---
[ 1.410724] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

0 Kudos