gdb.info: GDB/MI Output Syntax

Go forward to GDB/MI Simple Examples
Go backward to GDB/MI Input Syntax
Go up to GDB/MI Command Syntax
Go to the top op gdb

GDB/MI Output Syntax

The output from GDB/MI consists of zero or more out-of-band records
followed, optionally, by a single result record.  This result record is
for the most recent command.  The sequence of output records is
terminated by `(gdb)'.
   If an input command was prefixed with a `TOKEN' then the
corresponding output for that command will also be prefixed by that same
TOKEN.
`OUTPUT ==>'
     `( OUT-OF-BAND-RECORD )* [ RESULT-RECORD ] "(gdb)" NL'
`RESULT-RECORD ==>'
     ` [ TOKEN ] "^" RESULT-CLASS ( "," RESULT )* NL'
`OUT-OF-BAND-RECORD ==>'
     `ASYNC-RECORD | STREAM-RECORD'
`ASYNC-RECORD ==>'
     `EXEC-ASYNC-OUTPUT | STATUS-ASYNC-OUTPUT | NOTIFY-ASYNC-OUTPUT'
`EXEC-ASYNC-OUTPUT ==>'
     `[ TOKEN ] "*" ASYNC-OUTPUT'
`STATUS-ASYNC-OUTPUT ==>'
     `[ TOKEN ] "+" ASYNC-OUTPUT'
`NOTIFY-ASYNC-OUTPUT ==>'
     `[ TOKEN ] "=" ASYNC-OUTPUT'
`ASYNC-OUTPUT ==>'
     `ASYNC-CLASS ( "," RESULT )* NL'
`RESULT-CLASS ==>'
     `"done" | "running" | "connected" | "error" | "exit"'
`ASYNC-CLASS ==>'
     `"stopped" | OTHERS' (where OTHERS will be added depending on the
     needs--this is still in development).
`RESULT ==>'
     ` VARIABLE "=" VALUE'
`VARIABLE ==>'
     ` STRING '
`VALUE ==>'
     ` CONST | TUPLE | LIST '
`CONST ==>'
     `C-STRING'

`TUPLE ==>'
` "{}" | "{" RESULT ( "," RESULT )* "}" '

`LIST ==>'
` "[]" | "[" VALUE ( "," VALUE )* "]" | "[" RESULT ( "," RESULT )*
"]" '

`STREAM-RECORD ==>'
     `CONSOLE-STREAM-OUTPUT | TARGET-STREAM-OUTPUT | LOG-STREAM-OUTPUT'
`CONSOLE-STREAM-OUTPUT ==>'
     `"~" C-STRING'
`TARGET-STREAM-OUTPUT ==>'
     `"@" C-STRING'
`LOG-STREAM-OUTPUT ==>'
     `"&" C-STRING'

`NL ==>'
`CR | CR-LF'

`TOKEN ==>'
     _any sequence of digits_.
Notes:
   * All output sequences end in a single line containing a period.
   * The `TOKEN' is from the corresponding request.  If an execution
     command is interrupted by the `-exec-interrupt' command, the TOKEN
     associated with the `*stopped' message is the one of the original
     execution command, not the one of the interrupt command.
   * STATUS-ASYNC-OUTPUT contains on-going status information about the
     progress of a slow operation.  It can be discarded.  All status
     output is prefixed by `+'.
   * EXEC-ASYNC-OUTPUT contains asynchronous state change on the target
     (stopped, started, disappeared).  All async output is prefixed by
     `*'.
   * NOTIFY-ASYNC-OUTPUT contains supplementary information that the
     client should handle (e.g., a new breakpoint information).  All
     notify output is prefixed by `='.
   * CONSOLE-STREAM-OUTPUT is output that should be displayed as is in
     the console.  It is the textual response to a CLI command.  All
     the console output is prefixed by `~'.
   * TARGET-STREAM-OUTPUT is the output produced by the target program.
     All the target output is prefixed by `@'.
   * LOG-STREAM-OUTPUT is output text coming from GDB's internals, for
     instance messages that should be displayed as part of an error
     log.  All the log output is prefixed by `&'.
   * New GDB/MI commands should only output LISTS containing VALUES.
   *Note GDB/MI Stream Records: GDB/MI Stream Records, for more details
about the various output records.