From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41453 invoked by alias); 22 Apr 2015 19:25:25 -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 41411 invoked by uid 89); 22 Apr 2015 19:25:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 22 Apr 2015 19:25:24 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 27C05116368; Wed, 22 Apr 2015 15:25:22 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id aSWtuMO82V13; Wed, 22 Apr 2015 15:25:22 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id D3BAB116367; Wed, 22 Apr 2015 15:25:21 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 7FDF640EAD; Wed, 22 Apr 2015 12:25:22 -0700 (PDT) Date: Wed, 22 Apr 2015 19:25:00 -0000 From: Joel Brobecker To: vladimir@codesourcery.com, gdb-patches@sourceware.org Cc: Pierre-Marie de Rodat Subject: GDB/MI interactive capability? Message-ID: <20150422192522.GM4764@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2015-04/txt/msg00836.txt.bz2 Vladimir, All, A question that I was asked by the IDE Team at AdaCore, who is trying to transition to using GDB/MI instead of CLI + annotations. Consider a program where we have multiple functions having the same name (In our case "foo"). In CLI mode, evaluating an expression referencing one of those functions results in a multiple-choice menu being printed, asking for the user to select the one he meant us to call. Eg: (gdb) p foo(null) Multiple matches for foo [0] cancel [1] foo.foo at foo.adb:9 [2] foo.foo at foo.adb:19 Ideally, we'd like to have the same behavior when using the GDB/MI protocol, and be able to query the user. Do you think we could enhance the protocol that way? For instance ("->" means we send to GDB, and "<-" means we receive from GDB): -> -data-evaluate-expression foo(null) <- ^user-input-needed,id=NNN,choices=[ {number=0, description='cancel'}, {number=1, description='foo.foo at foo.adb:9'}, {number=2, description='foo.foo at foo.adb:19}] The id=NNN would just be a way to identify each user query, and would be used to identify which query the user's answer is for. We'd answer the query as follow: -> -user-input NNNN ANSWER <- ^done,[as usual] This is just thinking out loud. I'm not even sure whether it'll be all that easy to implement this idea, especially if we want GDB to remain responsive (Eg, to perform other operations and therefore send other GDB/MI commands) while waiting for the user's answer. Another idea, which might be easier to implement, would be to use a two-step approach where the first step is to return an error that shows the various choices the user can choose, have the IDE use that to query the user, and then have the IDE resubmit the expression evaluation, this time with the choice given by the user. WDYT? -- Joel