GDB查看命令

  • 内容
  • 评论
  • 相关

关于 GDB 调试工具,主要是讲解它的字符界面的使用,也就是使用命令调试程序。GDB 中调试的命令非常的多,具体可以通过 help 命令查看。

查看命令的种类

查看各个种类的命令可以进入到 gdb 的命令行模式中,使用 help 命令查看,使用方式:

 (gdb) help

不需要添加任何的参数,例如:

(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
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands

查看具体某个类型中的命令

使用 help 命令,向我们展示了命令总体被划分成了12种,其中每一种又会包含许多的命令,查看各个种类种的命令使用方法:

(gdb) help <class>

其中 <class> 表示 help 命令显示的 GDB 中的命令的种类,例如:

(gdb) help breakpoints
Making program stop at certain points.
 
List of commands:
 
awatch -- Set a watchpoint for an expression
break -- Set breakpoint at specified location
break-range -- Set a breakpoint for an address range
catch -- Set catchpoints to catch events
catch assert -- Catch failed Ada assertions
catch catch -- Catch an exception
……

列举的只是 breakpoints 这个种类中得一小部分,关于 breakpoints 相关的命令非常多。

命令的具体使用方式

如果我们想知道具体某条命令的使用方法,仍然可以使用 help 命令,使用方法如下:

(gdb) help <command>

<command> 表示的是具体的一条命令,例如:

(gdb) help break
Set breakpoint at specified location.
break [PROBE_MODIFIER] [LOCATION] [thread THREADNUM] [if CONDITION]

help 会显示出这条命令的含义以及使用方式。

总结:

  • help 单独使用是查看命令的种类。
  • help <class> 添加命令的种类表示使用这条命令查看各个种类中具体命令选项。
  • help <command>添加具体的一条命令表示查看命令的使用方式。

本文标题:GDB查看命令

本文地址:http://www.hosteonscn.com/7936.html

评论

0条评论

发表评论

邮箱地址不会被公开。 必填项已用*标注