From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7375 invoked by alias); 25 May 2014 07:15:25 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 7360 invoked by uid 89); 25 May 2014 07:15:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: plane.gmane.org Received: from plane.gmane.org (HELO plane.gmane.org) (80.91.229.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sun, 25 May 2014 07:15:19 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WoSeG-00027N-6Q for gdb@sourceware.org; Sun, 25 May 2014 09:15:12 +0200 Received: from h86-62-88-129.ln.rinet.ru ([86.62.88.129]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 25 May 2014 09:15:12 +0200 Received: from ghost by h86-62-88-129.ln.rinet.ru with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 25 May 2014 09:15:12 +0200 To: gdb@sourceware.org From: Vladimir Prus Subject: Re: GDB/MI output command documentation error Date: Sun, 25 May 2014 07:15:00 -0000 Message-ID: References: <20140523012631.GB10166@linux> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: <20140523012631.GB10166@linux> X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg00055.txt.bz2 On 05/23/2014 05:26 AM, Bob Rossi wrote: > Hi, > > The documentation for a GDB/MI output command says, > > output ==> > ( out-of-band-record )* [ result-record ] "(gdb)" nl > > Where an out-of-band-record is one or more lines starting with > * + = (for async records) > ~ @ & (for stream records) > > A result record starts with a ^ (if no token is used). > The result record is after the possible out-of-band-records. > > This Documentation is incorrect for the most basic GDB/MI command. > When I provide the GDB/MI command, -exec-run I get the following output. > =library-unloaded,... > =library-unloaded,... > =thread-group-started,... > =thread-created,... > ^running <- Incorrect location or docs are wrong > *running,... > (gdb) > > In mi-interp.c:mi_on_resume the code says: > /* To cater for older frontends, emit ^running, but do it only once > per each command. We do it here, since at this point we know > that the target was successfully resumed, and in non-async mode, > we won't return back to MI interpreter code until the target > is done running, so delaying the output of "^running" until then > will make it impossible for frontend to know what's going on. > > In future (MI3), we'll be outputting "^done" here. */ > if (!running_result_record_printed && mi_proceeded) > { > fprintf_unfiltered (raw_stdout, "%s^running\n", > current_token ? current_token : ""); > } > > So, I assume we aren't going to change what GDB outputs at this point. > For that reason, I would argue the documentation is wrong. > > The correct grammar would be something like, > output ==> > ( out-of-band-record )* [ result-record ] ( out-of-band-record )* "(gdb)" nl Bob, I think that it probably was wrong to define 'output' nonterminal in the first place. While your revision makes things closer to reality, out of band records don't necessary correspond to any command, therefore making them a part of command output in the grammar is not logically reasonable. In fact, I think that out of band record can appear outside command output - say, you did -exec-step, it completed and you have the prompt, but in non-stop mode, other threads can hit breakpoints producing *stopped. In fact, in non-stop/async mode you get prompt even while the current command is still running. Better approach would to be to say that each thing GDB outputs is a sequence of line, and each line can be parsed as either out of band record or result record or prompt. Other constraints, such as single-result-record-per-command would be described outside of the grammar. What do you think? - Volodya