[root@AT91RM9200DK arm]$./gdbserver 192.168.0.12:2345 mainparacarm
./gdbserver: error in loading shared libraries: libthread_db.so.1: cannot open [root@AT91RM9200DK arm]$
host pc:
#cd /usr/local/arm-gdb/bin/以便能够运行arm-linux-gdb,但是无此必要,可在环境变量中设置此路径即可。
#copy gdbtest /usr/local/arm-gdb/bin///将前面编译的文件gdbtest拷贝到此目录
#./arm-linux-gdb gdbtest
(gdb)target remote 192.168.1.180:1234//连接到开发板成功后就可以
进行调试
(gdb)listor l
(gdb)break func
(gdb)break 22
(gdb)info br
(gdb)continueor c//这里不能用run
(gdb)nextor n
(gdb)print or presult
(gdb) finish//跳出func函数
(gdb) next
(gdb) quit
建立连接后进行gdb远程调试和gdb本地调试方法相同
下安装gdbserver问题
toolchain version:gdb的版本可能和交叉编译器有很大的关系
gcc-3.3.2
glibc-2.2.5
binutils-2.15此为croostool 3.3.2
安装步骤:下载解压gdb-6.6
#cd gdb-6.6
#./configure --target=arm-linux --prefix=/usr/local/arm-gdb –v
#make&make install
OK,然后:
#export PATH=$PATH:/usr/local/arm-gdb
进入gdbserver目录:
#./configure --target=arm-linux --host=arm-linux
#make CC=/usr/local/armv5l/3.3.2/bin/armv5l-linux-gcc
出错:
/usr/local/armv5l/3.3.2/bin/armv5l-linux-gcc -c -Wall -g -O2 -I. -I. -I./../regformats -I./../../include -I../../bfd -I./../../bfdlinux-arm-low.c
linux-arm-low.c:35:21: sys/reg.h:没有那个文件或目录
make: *** [linux-arm-low.o]错误1
然后把/usr/include/sys/reg.h copy到/usr/local/armv5l-2.6.x/3.3.2/armv5l-linux/include/sys/reg.h,即将该文件拷贝到交叉编译器的include目录下,再make,显示错误:
/usr/local/armv5l/3.3.2/bin/armv5l-linux-gcc -c -Wall -g -O2 -I. -I. -I./../regformats -I./../../include -I../../bfd -I./../../bfd thread-db.c
thread-db.c: In function `thread_db_err_str':
thread-db.c:95: error: `TD_VERSION' undeclared (first use in this function)
thread-db.c:95: error: (Each undeclared identifier is reported only once
thread-db.c:95: error: for each function it appears in.)
thread-db.c: In function `thread_db_get_tls_address':
thread-db.c:336: warning: implicit declaration of function `td_thr_tls_get_addr'
thread-db.c:336: warning: cast to pointer from integer of different size
thread-db.c:340: warning: cast from pointer to integer of different size
make: *** [thread-db.o]错误1
本想继续fix error,但是感觉不太对,请问各位,是什么原因呢?
是不是CC的target写错了?应该是arm-linux还是armv5l-linux?
1.
make: *** [linux-arm-low.o] Error 1
[root@dding gdbserver]#
[root@dding gdbserver]# gedit config.h
/* Define to 1 if you have the header file. */
/*define HAVE_SYS_REG_H 1*/
/*have noheader file. so undefine 20070402 dding*/
2.
thread-db.c: In function `thread_db_err_str':gdb6.5
thread-db.c:95: `TD_VERSION' undeclared (first use in this function)
[root@dding gdbserver]# gedit config.h
94 #ifdef HAVE_TD_VERSION
95case TD_VERSION:
96return "version mismatch between libthread_db and libpthread";
97 #endif
/* Define if TD_VERSION is available. */
/*#define HAVE_TD_VERSION 1*/
/*have noTD_VERSION. so undefine 20070402 dding*/
gdb6.1没有此问题
3.
[root@AT91RM9200DK arm]$./gdbserver 192.168.0.12:2345 mainparacarmgdb6.5
./gdbserver: error in loading shared libraries: libthread_db.so.1: cannot open
[root@AT91RM9200DK arm]$./gdbserver 192.168.0.14:2345 mainparacarmgdb6.1
./gdbserver: error in loading shared libraries: libthread_db.so.1: cannot open shared object file: No such file or directory
我已经加了libthread_db.so.1共享库为什么还打不开呢????共享库和cpu类型有关吗?gdbserver: error while loading shared libraries: libthread_db.so.1: cannot open
shared object file: No such file or director
****编译GDB的时候搞成静态的就好了.我想编译选项里应该有.要不你就在Makefile里加上CFLAGS += -static
LDFLAGS += -static这两个的其中一个应该就可以了,不过还是两个都加上吧.
***/lib there is nolibthread_db.so.1 Can i use nfs to copylibthread_db.so.1 to /lib? But now i cannot find this file,and is there any for cross3.3.2?
libpthread-0.8.so
libpthread.solibpthread.so.0libresolv-2.1.3.so
libresolv.so.2libstdc++.a.2.10.0
[root@AT91RM9200DK arm]$cp libthread_db-1.0.so libthread_db.so.1
[root@AT91RM9200DK arm]$cp libthread_db.so.1 /lib/
[root@AT91RM9200DK arm]$./gdbserver 192.168.0.12:2345 mainparacarm
./gdbserver: /lib/libc.so.6: version `GLIBC_2.2' not found (required by /lib/li)
难道目前的gdb 6.5版本太高,需要内核版本和交叉编译器与之匹配?实在不行,就试试低版本的gdb