浅析使用dump_stack在driver开发期间清晰查看内核中函数调用流程
void dump_stack(void)
{
__backtrace();
}
arch/arm/lib/backtrace.S|25| ENTRY(__backtrace)
在 int wlan_init_fw(wlan_private * priv)函数中加入dump_stack();函数,这样我们可以查看执行到我们加在wlan_init_fw()函数中的dump_stack();函数中所有栈中引发入栈动作的层层上级函数们[luther.gliethttp].
luther@gliethttp:~$ insmod sd8688.ko
会打出如下log:
可以看出函数调用的栈视图是这样的[luther.gliethttp]:
dump_stack
<= wlan_init_fw
<= wlan_add_card
<= wlan_probe
<= sdio_bus_probe
<= driver_probe_device
<= __device_attach
<= bus_for_each_drv
<= device_attach
<= bus_attach_device
<= device_add
<= sdio_add_func
<= mmc_attach_sdio
<= mmc_rescan
<= run_workqueue
<= worker_thread
<= kthread
<= do_exit
[ 189.648865] [] (dump_stack+0x0/0x14) from [] (wlan_init_fw+0x78/0x364 [sd8688])
[ 189.649170] [] (wlan_init_fw+0x0/0x364 [sd8688]) from [] (wlan_add_card+0x1c0/0x4a0 [sd8688])
[ 189.649292] r8:c40e7208 r7:c5684600 r6:c6962000 r5:c539b000 r4:c539b360
[ 189.649323] [] (wlan_add_card+0x0/0x4a0 [sd8688]) from [] (wlan_probe+0x54/0x128 [sd8688])
[ 189.649536] [] (wlan_probe+0x0/0x128 [sd8688]) from [] (sdio_bus_probe+0x70/0x7c)
[ 189.649719] r6:bf0a0aac r5:00000000 r4:c5778400
[ 189.649719] [] (sdio_bus_probe+0x0/0x7c) from [] (driver_probe_device+0xac/0x1b0)
[ 189.649780] r7:c01ae3c0 r6:c5778408 r5:bf0a0ac4 r4:c5778408
[ 189.649811] [] (driver_probe_device+0x0/0x1b0) from [] (__device_attach+0x10/0x14)
[ 189.649841] r8:c6962000 r7:c01ae3c0 r6:c5778408 r5:c6963e7c r4:00000000
[ 189.649872] [] (__device_attach+0x0/0x14) from [] (bus_for_each_drv+0x68/0x94)
[ 189.649903] [] (bus_for_each_drv+0x0/0x94) from [] (device_attach+0x94/0x9c)
[ 189.649933] r7:00000000 r6:00000000 r5:c57784b0 r4:c5778408
[ 189.649964] [] (device_attach+0x0/0x9c) from [] (bus_attach_device+0x4c/0x7c)
[ 189.649994] r5:c5778408 r4:c03bad34
[ 189.649994] [] (bus_attach_device+0x0/0x7c) from [] (device_add+0x3b4/0x55c)
[ 189.650025] r5:c5778494 r4:c5778408
[ 189.650055] [] (device_add+0x0/0x55c) from [] (sdio_add_func+0x3c/0x58)
[ 189.650086] [] (sdio_add_func+0x0/0x58) from [] (mmc_attach_sdio+0xf0/0x170)
[ 189.650116] r4:c6de2c00
[ 189.650116] [] (mmc_attach_sdio+0x0/0x170) from [] (mmc_rescan+0x208/0x28c)
[ 189.650147] r6:00000000 r5:c6963f5c r4:c6de2c00
[ 189.650177] [] (mmc_rescan+0x0/0x28c) from [] (run_workqueue+0x15c/0x2c4)
[ 189.650208] r7:c690d808 r6:c01fd08c r5:c690d800 r4:c6de2d74
[ 189.650238] [] (run_workqueue+0x0/0x2c4) from [] (worker_thread+0xa0/0x124)
[ 189.650269] r8:00000000 r7:c6963fac r6:c690d800 r5:c690db3c r4:c6962000
[ 189.650299] [] (worker_thread+0x0/0x124) from [] (kthread+0x50/0x7c)
[ 189.650330] r7:00000000 r6:00000000 r5:c006d3c4 r4:c690d800
[ 189.650360] [] (kthread+0x0/0x7c) from [] (do_exit+0x0/0x704)
[ 189.650391] r5:00000000 r4:00000000
阅读(5929) | 评论(0) | 转发(2) |