GDB是linux环境下的程序调试工具。一般来说,GDB主要帮助你完成下面四个方面的功能:
[root@s142 gdb-7.8]# yum install -y gdb
[root@s142 gdb-7.8]# gdb -v
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-120.el7
Copyright © 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
…
[root@s142 opt]# wget http://ftp.gnu.org/gnu/gdb/gdb-7.8.tar.gz
[root@s142 opt]# tar -zxvf gdb-7.8.tar.gz
[root@s142 opt]# chown -R root.root gdb-7.8
[root@s142 gdb-7.8]# mkdir build
[root@s142 build]# …/configure --prefix=/usr
…
configure: creating ./config.status
config.status: creating Makefile
遇到预编译或者编译报错,请参照QA章节处理。
[root@s142 build]# make
make[4]: Leaving directory `/opt/gdb-7.8/build/gdb/build-gnulib’
make[3]: Leaving directory `/opt/gdb-7.8/build/gdb’
make[2]: Leaving directory `/opt/gdb-7.8/build/gdb’
make[1]: Nothing to be done for `all-target’.
make[1]: Leaving directory `/opt/gdb-7.8/build’
[root@s142 build]# make install
…
make[2]: Leaving directory `/opt/gdb-7.8/build/gdb’
make[1]: Nothing to be done for `install-target’.
make[1]: Leaving directory `/opt/gdb-7.8/build’

[root@s142 build]# gdb -v
GNU gdb (GDB) 7.8