Linux debugging Kernel code is very cumbersome. They generally add printk, or use JTAG debugging.
The method here is to use QEMU in order to debug the Linux kernel.
Since QEMU implements GDB server itself, it can easily be used by GDB to tune the kernel.
is also very helpful.
To minimize the time spent on QEMU settings, use the following kernel image directly:
http://free-electrons.com/community/demos/qemu-arm-directfb/
1. installation of QEMU
This will be able to go to Qemu's official website to download the compilation, assuming that the distribution you have on hand with the corresponding QEMU package, it can also be installed directly.
CentOS Word reference in front of CentOS rpm additional package source
2. Download the appropriate kernel image
Download from: http://free-electrons.com/pub/qemu/demos/arm/directfb/1.0/There's a vmlinuz-qemu-arm-2.6.20 in there.
3. start Qemu
Start with the following command, for example:
$ qemu-system-arm-m versatilepb-m 16-kernel vmlinuz-qemu-arm-2.6.20-append "Clocksource=pit quiet rw"-s-s
4. Debugging the kernel
There is a need for a vmlinux file that includes debugging information. Ability to compile http://free-electrons.com/pub/qemu/demos/arm/directfb/1.0/src/linux-2.6.20.tar.7z directly
If you don't want to compile, you can use a compiled Vmlinux file: http://pan.baidu.com/s/1sjuJYc1
Then run the following command, for example:
$ arm-none-linux-gnueabi-gdb Vmlinux
In GDB, in console input:
(GDB) Target remote:1234
(GDB) B start_kernel
(GDB) C
This time, the program runs it will fall on the Start_kernel office where you set breakpoints. Ok. So, you can debug kernel arbitrary code!
Using the big kill recruit Qemu to debug Linux kernel code