一 . 下载gdb-6.7.tar.bz2 并解压
二. 进入gdb-6.7
三. 配置
输入./configure --help 查看配置信息。重点关注 system types:项 如下图:
-----------------------------------------------------------------------------------------------------------------------------------------------
从上面的配置帮助信息可以看出 ,如果只写 ./configure 的话 系统会默认为运行在PC机上 因此配置为 ./configure --target = arm-linux 回车
四.编译 make :
编译时会出现如下错误:
make之后出现
【1】.././gdb/cli/cli-cmds.c: In function ‘pwd_command’:
.././gdb/cli/cli-cmds.c:323: error: ignoring return value of ‘getcwd’, declared with attribute warn_unused_result
make[2]: *** [cli-cmds.o] Error 1
make[2]: Leaving directory `/home/yeziqiang/gdb-6.8/gdb'
make[1]: *** [all-gdb] Error 2
make[1]: Leaving directory `/home/yeziqiang/gdb-6.8'
make: *** [all] Error 2
打开相应的cli-cmds.c(在main.c、top.c、mi-cmd-env.c等文件也会有相应的错误,改法一样)(得用sudo gedit),找到相应的行,
把getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));注释掉,在前加//活直接删掉。再在下面补充:
if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)))
error (_("Error finding name of working directory: %s"),safe_strerror (errno));
再次make出现这样的错误:
【2】eval.c: In function ‘evaluate_subexp_standard’:
eval.c:1705: error: ‘subscript_array’ may be used uninitialized in this function
在这条语句之后添加:
memset(&subscript_array, 0, sizeof(subscript_array));
【3】utils.c: In function ‘internal_vproblem’:
utils.c:707: error: ignoring return value of ‘write’, declared with attribute warn_unused_result
int temp; //添加
temp = write (STDERR_FILENO, msg, sizeof (msg)); // 修改后
【4】inflow.c: In function ‘new_tty’:
inflow.c:548: error: ignoring return value of ‘dup’, declared with attribute warn_unused_result
inflow.c:553: error: ignoring return value of ‘dup’, declared with attribute warn_unused_result
inflow.c:558: error: ignoring return value of ‘dup’, declared with attribute warn_unused_result
int temp; //添加
temp = dup (tty); //将相应的行修改为
在$make
OK 成功!
五 。make install 安装。。
感谢各位大牛的支持!!谢谢。。