This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: MI2 grammar
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: Daniel Gutson <daniel dot gutson at tallertechnologies dot com>, gdb-patches <gdb-patches at sourceware dot org>, Roman Leonardo Alarcon <roman dot alarcon at tallertechnologies dot com>
- Date: Tue, 24 May 2016 14:23:55 -0400
- Subject: Re: MI2 grammar
- Authentication-results: sourceware.org; auth=none
- References: <CAF5HaEXB6dUW-aP9cKDsy=QtJCaS-7YNLHMZx5bVsv-nMKon4w at mail dot gmail dot com>
On 16-05-18 03:55 PM, Daniel Gutson wrote:
> Hi,
>
> this is a very initial version of the MI grammar for lex and yacc.
>
> This is actually a standalone application (containing C++ source code)
> that accepts
> the gdb MI output; the important part is the .y and .l files, the rest is just
> a C++ thing using the parser.
>
> I'm posting this here for two purposes:
>
> - so other people can use it if interested
> - to propose create an official grammar by adding the .l and .y files
> somewhere to the
> source tree, and keeping them updated if the grammar changes.
>
> As a side note, the quit command replies a nonconforming output since
> the "(gdb)" string is not included,
> as required in https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Output-Syntax.html#GDB_002fMI-Output-Syntax
>
> Thanks,
>
> Daniel.
I am pretty sure that we'll forget to update this if the grammar evolves. Things
like this tend to be forgotten when we update the code.
One way to avoid it would be to actually use it. It would be awesome (I think) to
find a way to plug this in the test framework, and have it verify that everything gdb
outputs is valid MI (or maybe it could be baked in GDB itself when built in developer
mode). I know there is at least one issue where GDB outputs bad MI:
https://sourceware.org/bugzilla/show_bug.cgi?id=14733
but I wouldn't be surprised if there were other cases (more serious/subtle than
the quit example).
While I'm at it, I might as well plug this little piece of code that a friend and
I wrote, it might be useful to someone:
https://github.com/simark/pygdbmi
It came out of a need to be able to pretty print MI output to make it readable,
writing/debugging some MI-outputting code.
Simon