免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 7144 | 回复: 3
打印 上一主题 下一主题

[开发环境] 6410上跑linux2.6.36.用gdb7.2调试的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-03-22 09:45 |只看该作者 |倒序浏览
目的:

使用GDB调试。有以下几种需求:

A gdb+gdb server调试应用程序。

B gdb+gdb stub通过uboot调试内核。

C kdb调试内核。

问题:

B和C暂时不考虑,使用从http://www.gnu.org/software/gdb/下载gdb-7.tat.gz,调试无法进行,总是发现报如下错误:

Remote 'g' packet reply is too long:

00000000e43ebebe0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ebebe000000006081000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

而且arm-linux-gdb启动的时候总是报如下的警告错误:

warning: Can not parse XML target description; XML support was disabled at compile time

0x00008160 in ?? ()



问题原因的初步分析:

    Gdb不支持arnv6的architechture。而s3c6410为ARM1176JZF-S是基于armv6的。


证据是在GDB命令行中输入show architechture没有armv6:

(gdb) set architecture armv6

Undefined item: "armv6".

(gdb) set architecture armv5

The target architecture is assumed to be armv5

(gdb) set architecture

Requires an argument. Valid arguments are arm, armv2, armv2a, armv3, armv3m, armv4, armv4t, armv5, armv5t, armv5te, xscale, ep9312, iwmmxt, iwmmxt2, auto.

(可是armv6在2001年就出来了,GDB不支持说不过去)



    另外可能的原因是,PC是64位的,开发板是32位的。联调时会不会有问题?
  具体原因请高手请教......
问题引入的详细记录:

PC环境:虚拟机+ubuntu9.10(信息如下)

*@ubuntu: $ cat /proc/cpuinfo      (flag字段有lm(long mode)说明CPU的数据总线是64位)

processor       : 0

vendor_id       : AuthenticAMD

cpu family      : 15

model           : 107

model name      : AMD Athlon(tm) 64 X2 Dual Core Processor 5200+

stepping        : 2

cpu MHz         : 2705.760

cache size      : 512 KB

fdiv_bug        : no

hlt_bug         : no

f00f_bug        : no

coma_bug        : no

fpu             : yes

fpu_exception   : yes

cpuid level     : 1

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow constant_tsc up tsc_reliable pni cx16 hypervisor lahf_lm extapic 3dnowprefetch

bogomips        : 5411.52

clflush size    : 64

power management: ts fid vid ttp tm stc 100mhzsteps



*@ubuntu: $ cat /etc/lsb-release

DISTRIB_ID=Ubuntu

DISTRIB_RELEASE=9.10

DISTRIB_CODENAME=karmic

DISTRIB_DESCRIPTION="Ubuntu 9.10"



*@ubuntu: $  uname -a

Linux ubuntu 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 i686 GNU/Linux



安装步骤:

*@ubuntu: $tar –xzvf gdb-7.2.tar.gz

*@ubuntu: $cd gdb-7.2

*@ubuntu: $sudu mkdir –p /opt/gdb

//编译PC上运行的arm-linux-gdb

*@ubuntu: $./configure –target=arm-linux –prefix=/opt/gdb

*@ubuntu: $make

*@ubuntu: $make install

*@ubuntu: $export PATH=$PATH:/opt/gdb/bin

//编译板子上运行的gdbserver,注意gdb-7.2目录下有gdb/gdbserver子目录

*@ubuntu: $ cd gdb/gdbserver/

*@ubuntu: $./configure –target=arm-linux –host=arm-linux

*@ubuntu: $make

*@ubuntu: $cp gdbserver */nfs-root



通过nfs在板子上进行如下操作:

[root@FriendlyARM /home]# ./gdbserver 172.16.46.3:3 /mnt/app_work/sample/fruit/app/helloWorld.elf

Process /mnt/app_work/sample/fruit/app/helloWorld.elf created; pid = 950

Listening on port 3

在主机端运行如下操作:

*@ubuntu: $ arm-linux-gdb /home/wangfeifeiwc/project/work/app_work/sample/fruit/app/helloWorld.elf

GNU gdb (GDB) 7.2

Copyright (C) 2010 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"

and "show warranty" for details.

This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-linux".

For bug reporting instructions, please see:

<http://www.gnu.org/software/gdb/bugs/>...

Reading symbols from /home/wangfeifeiwc/project/work/app_work/sample/fruit/app/helloWorld.elf...done.

(gdb) target remote 172.16.46.5:666

Remote debugging using 172.16.46.5:666

warning: Can not parse XML target description; XML support was disabled at compile time

0x00008160 in _start ()

(gdb) list

Remote 'g' packet reply is too long: 00000000e40e95be0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e95be000000006081000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

(gdb)

论坛徽章:
5
摩羯座
日期:2014-07-22 09:03:552015元宵节徽章
日期:2015-03-06 15:50:392015亚冠之大阪钢巴
日期:2015-06-12 16:01:352015年中国系统架构师大会
日期:2015-06-29 16:11:2815-16赛季CBA联赛之四川
日期:2018-12-17 14:10:21
2 [报告]
发表于 2011-03-22 17:58 |只看该作者
感觉gdbserver+gdb不是很方便,有那条件还不如直接移植个gdb了
然后nfs+gdb+coredump,多方便

论坛徽章:
0
3 [报告]
发表于 2011-03-23 14:37 |只看该作者
回复 2# T-Bagwell


    呵呵,调应用程序是可以这样,但是调内核呢?哎,纯属瞎折腾....

论坛徽章:
3
2015年迎新春徽章
日期:2015-03-04 09:48:31平安夜徽章
日期:2015-12-26 00:06:30C
日期:2016-10-25 16:26:25
4 [报告]
发表于 2011-06-24 10:26 |只看该作者
我也遇到这样的问题,求解啊!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP