Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)
• 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
(for example, 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.
See “GDB/MI stream records” (page 236), for more details about the various output records.
Simple examples of GDB/MI interaction
This subsection presents several simple examples of interaction using the GDB/MI interface. In
these examples, '->' means that the following line is passed to GDB/MI as input, while '<-' means
the output received from GDB/MI.
Evaluate expression
Here is an example to evaluate an expression:
-> -data-evaluate-expression 2+3
<- (gdb)
<- ^done,value="5"
<- (gdb)
and later:
<- *stop,reason="stop",address="0x123",source="a.c:123"
<- (gdb)
Simple CLI command
Here is an example of a simple CLI command being passed through GDB/MI and on to the CLI.
-> print 1+2
<- &"print 1+2\n"
<- ~"$1 = 3\n"
<- ^done
<- (gdb)
A bad command
Here is what happens if you pass a bad command:
-> -rubbish
<- ^error,msg="Undefined MI command: rubbish"
<- (gdb)
GDB/MI compatibility with CLI
To help users get familiar with GDB CLI, GDB/MI accepts existing CLI commands. As specified by
the syntax, such commands can be directly entered into the GDB/MI interface and GDB will
respond.
This mechanism is provided as an aid to developers of GDB/MI clients and not as a reliable
interface into the CLI. Since the command is being interpreted in an environment that assumes
GDB/MI compatibility with CLI 235