关于gdbserver调试的问题

jlj1986 2010-03-11 11:30:01
主机与arm开发板通过串口,还有交叉网线相连

主机系统为windows xp,用虚拟机安装了红帽linux9.0,开发板为优龙公司出的YL9200V2.0

用linux下的minicom实现主机与开发板的通讯

现在实现了通过nfs方式将主机上的/home挂载到开发板上的/tmp目录下

/home中有gdbserver,hello,hello.c三个文件,hello为主机中用命令:arm-linux-gcc -o hello hello.c生成的

在开发板上输入命令:./gdbserver 192.168.0.7:2345 hello

出现以下信息:

Process hello created: pid = 825
Cannot exec hello: Permission denied.

Child exited with retcode = 7f
Lisitening on port 2345

然后在主机上输入命令:arm-linux-gdb hello
出现信息如下:
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=i686-pc-linux-gnu --target=arm-linux"...hello: 没有那个文件或目录.

(gdb)

然后输入:target remote 192.168.0.100:2345

出现提示如下:
Remote debugging using 192.168.0.100:2345
Remote communication error: Connection reset by peer.

在开发板上出现信息提示如下:
Remote debugging from host 192.168.0.7

Child exited with status 127
GDBserver exiting

这应该是没有成功吧?怎么回事呢?

注:192.168.0.7是主机IP,192.168.0.100是开发板IP






...全文
1254 19 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
jlj1986 2011-01-15
  • 打赏
  • 举报
回复
[Quote=引用 18 楼 nemonic27 的回复:]

这问题解决了么,我同样遇到这个问题,困扰几天了没解决。
[/Quote]
后来都没弄了,还是没解决,不好意思啊~
nemonic27 2011-01-11
  • 打赏
  • 举报
回复
这问题解决了么,我同样遇到这个问题,困扰几天了没解决。
jlj1986 2010-03-15
  • 打赏
  • 举报
回复
有没有官方版的gdb手册呢?
大头贼 2010-03-13
  • 打赏
  • 举报
回复
看gdb的手册吧,最完整最权威
jlj1986 2010-03-13
  • 打赏
  • 举报
回复
有没有关于远程gdb的命令的资料啊
tianqingwang 2010-03-12
  • 打赏
  • 举报
回复
你的执行流程除了最后一步外,其他的都没有错。
最后一步应该在主机上输入:
(gdb)c
jlj1986 2010-03-12
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 wenxy1 的回复:]
Permission denied.
权限问题,要么没用root login, 要么没有 chmod 777 your_file.
[/Quote]

说实话,这两个我还都做到了
jlj1986 2010-03-12
  • 打赏
  • 举报
回复
再问个问题,那个命令:dir ./ 是在主机命令终端输入的吗?
使用了命令:arm-linux-gcc -g -o hello hello.c后,在gdb调试环境中输入:l,可以打印代码了,但是输入:c,出现信息提示:
The program is not being run.
输入:r,出现信息提示:
Starting program /home/killme
Don't know how to run. Try "help target".

这是怎么回事呢?
Wenxy1 2010-03-12
  • 打赏
  • 举报
回复
Permission denied.
权限问题,要么没用root login, 要么没有 chmod 777 your_file.
jlj1986 2010-03-12
  • 打赏
  • 举报
回复
ls说的我试试先,谢谢啊
louyong0571 2010-03-12
  • 打赏
  • 举报
回复
对程序的调试是在主机的命令终端,你list的时候没有代码显示应该是因为你没有指定代码所在的目录
比如你代码在当前目录就
dir ./
这样就可以指定了,不过你在编译的时候没有指定-g选项,是没有调试信息的。
arm-linux-gcc -o hello hello.c
arm-linux-gcc -g -o hello hello.c
谭海燕 2010-03-12
  • 打赏
  • 举报
回复
上边不是给你推荐过的一个地址了吗。
jlj1986 2010-03-12
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 feiyinzilgd 的回复:]

LZ你需要看看远程gdb的命令。它更通常gdb调试差别很大。
[/Quote]

能推荐个好的资料吗?我手上关于gdbserver调试的资料很少
谭海燕 2010-03-12
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 jlj1986 的回复:]

(gdb)c

输入:c,出现信息提示:
The program is not being run.
这应该是有问题的吧?
[/Quote]

LZ你需要看看远程gdb的命令。它更通常gdb调试差别很大。




jlj1986 2010-03-12
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 tianqingwang 的回复:]
你的执行流程除了最后一步外,其他的都没有错。
最后一步应该在主机上输入:
(gdb)c
[/Quote]
输入:c,出现信息提示:
The program is not being run.
这应该是有问题的吧?
jlj1986 2010-03-11
  • 打赏
  • 举报
回复
我重新来了一遍,刚才的问题没了,但是又出现新的问题:

通过nfs方式将主机上的/home挂载到开发板上的/tmp目录下,/home中有gdbserver,hello,hello.c三个文件,hello为主机中用命令:arm-linux-gcc -o hello hello.c生成的


在开发板(minicom)上输入命令:
#cd /tmp
#./gdbserver 192.168.0.7:2345 hello

出现以下信息:

Process hello created: pid = 829
Lisitening on port 2345

然后在主机上输入命令:
#cd /home
#export PATH=$PATH:/usr/local/arm-gdb/bin
#arm-linux-gdb hello

出现信息如下:
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=i686-pc-linux-gnu --target=arm-linux"...
(gdb)

然后输入:target remote 192.168.0.100:2345

出现提示如下:
Remote debugging using 192.168.0.100:2345
0x40000c90 in ?? ()
(gdb)

在开发板(minicom)上出现信息提示如下:
Remote debugging from host 192.168.0.7

但是开发板(minicom)上没有出现可以输入命令的标志:(gdb)
在主机上的gdb调试环境里输入:list
输出结果:
1 in init.c

但是我的hello源文件内容如下:

#include<stdio.h>
int main()
{
printf("helloWorld!");
return 0;
}

里边没有什么init.c文件啊?怎么回事?

还有,我想问问,对程序的调试到底是在主机的命令终端,还是在minicom里边呢?
这是为什么呢???

注:192.168.0.7是主机IP,192.168.0.100是开发板IP
jlj1986 2010-03-11
  • 打赏
  • 举报
回复
在主机上输入命令:arm-linux-gdb hello 之前:
要先输入:
#cd /home
#export PATH=$PATH:/usr/local/arm-gdb/bin
#arm-linux-gdb hello
guan323333 2010-03-11
  • 打赏
  • 举报
回复
难道开发板上也有权限限制吗?
谭海燕 2010-03-11
  • 打赏
  • 举报
回复
http://blog.csdn.net/feiyinziiuxx/archive/2009/08/25/4483684.aspx

请参考

4,465

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