QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7613|回复: 16

skyeye使用gdb

[复制链接]
发表于 2007-11-13 21:17:31 | 显示全部楼层 |阅读模式
我下载了最新版本的skyeye_1_2_3_Rel,编译正常,运行也基本正常。
想用gdb进行调试,但始终没有成功,以前有看一些资料,有些说,启动skyeye后,会有(skyeye)提示符,然后就可以用gdb进行调试。
我下的这么版本,应该启动直接进行模拟运行的,我也看了一下源代码。
在加上-d参数时,好象是打开本地的12345端口,
然后我再开一个终端,target remote localhost:12345
去连接,感觉好象连上了,可用run,等gdb的指令都出错,
不知道怎么会事,不知道有没有介绍的资料,那位大哥能分享一下。
另外还有一个问题,gdb是应该arm-elf-gdb吗,还是就用本地的那一个。
见笑!
发表于 2007-11-13 22:51:23 | 显示全部楼层
Should be arm-elf-gdb for arm linux kernel. What is your error message? As far as I know, break and stepi, info register etc. gdb command is supported now.
回复

使用道具 举报

 楼主| 发表于 2007-11-14 11:09:28 | 显示全部楼层
非常感谢ksh的回答,我再去试试,并把错误信息记下来!
回复

使用道具 举报

 楼主| 发表于 2007-11-18 00:01:25 | 显示全部楼层
我的调试过程如下,请高手看看,是出了什么问题。

首先在一个终端中编译好uclinux,然后启动skyeye。

root@frank-desktop:/home/frank/Work/uclinux-s3cev40/linux-2.4.x# skyeye -d -e linux
big_endian is false.
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name s3c44b0x, mach_init addr 0x8058570
uart_mod:0, desc_in:, desc_out:, converter:
lcd_mod:1
SKYEYE: use arm7100 mmu ops
exec file "linux"'s format is elf32-little.
load section .init: addr = 0x0c008000  size = 0x0000a000.
load section .text: addr = 0x0c012000  size = 0x000e0298.
load section .data: addr = 0x0c0f4000  size = 0x00009ec4.
not load section .bss: addr = 0x0c0fdee0  size = 0x00027f34 .
not load section .debug_abbrev: addr = 0x00000000  size = 0x00000063 .
not load section .debug_info: addr = 0x00000000  size = 0x0000034b .
not load section .debug_line: addr = 0x00000000  size = 0x00000000 .
not load section .debug_pubnames: addr = 0x00000000  size = 0x00000060 .
not load section .debug_aranges: addr = 0x00000000  size = 0x00000060 .
start addr is set to 0x0c008000 by exec file.
debugmode= 1, filename = skyeye.conf, server TCP port is 12345                           ;;;;;等在这儿,看起来正常
Remote debugging using host:12345                                                                              ;;;;;开始联接,好象linux开始运行了
Linux version 2.4.17-uc1 (root@frank-desktop) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #184 2007年 11月 17日 星期六 23:26:47 CST
Processor: Samsung S3C44B0 revision 1
Architecture: S3CEV40
Warning: bad configuration page, trying to continue
On node 0 totalpages: 4096
zone(0): 0 pages.
zone(1): 4096 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/rom0                       ;;死在这里不动了,这个code,我用bin的方式,下载到arm 板上是可以运行的,
                                                                                                   用bin的方式在skyeye上也是可以运行的。
putpkt(read): Got EOF
readchar: Got EOF
Remote side has terminated connection.  GDBserver will reopen the connection.




然后在另外一个终端中作如下操作:

root@frank-desktop:/home/frank/Work/uclinux-s3cev40/linux-2.4.x# arm-elf-gdb linux
GNU gdb 5.0
Copyright 2000 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-elf"...
(gdb) target remote 127.0.0.1:12345
Remote debugging using 127.0.0.1:12345
0xc008000 in stext ()
(gdb) c
Continuing.
Can't send signals to this remote system.  SIGHUP not sent.

就停在这儿不动了。

