在调试和开发过程中,经常会遇到crash或者dump,且最后定位的log是函数+堆栈数字
类似于:b *(mtp_read+0x48)
这样的结果我们就需要根据反汇编去查找,0x100具体在函数的哪一行
如下:
先找到eabi脚本位置:/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin$
然后在用该脚本运行:./arm-eabi-gdb vmlinux
b *(mtp_read+0x48) 跳转到PC指针位置——》会在gcc中具体提示那一行
如果有.o文件的话,可以直接用arm-eabi-objdump -D xxxx.o> xxxx.txt保存下来
查看代码,然后退出
举个栗子:
以下为http://blog.csdn.net/weiqifa0/article/details/44222929博客执行结果,借用来给大家演示下
执行结果:
(gdb) l * qrd7627a_add_io_devices+0x100
0xc07cd05c is in qrd7627a_add_io_devices (/home/yejialong/GH700C/kernel/arch/arm/mach-msm/msm8x25/goso-msm7627a-io.c:1851).
1846 } else if (machine_is_msm8625q_skud() || machine_is_msm8625q_evbd()) {
1847 #ifndef CONFIG_CALA02
1848 platform_device_register(&pmic_mpp_leds_pdev_skud);
1849 #endif
1850 /* enable the skud flash and torch by gpio leds driver */
1851 platform_device_register(&gpio_flash_skud);
1852 } else if (machine_is_msm8625q_skue()) {
1853 /* enable the skue flashlight by gpio leds driver */
1854 platform_device_register(&gpio_flash_skue);
1855 }