Debugging with GDB Manual HP WDB v6.3 (5900-2180, August 2012)
21 The GDB/MI Interface
Function and purpose
GDB/MI is a line based machine oriented text interface to GDB. It is specifically intended to support
the development of systems which use the debugger as just one small component of a larger system.
This chapter is a specification of the GDB/MI interface. It is written in the form of a reference
manual.
Notation and terminology
This chapter uses the following notation:
• | separates two alternatives.
• [ something ] indicates that something is optional: it may or may not be given.
• ( group )* means that group inside the parentheses may repeat zero or more times.
• ( group )+ means that group inside the parentheses may repeat one or more times.
• “string” means a literal string.
Acknowledgments
In alphabetic order: Andrew Cagney, Fernando Nasser, Stan Shebs and Elena Zannoni.
21.1 GDB/MI Command Syntax
21.1.1 GDB/MI Input syntax
command → cli-command | mi-command
cli-command → [ token ] cli-command nl, where cli-command is any
existing GDB CLI command.
mi-command → [ token ] "-" operation ( " " option )* [ " --" ] ( " "
parameter )* nl
token → "any sequence of digits"
option → "-" parameter [ " " parameter ]
parameter → non-blank-sequence | c-string
operation → any of the operations described in this chapter
non-blank-sequence → anything, provided it does not contain special characters such as
“-”, nl, """ and of course “”
c-string → """ seven-bit-iso-c-string-content """
nl → CR | CR-LF
Notes:
• The CLI commands are still handled by the MI interpreter; their output is described below.
• The token, when present, is passed back when the command finishes.
• Some MI commands accept optional arguments as part of the parameter list. Each option is
identified by a leading `-' (dash) and may be followed by an optional argument parameter.
Options occur first in the parameter list and can be delimited from normal parameters using
`--' (this is useful when some parameters begin with a dash).
21.1 GDB/MI Command Syntax 243