linux内核动态调试技术

动态调试功能就是你可以决定在程序运行过程中是否要 pr_debug(), dev_dbg(), print_hex_dump_debug(), print_hex_dump_bytes() 这些函数正常运行起来。

 编译内核:打开CONFIG_DEBUG_FS和CONFIG_DYNAMIC_DEBUG

echo –n 'file suspend.c line 340 +p' > /sys/kernel/debug/dynamic_debug/control     让 kernel/power/suspend.c 源码第340行的 pr_debug() 函数打印日志:

echo -n 'file test.c +p' >            /sys/kernel/debug/dynamic_debug/control      让 test.c file 中的pr_debug(),dev_dbg()等函数打印日志:
echo -n 'func test_control -p' > /sys/kernel/debug/dynamic_debug/control            让 test_control 函数不打印日志:
echo -n 'module test +p' >    /sys/kernel/debug/dynamic_debug/control                 让 module test中的pr_debug(),dev_dbg()等函数打印日志:
---------------------
作者:苏西守护者
来源:CSDN
原文:https://blog.csdn.net/u013308744/article/details/52220202
版权声明:本文为博主原创文章,转载请附上博文链接!

原文地址:https://www.cnblogs.com/erhu-67786482/p/11282354.html