linux内核串口溢出错误,Gdb串口调试内核出现的各种错误的解决办法(转)

gdb调试内核是在target machine还没有启动起来的时候就开始调试!!!!(即target machine还没有进入系统的时候)

用development machine 调试target machine 。

target machine:龙芯2F

development machine:X86

错误1:

(gdb) set remotebaud 9600

(gdb) target remote /dev/ttyS0

Remote debugging using /dev/ttyS0

Ignoring packet error, continuing...

Ignoring packet error, continuing...

Ignoring packet error, continuing...

Malformed response to offset query, timeout

这种错误,是因为串口已经被占用,或者是因为你刚结束了一个gdb串口调试,没有重启target machine,却又重新串口gdb调试导致的。这种错误归结一点就是:串口已经被占用。解决办法:重启target machine,重新进行gdb调试,即可解决!

注:如果使用vmware虚拟机调试,且使用有名管道,有可能需要重新创建二个机器(client,server)间使用的管道

错误2:

target machine能insmod模块,也能停下来,但是development machine不能正常返回到gdb调试状态,如下所示:

root@lijun-HP-Compaq-dx2308-Microtower:/home/lijun/kernel_Compile/linux-2.6.35_Loongson/linux-2.6.35_patched# mips-linux-gdb vmlinux

GNU gdb 6.5

Copyright (C) 2006 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.

There is absolutely no warranty for GDB.  Type "show warranty" for details.

This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=mips-linux"...

(gdb) set remotebaud 115200

(gdb) target remote /dev/ttyS0

Remote debugging using /dev/ttyS0

0xffffffff80231aac in breakinst () at arch/mips/kernel/kgdb.c:55

55        __asm__ __volatile__(

warning: shared library handler failed to enable breakpoint

(gdb) c

Continuing.

^Z

[4]+  已停止               mips-linux-gdb vmlinux

一直在上面红色字体处没反应了,用stty测试串口时发现,development machine在接收数据的时候,target machine发好几条数据,development machine才能收到一条(但是这边往那边发数据正常),最后发现,这种错误的原因是因为数据的丢失。把原来传输的波特率调低一点,就可以解决这种错误了(我原来设的波特率是115200,改成9600就解决问题了)。

正确执行的结果如下:

root@lijun-HP-Compaq-dx2308-Microtower:/home/lijun/kernel_Compile/linux-2.6.35_Loongson/linux-2.6.35_patched# mips-linux-gdb vmlinux

GNU gdb 6.5

Copyright (C) 2006 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.

There is absolutely no warranty for GDB.  Type "show warranty" for details.

This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=mips-linux"...

(gdb) set remotebaud 9600

(gdb) target remote /dev/ttyS0

Remote debugging using /dev/ttyS0

0xffffffff80231aac in breakinst () at arch/mips/kernel/kgdb.c:55

55        __asm__ __volatile__(

warning: shared library handler failed to enable breakpoint

(gdb) b kernel/module.c:2118

Breakpoint 1 at 0xffffffff80284e04: file kernel/module.c, line 2118.

(gdb) b kernel/module.c:2173

Breakpoint 2 at 0xffffffff802845b4: file kernel/module.c, line 2173.

(gdb) b kernel/module.c:2195

Breakpoint 3 at 0xffffffff80284670: file kernel/module.c, line 2195.

(gdb) c

Continuing.

[New thread 1782]

[Switching to thread 1782]

Breakpoint 2, load_module (umod=, len=33532, uargs=0x414008 "")

at kernel/module.c:2173

2173        for (i = 1; i < hdr->e_shnum; i++) {

(gdb)

然后就可一随意调试了!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值