大发快3

嵌入式Linux热门培训内容之Linux内核使用gdb调试

时间:2018-12-13 17:37:23

我们在编写linux内核代码的时候,难免会遇到oops的问题,类似空指针crash,在crash的时候,会打印一些当时的栈信息,我们可以通过这些信息结合vmlinux来调试具体在哪个函数上出现了问题。Vmlinux是一个内核符号表,编译进内核的函数列表之类的都可以从里面提取出来。

在内核的.config里面要打开 DEBUG_INFO和DEBUG_VM

weiqifa@weiqifa-Inspiron-3847:~/weiqifa/tm100$ ./prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin/arm-eabi-gdb ./out/target/product/tm100/obj/KERNEL_OBJ/vmlinux

GNU gdb (GDB) 7.3.1-gg2

Copyright (C) 2011 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"

and "show warranty" for details.

This GDB was configured as "--host=x86_64-linux-gnu --target=arm-linux-android".

For bug reporting instructions, please see:

<http://source.android.com/source/report-bugs.html>...

Reading symbols from /home/weiqifa/weiqifa/tm100/out/target/product/tm100/obj/KERNEL_OBJ/vmlinux...done.

(gdb) 

定位故障代码

(gdb) l * qrd7627a_add_io_devices+0x100

0xc07cd05c is in qrd7627a_add_io_devices (/home/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);

?

免责声明: 本站资料及图片来源互联网文章,本网不承担任何由内容信息所引起的争议和法律责任。所有作品版权归原创作者所有,与本站立场无关,如用户分享不慎侵犯了您的权益,请联系我们告知,我们将做删除处理!