Linux内核驱动开发之KGDB单步调试内核(kgdboc方式)

Linux内核驱动开发之KGDB原理介绍及kgdboe方式配置》。

/**********************************************************************************************************************************/

/**********************************************************************************************************************************/

关键步骤:

一、配置Linux内核,,使其支持KGDB。

依次进行如下配置:

Kernel hacking—>-*- Magic SysRq key[*] Kernel debugging[*] Compile the kernel with debug info[*] KGDB: kernel debugging with remote gdb —><*> KGDB: use kgdb over the serial console

并生成

二、修改u-boot的启动参数bootargs以支持kgdb调试:

setenv bootargs ‘console=ttyS0,115200n8kgdboc=ttyS0,115200 kgdbwait …… nfsroot=……’

主要增加以上红色字体部分,指定kgdb使用开发板上的哪个串口,注意这里是串口名而不是设备文件/dev/ttyS0。

OMAP3_EVM # tftpsmc911x: detected LAN9220 controllersmc911x: phy initialized #by guoqingbosmc911x: MAC 02:01:05:96:02:01Using smsc911x-0 deviceTFTP from server 192.168.1.93; our IP address is 192.168.1.94Filename ‘uImage’.Load address: 0x82000000Loading: #################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################doneBytes transferred = 2459200 (258640 hex)

Serial: 8250/16550 driver, 4 ports, IRQ sharing enabledserial8250.0: ttyS0 at MMIO 0x4806a000 (irq = 72) is a ST16654console [ttyS0] enabled #by guoingboserial8250.1: ttyS1 at MMIO 0x4806c000 (irq = 73) is a ST16654serial8250.2: ttyS2 at MMIO 0x49020000 (irq = 74) is a ST16654kgdb: Registered I/O driver kgdboc.kgdb: Waiting for connection from remote gdb…截图来说明一下:

五、使用gdb调试vmlinux文件。使用前述博文《在ubuntu10.04成功移植gdbserver及gdbserver使用介绍(用于CCSV5.2远程调试ARM CORTEX-A8程序)

set remotebaud 115200target remote /dev/ttyS1 然后同样在Linux内核源码目录下运行如下命令:

arm-none-linux-gnueabi-gdb ./vmlinux

Reading symbols from /home/ss/develop_environment/v2/sys/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/psp/linux-2.6.32-psp03.00.01.06.sdk/vmlinux…done.During symbol reading, DW_AT_name missing from DW_TAG_base_type.During symbol reading, unsupported tag: ‘DW_TAG_const_type’.During symbol reading, Child DIE 0x408b33 and its abstract origin 0x4085ee have different parents.During symbol reading, DW_AT_type missing from DW_TAG_subrange_type.kgdb_breakpoint () at kernel/kgdb.c:17441744arch_kgdb_breakpoint();(gdb)

截图:

DDD调试内核的界面

在时光的激流中,我们总会长大。

Linux内核驱动开发之KGDB单步调试内核(kgdboc方式)

相关文章:

你感兴趣的文章:

标签云: