当前位置: 技术问答>linux和unix
GDB调试linux内核出现问题
来源: 互联网 发布时间:2016-08-05
本文导语: 刚开始学习使用GDB调试工具,按照书上的方法调试内核,在U-Boot上设置命令行参数、启动内核。 u-boot> set bootargs noinitrd root=/dev/mtdblock 2 console=kgdb kgdbwait u-boot> tftp 0x30000000 uImage.img (下载完毕) u-boot> boot...
刚开始学习使用GDB调试工具,按照书上的方法调试内核,在U-Boot上设置命令行参数、启动内核。
u-boot> set bootargs noinitrd root=/dev/mtdblock 2 console=kgdb kgdbwait
u-boot> tftp 0x30000000 uImage.img (下载完毕)
u-boot> bootm 0x30000000
启动信息如下:
Starting Kernel ...
Uncompressing
Linux....................................................................
..................................done,booting the kernel.
然后在主机上进入内核目录,启动arm-linux-gdb,
[root@friendlyarm linux-2.6.22.6]# sudo arm-linux-gdb ./vmlinux
GNU gdb 5.2.1
Copyright 2002 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=i686-pc-linux-gnu --target=arm-linux"...
(gdb) set remotebaud 115200
(gdb) target remote /dev/ttyS0
Remote debugging using /dev/ttyS0
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Couldn't establish connection to remote target
Malformed response to offset query, timeout
(gdb) q
卡在这儿了,连不上目标板,不知道什么原因,前面的设置也是按资料来的,应该没问题,内核没问题,在板子上可用,请各位高手指点下,谢谢啦^-^
才开始接触这块,也不知道从哪下手自己去找原因,只能向各位求救了,还望高手们说的详细点,感谢~~
u-boot> set bootargs noinitrd root=/dev/mtdblock 2 console=kgdb kgdbwait
u-boot> tftp 0x30000000 uImage.img (下载完毕)
u-boot> bootm 0x30000000
启动信息如下:
Starting Kernel ...
Uncompressing
Linux....................................................................
..................................done,booting the kernel.
然后在主机上进入内核目录,启动arm-linux-gdb,
[root@friendlyarm linux-2.6.22.6]# sudo arm-linux-gdb ./vmlinux
GNU gdb 5.2.1
Copyright 2002 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=i686-pc-linux-gnu --target=arm-linux"...
(gdb) set remotebaud 115200
(gdb) target remote /dev/ttyS0
Remote debugging using /dev/ttyS0
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Couldn't establish connection to remote target
Malformed response to offset query, timeout
(gdb) q
卡在这儿了,连不上目标板,不知道什么原因,前面的设置也是按资料来的,应该没问题,内核没问题,在板子上可用,请各位高手指点下,谢谢啦^-^
才开始接触这块,也不知道从哪下手自己去找原因,只能向各位求救了,还望高手们说的详细点,感谢~~
|
Couldn't establish connection to remote target
你是用远程调试吧,检查网线有没有连接好。
你是用远程调试吧,检查网线有没有连接好。
|
检查下PC的网关呢?