From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id E7426385DC05 for ; Sat, 11 Apr 2020 14:09:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E7426385DC05 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-239-0uTmgLMoPlmmHHk_D0q3kg-1; Sat, 11 Apr 2020 10:09:10 -0400 X-MC-Unique: 0uTmgLMoPlmmHHk_D0q3kg-1 Received: by mail-wm1-f71.google.com with SMTP id w8so1654329wmk.5 for ; Sat, 11 Apr 2020 07:09:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=24zVt3cKnP5AgCnFmNlwxKTl/k1eb4JofKu5r9sRaWM=; b=b+pWplzJx0MAcNv3gJiTO0oFpUNo9ewzmJkw0zuoEuBVmFwEZHE2PQQk3gmBvsmWjP CJPVv/mrwyAGF+5nczCbmrBAUc1C1nb3IobLHuZ4XWOxBS+8wffW8TMz1qL2TnezUqUA GorhbZzkYvpny6JbCBkaZlj+FIWhzBO3ORu8A158KFjkpD2CrNRlbvmsifr89ycn0K2l IMxtYjTkkhzFuUxLdiYPWg1tA4yYPmn6Rqt2eCxzc3AV0+oxY2KcHpkvGIYjkfiEmKCm QfKlNs6AbbptB5k4xKwvrBQ0/jvw2SOvUy54xwo30MWL/Fts0olQnMIbzJOnIBw6dR1A Ygsw== X-Gm-Message-State: AGi0PuZBmr7KyFmF3O0d8GBOLRn09FF9YVGeV/BQamqos9d1X+sTLdbE 7LjKzw8E83tOR2QMNlkOsdSGWNEOAvNuMGDC7HZizxXw8JXDMceSX8VAbG6/lrRZ+iWwsolqkUd fNb9XiIPafKI= X-Received: by 2002:adf:eb88:: with SMTP id t8mr9656881wrn.224.1586614148549; Sat, 11 Apr 2020 07:09:08 -0700 (PDT) X-Google-Smtp-Source: APiQypIXdKlYU9FFxX+lK/2iWjEQYkbhR+V3vS5XVinBfT1wvE6rwu7oftzx46sEpsc2P7qTPu2BSA== X-Received: by 2002:adf:eb88:: with SMTP id t8mr9656868wrn.224.1586614148318; Sat, 11 Apr 2020 07:09:08 -0700 (PDT) Received: from ?IPv6:2001:8a0:f909:7b00:2327:23ca:3e56:ef5f? ([2001:8a0:f909:7b00:2327:23ca:3e56:ef5f]) by smtp.gmail.com with ESMTPSA id x18sm7057757wrs.11.2020.04.11.07.09.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Apr 2020 07:09:07 -0700 (PDT) Subject: Re: gdb/mi, new-ui. the console and determining when GDB is ready for the next command To: Bob Rossi References: <12814f17-0c65-e214-7e68-3214d3ed6ab6@redhat.com> <20200411121228.GA32166@xubuntu.brasko.net> Cc: GDB Development From: Pedro Alves Message-ID: Date: Sat, 11 Apr 2020 15:09:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20200411121228.GA32166@xubuntu.brasko.net> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_1, GIT_PATCH_2, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2020 14:09:13 -0000 On 4/11/20 1:12 PM, Bob Rossi wrote: > On Tue, Nov 05, 2019 at 02:06:30PM +0000, Pedro Alves wrote: >> On 11/2/19 10:35 AM, Robert Rossi wrote: >>> ... >>> =breakpoint-created,bkpt={number="1",type="breakpoint",...,original-location="main"} >>> <--- No GDB prompt >> >> A gdb prompt indicates that GDB is ready to accept commands >> again. > > Sorry to respond to such an old thread. I'm just getting back into > this somehow. > > The above statement surprises me. The MI manual describes an MI > output command with the following syntax, > output -> > ( out-of-band-record )* [ result-record ] "(gdb)" nl > So I'm expecting "(gdb)\n" followed by the end of every output > command. Is this not how it works? =breakpoint-created is an out-of-band-record, not a result-record. "(gdb)" will follow a result-record, but since result-records are results/responses to MI commands initiated from the MI client, and in this case there was no MI command initiated from the MI client, there's no result-record, and thus no (gdb) prompt either. Right above that, it says: @cindex output syntax of @sc{gdb/mi} @cindex @sc{gdb/mi}, output syntax The output from @sc{gdb/mi} consists of zero or more out-of-band records followed, optionally, by a single result record. This result record is for the most recent command. The sequence of output records is terminated by @samp{(gdb)}. I suppose this was written before mi-async was a thing, and should be clarified. Note that further below it also says: Frontends should treat all async output as reporting general changes in the state of the target and there should be no need to associate async output to any prior command. This is what is happening in the new-ui case. The =breakpoint-created async notification is reporting about a change in the state, and it not a response to any prior MI command. Note also that this is not specific to new-ui. With regular MI, on GNU/Linux you get for example: -exec-run =thread-group-started,id="i1",pid="527" =thread-created,id="1",group-id="i1" =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffff7dd8d50",to="0x00007ffff7df5520"}] ^running *running,thread-id="all" (gdb) <<<<<<< GDB is ready to process further MI commands while the target is running =library-loaded,id="/lib64/libpthread.so.0",target-name="/lib64/libpthread.so.0",host-name="/lib64/libpthread.so.0",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffff7bbfb10",to="0x00007ffff7bcd951"}] =library-loaded,id="/lib64/libc.so.6",target-name="/lib64/libc.so.6",host-name="/lib64/libc.so.6",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffff78247d0",to="0x00007ffff796569c"}] ~"[Thread debugging using libthread_db enabled]\n" ~"Using host libthread_db library \"/lib64/libthread_db.so.1\".\n" =thread-created,id="2",group-id="i1" ~"[New Thread 0x7ffff7803700 (LWP 531)]\n" *running,thread-id="2" =thread-created,id="3",group-id="i1" ~"[New Thread 0x7ffff7002700 (LWP 532)]\n" *running,thread-id="3" Note how all those out-of-band-records (=library-loaded, =thread-created, *running, ~"foo", etc.) show up after the "(gdb)" prompt, while the target is running, and there's no (gdb) at the "end" (there's really no "end" here, since the program is running, and any sort of async events can be reported in response to whatever the target program does.) Pedro Alves