1. 简介
gdb
(GNU debugger
)是 UNIX/Linux
系统中强大的调试工具,它能够调试软件并分析软件的执行过程,帮助我们调查研究程序的正确行为,还能用来分析程序崩溃的原因等。
gdb
支持多种语言,可以支持 C/C++
、Go
、Java
、Objective-C
等。
2. 安装
CentOS
安装
sudo yum install gdb
Ubuntu
安装
sudo apt-get install gdb
检查是否安装成功:
wohu@wohu-dev:~$ gdb -v
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 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 "x86_64-linux-gnu".
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".
wohu@wohu-dev:~$
3. 常用功能概览
gdb
的功能非常多,比如断点管理、崩溃转储文件(core dump
)分析、执行 Shell
命令等。