1. 程式人生 > >android linux kernel debug技術

android linux kernel debug技術

動態除錯功能就是你可以決定在程式執行過程中是否要 pr_debug(), dev_dbg(), print_hex_dump_debug(), print_hex_dump_bytes() 這些函式正常執行起來。

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()等函式列印日誌: