技术干货八:GNU Project Debugger (GDB) 简介
GNU Project Debugger (GDB) 简介
Let’s have a look at debugger tools for C/C++. So, what is a debugger? A debugger is a program that runs and controls another program, examining each line of code to detect problems or bugs.
让我们看一看C/C++的调试器工具。什么是调试器?调试器是运行和控制另一个程序的程序,检查每一行代码以检测问题或错误。
The Ubuntu Linux comes with a debugger called GNU Debugger, which is also called GDB (www.gnu.org/software/gdb/). It is one of the popular C and C++ program debuggers for the Linux system.
Ubuntu Linux附带了一个名为GNU debugger的调试器,也称为GDB(www.gnu.org/software/gdb/)。它是Linux系统中流行的C和C++程序调试器之一。
1 Ubuntu Linux 安装 GDB
Here is the command to install GDB in Ubuntu. It’s already installed on the latest version of Ubuntu. If you are using other versions, you can use the following command to install it.
下面是在Ubuntu中安装GDB的命令。GDB已经安装在最新版本的Ubuntu上。如果您使用的是其他版本,则可以使用以下命令进行安装。
sudo apt-get install gdb
2 GDB 安装后验证
To check whether GDB is installed properly on your PC, use the following command. Once you type gdb in your terminal, the message in Figure is shown.
要检查GDB是否正确安装在你的电脑上,请使用以下命令。在终端中键入gdb
后,将显示图中的消息。
gdb
You can verify the gdb version by using the following command.
你也可以使用以下命令验证gdb版本。
gdb version