再附上我的skyeye.conf文件。

cpu: arm7tdmi



#--------------------------------------------------------------------------------

mach: s3c44b0x



#-------------------------------------------------------------------------------

#mem_num: 4

mem_bank: map=M, type=RW, addr=0x0c800000, size=0x03000000
mem_bank: map=M, type=RW, addr=0x0c400000, size=0x00400000, file=./romfs.img

mem_bank: map=M, type=RW, addr=0x0c000000, size=0x00400000

mem_bank: map=I, type=RW, addr=0x0a000000, size=0x02000000

mem_bank: map=M, type=RW, addr=0x02000000, size=0x08000000

mem_bank: map=I, type=RW, addr=0x01c00000, size=0x00400000
mem_bank: map=M, type=RW, addr=0x000c0000, size=0x01B40000

mem_bank: map=M, type=RW, addr=0x00000000, size=0x000c0000



#-------------------------------------------------------------------------------

uart: mod=stdio



#-------------------------------------------------------------------------------

lcd: type=s3c44b0x, mod=gtk



#-------------------------------------------------------------------------------

#log: logon=1, logfile=./sk1.log, start=100000, end=200000
回复

使用道具 举报

发表于 2007-11-18 10:52:08 | 显示全部楼层
Probably the following post can give you some hints...
http://lists.gro.clinux.org/pipe ... ovember/001628.html
回复

使用道具 举报

 楼主| 发表于 2007-11-18 23:03:46 | 显示全部楼层
thanks,不过看的不太明白啊,是说要重新编译gdb-linux吗?
回复

使用道具 举报

 楼主| 发表于 2007-11-20 18:49:55 | 显示全部楼层
skyeye挂个gdb怎么这么麻烦,搞不懂!
回复

使用道具 举报

发表于 2007-11-21 10:25:08 | 显示全部楼层
PLEASE:  What do you want to do?   There is no error for the whole procedure from your output.  You just type "c" and let uclinux run. So what result  do you want to see if you do not set a breakpoint?
回复

使用道具 举报

 楼主| 发表于 2007-11-21 16:54:46 | 显示全部楼层
I am so sorry.

我有尝试设置断点的,如下:

(gdb) target remote 127.0.0.1:12345
Remote debugging using 127.0.0.1:12345
0x0c008000 in stext ()
(gdb) b start_kernel                                   //我在函数start_kernel里下了个断点
Breakpoint 1 at 0xc0087b0
(gdb) c                                                     //continue
Continuing.
Can't send signals to this remote system.  SIGHUP not sent.                 
                                                             //为什么老是有这消息出现呢,

Program received signal SIGHUP, Hangup.
0x0c0087b0 in start_kernel ()                     //感觉好象是正常的断下来了,
(gdb) l                                           //可用查看代码确看不到东西,出如下内容
1       ../../gcc-2.95.3/gcc/libgcc2.c: No such file or directory.
        in ../../gcc-2.95.3/gcc/libgcc2.c
(gdb) next                                     //用next也不行,感觉下面的应该是出错的消息吧!
Single stepping until exit from function start_kernel,
which has no line number information.
Can't send signals to this remote system.  SIGHUP not sent.

Program received signal SIGHUP, Hangup.
0x0c0087b4 in start_kernel ()


什么感激你的回答,搞了好几天了,老不行,希望能多多指教。
回复

使用道具 举报

 楼主| 发表于 2007-11-21 17:37:27 | 显示全部楼层
ksh 我想会不会是我在编译uclinux时,参数没有带对呢,如-g,
不知道你能不能告诉怎么检查,除了-g,还有没有什么参数是必须加的呢?
回复

使用道具 举报

 楼主| 发表于 2007-11-21 21:50:56 | 显示全部楼层
