dynamic debug支持动态的enable, disable kernel的LOG。
首先要enable CONFIG_DYNAMIC_DEBUG, 之后所有的pre_debug()/dev_debug()的信息,就都可以动态的enable/disable
这个feature是基于debugfs的,所以首先要mount debugfs
mount -t debugfs /sys/kernel/debug
之后想要动态的enable或者disable某个文件的LOG,就做如下操作:
Examples
========
// enable the message at line 1603 of file svcsock.c
nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
/dynamic_debug/control
// enable all the messages in file svcsock.c
nullarbor:~ # echo -n 'file svcsock.c +p' >
/dynamic_debug/control
// enable all the messages in the NFS server module
nullarbor:~ # echo -n 'module nfsd +p' >
/dynamic_debug/control
// enable all 12 messages in the function svc_process()
nullarbor:~ # echo -n 'func svc_process +p' >
/dynamic_debug/control
// disable all 12 messages in the function svc_process()
nullarbor:~ # echo -n 'func svc_process -p' >
/dynamic_debug/control
// enable messages for NFS calls READ, READLINK, READDIR and READDIR+.
nullarbor:~ # echo -n 'format "nfsd: READ" +p' >
/dynamic_debug/control
参考:linux/Documentation/dynamic-debug-howto.txt
阅读(5597) | 评论(1) | 转发(1) |