首先下载gdb-7.12.tar.gz(在我的资源中可以直接下载)
然后解压到任意目录,我解压在Document里matt@ubuntu:~$ tar -zxvf gdb-7.12.tar.gz
然后cd gdb-7.12然后
matt@ubuntu:~/Documents/gdb-7.12$ ./configure
在此之前我安装了
texinfo,libncurses5-dev, m4, flex 和 bison这5个包
就是apt-get install texinfo之类的cmd就可以了
然后
matt@ubuntu:~/Documents/gdb-7.12$ make
然后
matt@ubuntu:~/Documents/gdb-7.12$ sudo make install
这样就装好了gdb
不过ubuntu14.04自带gdb,所以这个安装过程也只供参考
如果编译海思的gdb server,则命令如下:
matt@ubuntu:~/Documents/gdb-7.12/gdb/gdbserver$ CC=arm-hisiv300-linux-gcc ./configure --host=arm-hisiv300-linux --target=arm-hisiv300-linux
matt@ubuntu:~/Documents/gdb-7.12/gdb/gdbserver$ make
matt@ubuntu:~/Documents/gdb-7.12/gdb/gdbserver$ file gdbserver
gdbserver: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), not stripped
matt@ubuntu:~/Documents/gdb-7.12/gdb/gdbserver$ arm-hisiv300-linux-strip gdbserver -o gdbserver
matt@ubuntu:~/Documents/gdb-7.12/gdb/gdbserver$ file gdbserver
gdbserver: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), stripped
而编译imx6的gdb server则是:
matt@ubuntu:~/Documents/gdb-7.12/gdb/gdbserver$ CC=arm-fsl-linux-gnueabi-gcc ./configure --host=arm-fsl-linux-gnueabi --target=arm-fsl-linux-gnueabi
arm-fsl-linux-gnueabi-strip gdbserver -o gdbserver
而但凡目标开发板是arm内核的,gdb的编译命令都是
root@P310:~/Documents/gdb-7.12# ./configure --target=arm-linux --prefix=/usr/local/arm-gdb 后面这个是生成arm-linux-gdb的目录
在这个目录下执行
root@P310:/usr/local/arm-gdb/bin# gdb
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu". //由于我们没有将新的arm-linux-gdb写入系统的环境变量中,所以这里用的还是默认的gdb也就是i686系统的gdb
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>.
(gdb) q
root@P310:/usr/local/arm-gdb/bin# ./arm-linux-gdb
GNU gdb (GDB) 7.12
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-linux". //这里多出来一个target哦
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".