Linux gdb命令:GNU调试器。
Linux gdb命令 功能描述
使用gdb命令可以调试程序。gdb主要调试的是C/C++的程序。要调试C/C++的程序,首先在编译时,必须把调试信息添加到可执行文件中。
Linux gdb命令 语法
gdb [选项] [可执行文件[核心文件或进程ID]]
gdb [选项] [参数] [可执行文件] [inferior参数]
gdb [选项] [脚本文件] [脚本参数]
命令中各选项的含义如下表所示。
在使用gdb命令调试程序时,可以使用下表所示的子命令。
Linux gdb命令 示例
进入gdb交互式界面
[root@rhel ~]# gdb
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6)
Copyright (C) 2010 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb)
调试test.c文件
[root@rhel ~]# gdb test.c