1 3.5.2 Gdb 基本命令 Gdb的命令可以通过查看help进行查找,由于Gdb的命令很多,因此Gdb的help将其分成了很多种类(class),用户可以通过进一步查看相关class找到相应命令。如下所示: (gdb) help List of classes of commands: aliases -- Aliases of other commands breakpoints -- Making program stop at certain points data -- Examining data files -- Specifying and examining files internals -- Maintenance commands … Type "help" followed by a class name for a list of commands in that class. Type "help" followed by command name for full documentation. Command name abbreViations are allowed if unambiguous. 上述列出了Gdb各个分类的命令,注意底部的加粗部分说明其为分类命令。接下来可以具体查找各分类种的命令。如下所示: (gdb) help data Examining data. List of commands: call -- Call a function in the program delete display -- Cancel some expressions to be displayed when program stops delete mem -- Delete memory region 2 disable display -- Disable some expressions to be displayed when program stops … Type "help" followed by command name for full documentation. Command name abbreViations are allowed if unambiguous. 至此,若用户想要查找call命令,就可键入“help call”。 (gdb) help call Call a function in the program. The argument is the function name and arguments, in the notation of the current working language. The result is printed and saved in the value history, if it is not void. 当然,若用户已知命令名,直接键入“help [command]”也是可以的。 Gdb中的命令主要分为以下几类:工作环境相关命令、设置断点与恢复命令、源代码查看命令、查看运行数据相关命令及修改运行参数命令。以下就分别对这几类的命令进行讲解。 3 1.工作环境相关命令 Gdb中不仅可以调试所运行的程序,而且还可以对程序相关的工作环境进行相应的设定,甚至还可以使用shell中的命令进行相关的操作,其功能极其强大。表3.10所示列出了Gdb常见工作环境相关命令。 表3.10 Gdb ...