From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18892 invoked by alias); 4 Aug 2005 14:09:45 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 18869 invoked by uid 22791); 4 Aug 2005 14:09:39 -0000 Received: from centrmmtao01vip.cox.net (HELO centrmmtao01.cox.net) (68.1.16.139) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 04 Aug 2005 14:09:39 +0000 Received: from white ([68.9.64.121]) by centrmmtao01.cox.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050804140938.MITS4773.centrmmtao01.cox.net@white> for ; Thu, 4 Aug 2005 10:09:38 -0400 Received: from bob by white with local (Exim 3.35 #1 (Debian)) id 1E0gPh-00016S-00 for ; Thu, 04 Aug 2005 10:09:37 -0400 Date: Thu, 04 Aug 2005 14:09:00 -0000 From: Bob Rossi To: gdb-patches@sources.redhat.com Subject: Re: Fully anchor mi_gdb_test expected results. Message-ID: <20050804140937.GB4054@white> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20050804025045.GC32108@white> <20050804041121.GB29482@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050804041121.GB29482@nevyn.them.org> User-Agent: Mutt/1.3.28i X-SW-Source: 2005-08/txt/msg00065.txt.bz2 On Thu, Aug 04, 2005 at 12:11:21AM -0400, Daniel Jacobowitz wrote: > On Wed, Aug 03, 2005 at 10:50:45PM -0400, Bob Rossi wrote: > > Hi, > > > > This testsuite change simply does several simple things. First, when > > creating a new pty for the inferior, this change turn's terminal > > echo'ing off. This allows the expected results back from GDB/MI to not > > have to have the command sent to GDB in it. The surprising thing with > > this change is that even when GDB shares the terminal's PTY with the > > inferior, not putting the echo'd data in the expected command still > > works. > > > > The only other notable change here is this, > > > > - -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" { > > + -re "^(.*$pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)$" { > > > > that is the change that fully anchor's the output from GDB. The reason > > this is necessary is because with this change, I can grab the full > > response from GDB for a command. With this response I can do syntax > > checking with the parser that I wrote. > > > > What does everyone think? > > We're not using readline in this mode; we shouldn't have particularly > funny wrapping issues on the terminal, should we? Can we match the > echoing instead of having to mess with stty? Correct, this has nothing to do with readline. There are several problems with allowing the terminal to echo while testing the GDB/MI output. Sorry in advance for the long Email. - The first problem is that this is most likely not the scenario with most front ends. I will risk making a fool of myself by stating that I think most front end's probably communicate with GDB over a pipe, in which case, the echo'ing is not happening, and FE's do not have to deal with this data in the response. - The testsuite has several ares (which I modified in patch), that have .* at the beggining of there regex, to bypass the echo'd data. As an example, - ".*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \ + "123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \ or - -re ".*102-break-delete\r\n102\\\^done\r\n$mi_gdb_prompt$" { + -re "102\\\^done\r\n$mi_gdb_prompt$" { I'm not convinced the .* _needs_ to be in the patterns above, so this point might be a minor point. The case below might take into account the above case. - Even worse, the general purpose MI "expect" pattern looks like, -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" { which simply allows any data at the beggining of the match. So I could easily modify an MI command to output "HAHAHA, YOU CAN'T TEST ME", as the first thing it outputs, and it would go unnoticed in the testsuite. Probably the reason this could not have been done before is because the MI input command was being echo'd back, and it would be complicated to match that data. - Now, my personal favorite. In order to parse the MI output command, I need only the MI output command, not the echo'd MI input command given. So, in order to get only the MI output command, I would have to do 1 of several things. - Turn terminal echo'ing off. (the safest) - Make sure every test has the GDB expected pattern be the absolute beginning of the MI output command. Then I could assume in the general purpose match that the pattern was the beggining. It would look something like this, -re "^.*($pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)$" { I don't like this approach because it makes the testcase do specific things in order to make sure that the syntax checking was done properly. What do you think of all of this? Thanks, Bob Rossi