加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

Linux内核代码覆盖率 – GCOV

发布时间:2020-12-14 01:00:44 所属栏目:Linux 来源:网络整理
导读:我正在尝试使用 Linux test Project的一些测试场景并获得 Kernel source code coverage. 我正在使用GCOV / LCOV这样做. 这是我到目前为止的事情: 构建配置中的GCOV标志 GCOV-based kernel profiling CONFIG_GCOV_KERNEL=y CONFIG_GCOV_PROFILE_ALL=y On Lin
我正在尝试使用 Linux test Project的一些测试场景并获得 Kernel source code coverage.

我正在使用GCOV / LCOV这样做.

这是我到目前为止的事情:

>构建配置中的GCOV标志

GCOV-based kernel profiling

CONFIG_GCOV_KERNEL=y

CONFIG_GCOV_PROFILE_ALL=y

On Linux kernel version: 2.6.32.60+drm33.26

>构建内核后,我在源文件夹中包含了所有.gcov文件
>当我使用源文件作为输入时,GCOV / LCOV有效

我应该拥有的东西,但我没有

> / proc / GCOV文件夹
> GCOV内核模块(gcov.o?)

现在我想要的是运行测试场景并使用LCOV获取到目前为止使用的Linux内核代码的哪一部分.但是当我调用LCOV -c时,即使所有构建标志都没问题,这也是我得到的.

Loading required gcov kernel module.

lcov: ERROR: cannot load required gcov kernel module!

有一个内核补丁< 2.6.30然后它是内置的.

解决方法

下面是我对ubuntu 12.04默认内核的尝试.
认为gcov没有启用,但是安装了调试fs并且可以在其中找到一些kvm调试inforation.

ubuntu:/sys/kernel# mount -t debugfs none /sys/kernel/debug
mount: none already mounted or /sys/kernel/debug busy
mount: according to mtab,none is already mounted on /sys/kernel/debug
ubuntu:/sys/kernel# umount /sys/kernel/debug
ubuntu:/sys/kernel# mount -t debugfs none /sys/kernel/debug
ubuntu:/sys/kernel# ls debug
acpi  bdi  bluetooth  extfrag  gpio  hid  kprobes  kvm  mce  regmap  regulator  sched_features  suspend_stats  tracing  usb  wakeup_sources  x86
ubuntu:/sys/kernel# cat debug/kvm/
efer_reload          host_state_reload    io_exits             mmio_exits           mmu_pte_write        nmi_window           signal_exits
exits                hypercalls           irq_exits            mmu_cache_miss       mmu_recycled         pf_fixed             tlb_flush
fpu_reload           insn_emulation       irq_injections       mmu_flooded          mmu_shadow_zapped    pf_guest
halt_exits           insn_emulation_fail  irq_window           mmu_pde_zapped       mmu_unsync           remote_tlb_flush
halt_wakeup          invlpg               largepages           mmu_pte_updated      nmi_injections       request_irq
ubuntu:/sys/kernel# cat debug/kvm/io_exits
467789515
ubuntu:/sys/kernel#

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读