关闭

linux kernel dynamic debug

标签: linux debug
3422人阅读 评论(0) 收藏 举报
分类:

refs:

http://lwn.net/Articles/434833/

https://www.kernel.org/doc/Documentation/dynamic-debug-howto.txt


= Use dynamic debug(ddebug) =

==config==

enabe debugfs, enable CONFIG_DYNAMIC_DEBUG

for some subsystem which debug based on ddebug, e.g. xhci_dbg, you also need to enable subsystem's debug


==usage==

mount -t debugfs none /sys/kernel/debug

echo 8 > /proc/sys/kernel/printk

echo "file xx.c line xxx +p" > /sys/kernel/debug/dynamic_debug/control

#also has other support to enable debug info, check Documentation/dynamic-debug-howto.txt for details.

awk '$3 != "-" ' /sys/kernel/debug/dynamic_debug/control

#check the enabled debug info is same as expected or not.

OK. now run what you want to debug and get the info you care.

Enjoy it.


= others about dynamic debug =

Dynamic debug operates on print statements written with either of:

    pr_debug(char *format, ...);
    dev_dbg(struct device *dev, char *format, ...);

If the CONFIG_DYNAMIC_DEBUG option is not set, and if DEBUG is defined, the above functionswill be turned into normalprintk() statements at theKERN_DEBUG level.

So another way to enable dev_dbg is:

 - define DEBUG before #include<linux/device.h> in the file which you want to debug.

1
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:29673次
    • 积分:427
    • 等级:
    • 排名:千里之外
    • 原创:12篇
    • 转载:3篇
    • 译文:0篇
    • 评论:4条
    文章分类
    最新评论