Debugging with GDB Manual (5900-1473; WDB 6.2; January 2011)

Table Of Contents
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 310), for more details about the various output
records.
21.1.3 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)
21.2 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.
21.2 GDB/MI compatibility with CLI 309