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.
Here's an example of stopping the inferior process:
-> -stop
<- (gdb)
and later:
<- *stop,reason="stop",address="0x123",source="a.c:123"
<- (gdb)
Here's 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)
-> -symbol-file xyz.exe
<- *breakpoint,nr="3",address="0x123",source="a.c:123"
<- (gdb)
Here's what happens if you pass a non-existent command:
-> -rubbish
<- ^error,msg="Undefined MI command: rubbish"
<- (gdb)