aoyun2008 发表于 2011-3-18 17:09

gdb+gdbserver求指教

介绍一下我开发中遇到的问题:
arm-uclibc-linux-gcc 编译器
主机    IP : 192.168.1.224
目标机 IP : 192.168.1.223
通过nfs把host下的temp目录mount到target目标板子上mount下,可执行文件hello放在主机目录temp下.
->在目标机上使用gdbserver 192.168.1.224:2345 /mount/hello
提示:
Process test created; pid = 476
Listening on port 2345
->在主机上使用arm-uclibc-linux-gdb /temp/hello
GNU gdb 6.3.50.20050627-cvsCopyright 2004 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-uclibc-linux"...
(gdb) target remote 192.168.1.223:2345
Remote debugging using 192.168.1.223:2345

Malformed packet(b) (missing colon): re:0;//数据包畸形
Packet: 'T050b:00000000;0d:509ef9be;0f:c0090040;thread:1dc;core:0;'

在目标机上面提示:
Listening on port 2345
Remote debugging from host 192.168.1.224
readchar: Got EOF
Remote side has terminated connection.GDBserver will reopen the connection.
Listening on port 2345
Remote debugging from host 192.168.1.224
readchar: Got EOF
Remote side has terminated connection.GDBserver will reopen the connection.
Listening on port 2345

求教问题出在哪里,是TCP参数需要重新设置一下吗?

aoyun2008 发表于 2011-3-21 15:20

# gdbserver --debug --remote-debug :3456 /mount/hello
my_waitpid (474, 0x0)
my_waitpid (474, 0x0): status(137f), 474
my_waitpid (474, 0x0)
my_waitpid (474, 0x0): status(1057f), 474
my_waitpid (475, 0x0)
my_waitpid (475, 0x0): status(137f), 475
my_waitpid (475, 0x0)
my_waitpid (475, 0x0): status(9), 475
my_waitpid (474, 0x0)
my_waitpid (474, 0x0): status(117f), 474
my_waitpid (474, 0x0)
my_waitpid (474, 0x0): status(9), 474
new_argv = "/mount/hello"
Process /mount/hello created; pid = 476
sigchld_handler
linux_wait:
linux_wait_for_lwp: <all threads>
my_waitpid (-1, 0x40000000)
my_waitpid (-1, 0x1): status(57f), 476
Got an event from 476 (57f)
stop pc is 400009c0
pc is 0x400009c0
stop pc is 0x400009c0
stop pc is 400009c0
linux_wait_for_lwp: pc is 0x400009c0
Hit a non-gdbserver trap event.
wait_for_sigstop: LWP 476 already stopped
Checking whether LWP 476 needs to move out of the jump pad...no
linux_wait ret = LWP 476.476, 1, 5
Listening on port 3456
handling possible accept event
Remote debugging from host 192.168.1.224
linux_async (0), previous=0
handling possible serial event

getpkt ("Hc-1");

putpkt ("$E01#a6");

handling possible serial event
getpkt ("qC");

putpkt ("$QC1dc#8c");

handling possible serial event
getpkt ("qOffsets");

putpkt ("$#00");

handling possible serial event
getpkt ("?");

wait_for_sigstop: LWP 476 already stopped
Checking whether LWP 476 needs to move out of the jump pad...no
Writing resume reply for LWP 476.476:1

putpkt ("$T050b:0*"00;0d:403ea0be;0f:c0090040;thread:1dc;core:0;#f7");

handling possible serial event
readchar: Got EOF

Remote side has terminated connection.GDBserver will reopen the connection.
Listening on port 3456

aoyun2008 发表于 2011-3-21 15:20

$ arm-uclibc-linux-gdb /home/share/mount/hello
GNU gdb 6.3.50.20050627-cvs
Copyright 2004 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-uclibc-linux"...
(gdb) set debug remote 1
(gdb) set remote X-packet auto
(gdb) set remote P-packet auto
(gdb) set remote Z-packet auto
(gdb) target remote 192.168.1.223:3456
Remote debugging using 192.168.1.223:3456
Sending packet: $Hc-1#09...Ack
Packet received: E01
Sending packet: $qC#b4...Ack
Packet received: QC1dc
Sending packet: $qOffsets#4b...Ack
Packet received:
Sending packet: $?#3f...Ack
Packet received: T050b:00000000;0d:403ea0be;0f:c0090040;thread:1dc;core:0;

Malformed packet(b) (missing colon): re:0;
Packet: 'T050b:00000000;0d:403ea0be;0f:c0090040;thread:1dc;core:0;'

(gdb)

aoyun2008 发表于 2011-3-21 15:23

gdbserver发送数据包
$T050b:0*"00;0d:403ea0be;0f:c0090040;thread:1dc;core:0;#f7
gdb接收数据包
$T050b:00000000;0d:403ea0be;0f:c0090040;thread:1dc;core:0;#f7
由于数据包0b后面的几位出错,导致checksum的时候提示错误的数据包,估计是这个原因导致

zhangkef0904 发表于 2011-5-26 11:04

主机这边没有指定调试的程序吧?你试着在target remote之前先执行
file /temp/hello
页: [1]
查看完整版本: gdb+gdbserver求指教