Target output printed raw on MI channel

Jan Vrany jan.vrany@fit.cvut.cz
Tue Jan 22 15:51:00 GMT 2019


Hello,

the GDB/MI interface describes "target-stream-output" MI record and
says [1]:

  * target-stream-output is the output produced by the target program. 
    All the target output is prefixed by ‘@’. 

My understanding is that if I run GDB with MI2 interpreter, all debugee 
output written to stdout / stderr shall be sent to MI client as 
target-stream-output. However, it is not: 

./gdb -i=mi2 -ex "set startup-with-shell on" -ex r -ex quit --args /bin/ls -al /etc/passwd

produces: 

      <...truncated for clarity...>
      =library-loaded,id="/lib/x86_64-linux-gnu/libnsl.so.1",target-name="/lib/x8<...truncated for clarity...>
      =library-loaded,id="/lib/x86_64-linux-gnu/libnss_files.so.2",target-name="/lib/x8<...truncated for clarity...>
-->   -rw-r--r-- 1 root root 2386 Nov 14 14:21 /etc/passwd
      ~"[Inferior 1 (process 27339) exited normally]\n"
      =thread-exited,id="1",group-id="i1"
      =thread-group-exited,id="i1",exit-code="0"
      *stopped,"Starting program",execfile="/bin/ls",infargs="-al /etc/passwd",reason="exited-normally"

Note, that the output is raw, not something like

     @"-rw-r--r-- 1 root root 2386 Nov 14 14:21 /etc/passwd\n"
   
as I'd expect. This is produced with current GDB master b1afaa3566. 
Using "set startup-with-shell off" produces the same. As you can imagine, this can 
confuse (my) MI parser quite a lot. 

Is it a bug or do I misunderstand the documentation and/or purpose of 
"target-stream-output" MI record? 

Thanks, Jan



[1]: https://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI-Output-Syntax.html#GDB_002fMI-Output-Syntax




More information about the Gdb mailing list