2021年10月27日 星期三

Linux driver: How to enable dynamic debug at booting time for built-in driver.

 Dynamic debug is useful for debug driver, and can be enable by:

1. Mount debug fs

#>mount -t debugfs none /sys/kernel/debug

2. Enable dynamic debug for specifiy funcition

 echo 'file virtio_pci_modern.c +p' > /sys/kernel/debug/dynamic_debug/control

However somtimes we need to debug built-in driver and need enable dynamic debug at boot time. then we can enable by passing dyndbg to Kernel command line like

dyndbg="'file virtio_pci_modern.c +p"

with QEMU we can use -append to attach dyndbg

qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -append "dyndbg="file virtio_pci_modern.c +p""

Ref:
  Kernel document/dynamic-debug-howto
 https://www.kernel.org/doc/html/v4.11/admin-guide/dynamic-debug-howto.html

沒有留言:

張貼留言

Linux driver: How to enable dynamic debug at booting time for built-in driver.

 Dynamic debug is useful for debug driver, and can be enable by: 1. Mount debug fs #>mount -t debugfs none /sys/kernel/debug 2. Enable dy...