Separating "shell dir" output from GDB/MI output

Bob Rossi bob@brasko.net
Sun Oct 9 12:33:00 GMT 2005


On Sat, Oct 08, 2005 at 10:19:33PM -0700, jingzhao.ou wrote:
> Dear all,
> 
> I am trying to see if it is possible to build a Tcl/Tk based GDB
> frontend using Bob Rossi's MI parser. For normal commands, it works
> just fine. However, if I execute "shell dir" command in gdb, the
> parser will report error. (see the end of the email)
> 
> I am wondering if there is any way to separate the shell output from
> the normal GDB output. So that this problem can be solved properly.
> 
> Sincerely hope that any one can give me a hand. I am using MinGW.
> 
> Best regards,
> Jingzhao
> 
> ===========================================
> (gdb)
> &"shell dir\n"
> Makefile             gdbmi_grammar.tab.o  gdbmi_pt.c         main.tcl
> Makefile_orig        gdbmi_grammar.txt    gdbmi_pt.h         tkGDB.c
> b                    gdbmi_grammar.y      gdbmi_pt.o         tkGDB.dll
> bb                   gdbmi_lexer.l        lex.yy.c           tkGDB.exe
> gdbmi_driver.c       gdbmi_parser.c       lex.yy.o           tkGDB_bak.c
> gdbmi_grammar.tab.c  gdbmi_parser.h       libgdbmi_parser.a  tkGDB_stub.c
> gdbmi_grammar.tab.h  gdbmi_parser.o       main.exe           tk_gdb.tcl
> ^done
> (gdb)
> ===========================================

I think the best idea we've had so far for solving problems like this is
to add an option to GDB to have it output GDB/MI data on a file
descriptor X. For instance,
   gdb -i=mi -mi-out-fd=30
and then when you fork/exec GDB you dup the 30 file descriptor so that
you can read the output.

Eli, do you know if this approach would be portable to windows nativly?
I could look into implementing this feature, since it would resolve a
*lot* of problems regarding I/O.

Thanks,
Bob Rossi



More information about the Gdb mailing list