GDB/MI Input Syntax (Debugging with GDB)

From Get docs
Gdb/docs/latest/gdb/GDB 002fMI-Input-Syntax


27.2.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 doesn’t 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).

Pragmatics:

  • We want easy access to the existing CLI syntax (for debugging).
  • We want it to be easy to spot a MI operation.