kernel文件动态调试功能 -- dynamic_debug 打开及半闭

Kernel def_config中需要打开以下两个宏:/kernel/arch/arm/configs

CONFIG_DEBUG_FS=y 

CONFIG_DYNAMIC_DEBUG=y

(1)step1:open pr_debug
adb root
adb remount
adb shell

打开动态调试

#echo 'file sprdfb_main.c +p' > /sys/kernel/debug/dynamic_debug/control
#echo 'file lcdc.c
+p' > /sys/kernel/debug/dynamic_debug/control
#echo 'file sprdfb_dispc.c
+p' > /sys/kernel/debug/dynamic_debug/control

#echo 'file sprd-core.c+p' > /sys/kernel/debug/dynamic_debug/control

关闭动态调试

#echo 'file sprdfb_main.c -p' > /sys/kernel/debug/dynamic_debug/control
#echo 'file lcdc.c
-p' > /sys/kernel/debug/dynamic_debug/control
#echo 'file sprd-corec.c
-p' > /sys/kernel/debug/dynamic_debug/control

 

扫描二维码关注公众号,回复: 915777 查看本文章

sprdfb_main.c

pr_debug(KERN_INFO "sprdfb: [%s]: FBIO_WAITFORVSYNC\n", __FUNCTION__);

Sprd-core.c

pr_debug("%s: starting CMD%u arg %08x flags %08x\n",

 mmc_hostname(host), mrq->cmd->opcode,

 mrq->cmd->arg, mrq->cmd->flags);

stop logs4android
(2)step2:save log
save both kernel log(cat proc/kmsg) && user log(logcat -v time)

Log:

[c0] sprdfb: 6sprdfb: [sprdfb_ioctl]: FBIO_WAITFORVSYNC

[c0] sprdfb: 6sprdfb: [sprdfb_ioctl]: return 0

[c0] mmc0: starting CMD13 arg 00010000 flags 00000195

[c0] mmc0: req done (CMD13): 0: 00000900 00000000 00000000 00000000

如果需要修改Kernel log level

cat /proc/sys/kernel/printk    //个人注:只对串口输出有效? 修改发现并不会影响pr_info的输出。

7 4 1 7

echo 8 4 1 7 > /proc/sys/kernel/printk

#define KERN_EMERG        KERN_SOH "0"        /* system is unusable */

#define KERN_ALERT        KERN_SOH "1"        /* action must be taken immediately */

#define KERN_CRIT        KERN_SOH "2"        /* critical conditions */

#define KERN_ERR        KERN_SOH "3"        /* error conditions */

#define KERN_WARNING        KERN_SOH "4"        /* warning conditions */

#define KERN_NOTICE        KERN_SOH "5"        /* normal but significant condition */

#define KERN_INFO        KERN_SOH "6"        /* informational */

#define KERN_DEBUG        KERN_SOH "7"        /* debug-level messages */

猜你喜欢

转载自blog.csdn.net/chm880910/article/details/80328469