在 Documentation/dynamic-debug-howto.txt 有說明。
大概就是:
- menuconfig 圈選 dynamic_debug
CONFIG_DYNAMIC_DEBUG=y
- 系統啟動後,手動 mount debugfs :
#mkdir /mnt/debugfs #mount -t debugfs none /mnt/debugfs
- 把 /mnt/debugfs/dynamic_debug/control 打開來看..
- control 會列出所有 pr_debug 所在的source file 和位置,用 echo ... 可以把該 pr_debug 打開或關閉
control 檔的內容大概是:
...
drivers/i2c/busses/mxc_i2c_hs.c:154 [mxc_i2c_hs]mxci2c_hs_bus_busy - "%s: Bus Busy!\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:264 [mxc_v4l2_capture]mxc_free_frames - "In MVC:mxc_free_frames\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:413 [mxc_v4l2_capture]mxc_streamoff - "In MVC:mxc_streamoff\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:2825 [mxc_v4l2_capture]camera_init - "In MVC:camera_init\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:574 [mxc_v4l2_capture]start_preview - "MVC: start_preview\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:592 [mxc_v4l2_capture]start_preview - "End of %s: v2f pix widthxheight %d x %d\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:595 [mxc_v4l2_capture]start_preview - "End of %s: crop_bounds widthxheight %d x %d\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:598 [mxc_v4l2_capture]start_preview - "End of %s: crop_defrect widthxheight %d x %d\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:601 [mxc_v4l2_capture]start_preview - "End of %s: crop_current widthxheight %d x %d\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:617 [mxc_v4l2_capture]stop_preview - "MVC: stop preview\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:335 [mxc_v4l2_capture]mxc_streamon - "In MVC:mxc_streamon\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:2714 [mxc_v4l2_capture]mxc_v4l2_resume p "In MVC:mxc_v4l2_resume\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:2681 [mxc_v4l2_capture]mxc_v4l2_suspend - "In MVC:mxc_v4l2_suspend\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:2812 [mxc_v4l2_capture]mxc_v4l2_master_detach - "In MVC:mxc_v4l2_master_detach\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:2756 [mxc_v4l2_capture]mxc_v4l2_master_attach - "In MVC: mxc_v4l2_master_attach\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:2757 [mxc_v4l2_capture]mxc_v4l2_master_attach - " slave.name = %s\012"
drivers/media/video/mxc/capture/mxc_v4l2_capture.c:2758 [mxc_v4l2_capture]mxc_v4l2_master_attach - " master.name = %s\012"
..
中間那個 "-" 就代表不印出來,若是 "p" 就代表要印出來。
所以要是希望 mxc_v4l2_capture.c 裡所有的 pr_debug 都印出來,可以用:
echo 'file mxc_v4l2_capture.c +p' > control
如果不要了,就用:
echo 'file mxc_v4l2_capture.c -p' > control
如果只是要第 617 行的 stop preview 印出來,就用:
echo 'file mxc_v4l2_capture.c line 617 +p' > control
- 雖然是enable print,但是 print level 還是follow 當初source code 寫得,所以有些還是要用 dmesg 才會看得到。
- 可以對 control 使用grep command,不必每次都cat 出來
沒有留言:
張貼留言