我在把linux下的makefile里的debug打开,重新编译。应该是成功的,编译出来linux有15M的样子,看来编译debug应该是打开了,
skyeye这边看起来,没有什么异常。
root@frank-desktop:/home/frank/Work/uclinux-s3cev40/linux-2.4.x# skyeye -d -e linux
big_endian is false.
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name s3c44b0x, mach_init addr 0x8058570
uart_mod:0, desc_in:, desc_out:, converter:
lcd_mod:1
SKYEYE: use arm7100 mmu ops
Loaded RAM   ./romfs.img
Loaded RAM   ./romfs.img
exec file "linux"'s format is elf32-little.
load section .init: addr = 0x0c008000  size = 0x0000a000.
load section .text: addr = 0x0c012000  size = 0x000e0d38.
load section .data: addr = 0x0c0f4000  size = 0x00009ec4.
not load section .bss: addr = 0x0c0fdee0  size = 0x00027f34 .
not load section .debug_abbrev: addr = 0x00000000  size = 0x0001d079 .
not load section .debug_info: addr = 0x00000000  size = 0x00c15676 .
not load section .debug_line: addr = 0x00000000  size = 0x001aba08 .
not load section .debug_pubnames: addr = 0x00000000  size = 0x00006b7e .
not load section .debug_aranges: addr = 0x00000000  size = 0x00001128 .
start addr is set to 0x0c008000 by exec file.
debugmode= 1, filename = skyeye.conf, server TCP port is 12345
Remote debugging using host:12345


可在gdb这里,还 是不怎么对:
root@frank-desktop:/home/frank/Work/uclinux-s3cev40/linux-2.4.x# arm-elf-gdb linux
GNU gdb 5.0
Copyright 2000 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-elf"...
(gdb) target remote 127.0.0.1:12345
Remote debugging using 127.0.0.1:12345
0xc008000 in stext () at af_packet.c:1891     //看起来好象对,但起始并不应该是在af_packet.c里啊
1891    }
(gdb) b start_kernel                                          //这里看起来也不对啊
Breakpoint 1 at 0x34: file af_packet.c, line 1891.
(gdb) b
Breakpoint 2 at 0xc008000: file af_packet.c, line 1891.
(gdb) c
Continuing.
Can't send signals to this remote system.  SIGHUP not sent.

Program received signal SIGHUP, Hangup.
0xc008004 in stext () at af_packet.c:1891
1891    }
(gdb)
回复

使用道具 举报

发表于 2007-11-22 19:26:34 | 显示全部楼层
你用 skyeye testsuite 2.3 中 s3c44b0x 的 boot.bin 放到 0x00000000 处就可以调试了。
原因:因为中断跳转到未知位置而致使 Linux Kernel 的 timer 等 IRQ 不能正常运作。


另外载入符号:
(gdb) symbol-file ./linux
回复

使用道具 举报

 楼主| 发表于 2007-11-22 21:18:05 | 显示全部楼层
ths,感觉已经可以正常运行,但是感觉不怎么稳定,特别是next,多跑几次就挂掉,在cygwin情况下,还可能造成gdb出错,挂掉。
希望skyeye能着手在解决这些问题上,增加cpu,不能稳定运行,又有什么用呢!
回复

使用道具 举报

发表于 2007-11-23 15:25:39 | 显示全部楼层
Thanks your suggestion
回复

使用道具 举报

 楼主| 发表于 2007-11-23 18:51:52 | 显示全部楼层
