微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > GDB+GdbServer: ARM程序调试

GDB+GdbServer: ARM程序调试

时间:11-22 来源:互联网 点击:

tinue or c //这里不能用run

(gdb)next or n

(gdb)print or p result

(gdb) finish //跳出func函数

(gdb) next

(gdb) quit

建立连接后进行gdb远程调试和gdb本地调试方法相同

七、linux下安装gdbserver问题

toolchain version:gdb的版本可能和交叉编译器有很大的关系

gcc-3.3.2

glibc-2.2.5

binutils-2.15此为croostool 3.3.2

安装步骤:
下载解压gdb-6.6
#cdgdb-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 no header 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

95 case TD_VERSION:

96 return "version mismatch between libthread_db and libpthread";

97 #endif

/* Define if TD_VERSION is available. */

/*#define HAVE_TD_VERSION 1 */

/*have no TD_VERSION. so undefine 20070402 dding */

gdb6.1没有此问题

3.

[root@AT91RM9200DKarm]$./gdbserver 192.168.0.12:2345 mainparacarmgdb6.5

./gdbserver: error in loading shared libraries: libthread_db.so.1: cannot open

[root@AT91RM9200DKarm]$./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 no libthread_db.so.1 Can i use nfs to copy libthread_db.so.1 to /lib? But now i cannot find this file, and is there any for cross 3.3.2?

libpthread-0.8.so

libpthread.so libpthread.so.0 libresolv-2.1.3.so

libresolv.so.2 libstdc++.a.2.10.0libtermcap.so.2

[root@AT91RM9200DKarm]$cp libthread_db-1.0.so libthread_db.so.1

[root@AT91RM9200DKarm]$cp libthread_db.so.1 /lib/

[root@AT91RM9200DKarm]$./gdbserver 192.168.0.12:2345 mainparacarm

./gdbserver: /lib/libc.so.6:

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top