From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54438 invoked by alias); 2 Nov 2019 10:35:19 -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 54426 invoked by uid 89); 2 Nov 2019 10:35:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,HTML_MESSAGE,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=robert, interactive, Terminal, Robert X-HELO: mail-qt1-f172.google.com Received: from mail-qt1-f172.google.com (HELO mail-qt1-f172.google.com) (209.85.160.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 02 Nov 2019 10:35:17 +0000 Received: by mail-qt1-f172.google.com with SMTP id c26so16500362qtj.10 for ; Sat, 02 Nov 2019 03:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasko-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZezFmmGDj+dZGXhxTbnfrdEB8B3ttIoePG4j2HsqweQ=; b=MTsre/MKijQ+Jii+8nYRMCnQgzoyU28ADZgqwh+uCYVyYowFiUVczMQYQlgR6zbXeI 3b0vKT5tarcfjWZNyKB8Ytwum7R4eVn+PXHV3+K9LPWI9YzhSxarKqmctLW45cdv6e2m deaO1YCMEtOIUIuft+jwbjp0klTM8OWAzlf0PFCSWrey8iAq+t5ayaq8uI0Gbf2wS7Es WfWC/PjJ+aa1lyiGB5nFPkRBsykH9wXn+CX04qSsGbjImRJYzTw+tohX+w1uHuG0TQ91 qZUeGJKVr02G9cdYbsJrS6I6q0twLujxrECpTRY1ARFmVm7Qnw9OEnBtTgSR2Z29bK+7 hp6A== MIME-Version: 1.0 References: <12814f17-0c65-e214-7e68-3214d3ed6ab6@redhat.com> In-Reply-To: <12814f17-0c65-e214-7e68-3214d3ed6ab6@redhat.com> From: Robert Rossi Date: Sat, 02 Nov 2019 10:35:00 -0000 Message-ID: Subject: Re: gdb/mi, new-ui. the console and determining when GDB is ready for the next command To: Pedro Alves Cc: GDB Development Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-11/txt/msg00006.txt.bz2 Huh. Here is my setup. $ gdb --version GNU gdb (GDB) 8.3.1 On terminal one with gdb I have, $ gdb -q -ex "new-ui mi /dev/pts/11" ./test_main Reading symbols from ./test_main... New UI allocated (gdb) Terminal 2 shows $ tty /dev/pts/13 $ sleep 1000 =thread-group-added,id="i1" (gdb) <--- Good So far everything is good. Now in terminal one I make a breakpoint. Terminal 1 shows (gdb) b main Breakpoint 1 at 0x4006c0: file test.cpp, line 42. (gdb) Terminal 2 shows (gdb) =breakpoint-created,bkpt={number="1",type="breakpoint",...,original-location="main"} <--- No GDB prompt However it has no gdb prompt. Now, if I run the program, Terminal 1 shows, (gdb) r Starting program:.../test_main Breakpoint 1, main (argc=1, argv=0x7fffffffdea8) at test.cpp:42 42 { (gdb) Terminal 2 shows =thread-group-started,id="i1",pid="25913" =thread-created,id="1",group-id="i1" =library-loaded,id=... =library-loaded,id="/lib/x86_6.... ~"\n" ~"Breakpoint 1, main (argc=1, argv=0x7fffffffdea8) at test.cpp:42\n" ~"42\t{\n" *stopped,reason="breakpoint-hit",...stopped-threads="all",core="0" <-- No GDB prompt In this case also there is no gdb prompt. Is this expected behavior or an oversight? Thanks, Bob Rossi On Tue, Oct 29, 2019 at 9:21 AM Pedro Alves wrote: > On 10/23/19 12:15 AM, Robert Rossi wrote: > > Hi, > > > > The question I have is, how are people determining when GDB is ready for > > the next > > command when using the new-ui feature of GDB? > > Are people parsing the CLI window for (gdb)? > > Am I missing something obvious? > > > > CGDB has historically used annotations to communicate with gdb. > > This provided pre-prompt and post-prompt annotations to determine when > the > > GDB prompt > > was available and ready for the next command. > > > > A couple of years ago I decided to try to port CGDB from annotations to > MI. > > At the time I asked the GDB mailing list how to determine when GDB was > > ready for the next > > command, Pedro Alves wrote: > > GDB is ready for input when it prints the MI prompt. There's one > > prompt that is > > already printed after ^running that you should ignore. That's an > > historical wart. > > I got CGDB working but never completed the activity when I realized that > > using -i=mi > > caused GDB to no longer treat the terminal as an interactive terminal. > > Meaning, GDB wouldn't do tab completion and/or ask the user if they were > > ready to quit. > > > > Now I'm considering trying this again using the GDB new-ui feature. > > In this mode the CLI remains in the starting terminal and the MI is moved > > to the new-ui tty. > > I noticed that in the new-ui window, the MI end token (gdb)\n isn't put > > out. Is this intentional? > > In this mode, what's the proper way to determine if GDB is ready for > > another command? > > I'm not sure what you mean -- I see the end token being put out? > > Thanks, > Pedro Alves > >