我分析了一下,skyeye的gdb server。
发现和我用的arm-elf-gdb的通信协议,应该还是有些差别的。
getpkt ("Z0,c0087d8,4");  [sending ack]
[sent ack]
command: Z
SKYEYE:gdbserver Z, type 0, addr c0087d8, len 4
putpkt ("$OK#9a"); [looking for ack]       //下断点后,skyeye回OK,而elf-gdb又重新传了一次
[received '$' (0x24)]
putpkt ("$OK#9a"); [looking for ack]
[received 'Z' (0x5a)]
putpkt ("$OK#9a"); [looking for ack]
[received '0' (0x30)]
putpkt ("$OK#9a"); [looking for ack]
[received ',' (0x2c)]
putpkt ("$OK#9a"); [looking for ack]
[received 'c' (0x63)]
putpkt ("$OK#9a"); [looking for ack]
[received '0' (0x30)]
putpkt ("$OK#9a"); [looking for ack]
[received '0' (0x30)]
putpkt ("$OK#9a"); [looking for ack]
[received '8' (0x3]
putpkt ("$OK#9a"); [looking for ack]
[received '7' (0x37)]
putpkt ("$OK#9a"); [looking for ack]
[received 'd' (0x64)]
putpkt ("$OK#9a"); [looking for ack]
[received '8' (0x3]
putpkt ("$OK#9a"); [looking for ack]
[received ',' (0x2c)]
putpkt ("$OK#9a"); [looking for ack]
[received '4' (0x34)]
putpkt ("$OK#9a"); [looking for ack]
[received '#' (0x23)]
putpkt ("$OK#9a"); [looking for ack]
[received 'e' (0x65)]
putpkt ("$OK#9a"); [looking for ack]
[received '4' (0x34)]
putpkt ("$OK#9a"); [looking for ack]
[received '$' (0x24)]
putpkt ("$OK#9a"); [looking for ack]
[received 'Z' (0x5a)]
putpkt ("$OK#9a"); [looking for ack]
[received '0' (0x30)]
putpkt ("$OK#9a"); [looking for ack]
[received ',' (0x2c)]
putpkt ("$OK#9a"); [looking for ack]
[received 'c' (0x63)]
putpkt ("$OK#9a"); [looking for ack]
[received '0' (0x30)]
putpkt ("$OK#9a"); [looking for ack]
[received '0' (0x30)]
putpkt ("$OK#9a"); [looking for ack]
[received '8' (0x3]
putpkt ("$OK#9a"); [looking for ack]
[received '7' (0x37)]
putpkt ("$OK#9a"); [looking for ack]
[received 'd' (0x64)]
putpkt ("$OK#9a"); [looking for ack]
[received '8' (0x3]
putpkt ("$OK#9a"); [looking for ack]
[received ',' (0x2c)]
putpkt ("$OK#9a"); [looking for ack]
[received '4' (0x34)]
putpkt ("$OK#9a"); [looking for ack]
[received '#' (0x23)]
putpkt ("$OK#9a"); [looking for ack]
[received 'e' (0x65)]
putpkt ("$OK#9a"); [looking for ack]
[received '4' (0x34)]
putpkt ("$OK#9a"); [looking for ack]
[received '$' (0x24)]
putpkt ("$OK#9a"); [looking for ack]
[received 'Z' (0x5a)]
putpkt ("$OK#9a"); [looking for ack]
[received '0' (0x30)]
putpkt ("$OK#9a"); [looking for ack]
[received ',' (0x2c)]
putpkt ("$OK#9a"); [looking for ack]
[received 'c' (0x63)]
putpkt ("$OK#9a"); [looking for ack]
[received '0' (0x30)]
putpkt ("$OK#9a"); [looking for ack]
[received '0' (0x30)]
putpkt ("$OK#9a"); [looking for ack]
[received '8' (0x3]
putpkt ("$OK#9a"); [looking for ack]
[received '7' (0x37)]
putpkt ("$OK#9a"); [looking for ack]
[received 'd' (0x64)]
putpkt ("$OK#9a"); [looking for ack]
[received '8' (0x3]
putpkt ("$OK#9a"); [looking for ack]
[received ',' (0x2c)]
putpkt ("$OK#9a"); [looking for ack]
[received '4' (0x34)]
putpkt ("$OK#9a"); [looking for ack]
[received '#' (0x23)]
putpkt ("$OK#9a"); [looking for ack]
[received 'e' (0x65)]
putpkt ("$OK#9a"); [looking for ack]
[received '4' (0x34)]
putpkt ("$OK#9a"); [looking for ack]
[received '+' (0x2b)]
getpkt ("vCont?");  [sending ack]
[sent ack]
command: v
putpkt ("$#00"); [looking for ack]
[received '+' (0x2b)]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-23 02:55 , Processed in 0.095501 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表