From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3405 invoked by alias); 24 May 2016 18:24:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 3357 invoked by uid 89); 24 May 2016 18:24:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=Things, developer, forgotten, friend X-HELO: usplmg20.ericsson.net Received: from usplmg20.ericsson.net (HELO usplmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 24 May 2016 18:24:02 +0000 Received: from EUSAAHC006.ericsson.se (Unknown_Domain [147.117.188.90]) by usplmg20.ericsson.net (Symantec Mail Security) with SMTP id 29.9D.09012.5B394475; Tue, 24 May 2016 19:47:33 +0200 (CEST) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.92) with Microsoft SMTP Server id 14.3.294.0; Tue, 24 May 2016 14:23:55 -0400 Subject: Re: MI2 grammar To: Daniel Gutson , gdb-patches , Roman Leonardo Alarcon References: From: Simon Marchi Message-ID: <57449C3B.5030108@ericsson.com> Date: Tue, 24 May 2016 18:24:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-05/txt/msg00436.txt.bz2 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