From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19350 invoked by alias); 21 Jul 2009 03:18:18 -0000 Received: (qmail 19342 invoked by uid 22791); 21 Jul 2009 03:18:17 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from imr1.ericy.com (HELO imr1.ericy.com) (198.24.6.9) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 21 Jul 2009 03:18:11 +0000 Received: from eusrcmw750.eamcs.ericsson.se (eusrcmw750.exu.ericsson.se [138.85.77.50]) by imr1.ericy.com (8.13.1/8.13.1) with ESMTP id n6L3I8r7023793 for ; Mon, 20 Jul 2009 22:18:08 -0500 Received: from ecamlmw720.eamcs.ericsson.se ([142.133.1.72]) by eusrcmw750.eamcs.ericsson.se with Microsoft SMTPSVC(6.0.3790.3959); Mon, 20 Jul 2009 22:18:04 -0500 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: [RFC] Queries and frontends Date: Tue, 21 Jul 2009 03:18:00 -0000 Message-ID: <6D19CA8D71C89C43A057926FE0D4ADAA07C00023@ecamlmw720.eamcs.ericsson.se> From: "Marc Khouzam" To: X-IsSubscribed: yes 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 X-SW-Source: 2009-07/txt/msg00150.txt.bz2 Hi, We've been having trouble with PRecord and Frontends, when using queries. The problem is that Frontends can't always handle queries properly. So here is a suggestion. First, let's mention the "set confirm off" command. The documentation at section 20.7 reads: "If you are willing to unflinchingly face the consequences of your own=20 commands, you can disable this "feature":" So, from the doc and from what seems (to me :-)) like the proper=20 behavior, when we "set confirm off", all commands that use a query=20 should simply be performed without asking the user. The current implementation of queries does not do that. Instead, it will follow the default answer of a query. Such a default answer makes sense when trying to guide the user in a choice, but when "set confirm off" we should really let the command execute. As an example, setting pending breakpoints has a default answer of 'n'. What that means (unless I'm wrong) is that with "set confirm off", pending breakpoints will NOT be set. The patch below changes defaulted_query() to always answer "yes" if 'confirm' is off. I don't think I can make the same change for input that is not from=20 a terminal because this whole nquery() yquery() was introduced to preserve behavior in batch mode, according to http://sourceware.org/ml/gdb/2004-02/msg00108.html If this is approved, it would allow frontends to simply ignore all queries and let commands be executed as requested. This would allow to use PRecord without changing any of its queries. But I'm not entirely sure about this, because of the original=20 'batch mode problem' that caused this whole defaulted query thing. Any thoughts? Thanks Marc 2009-07-20 Marc Khouzam * utils.c (defaulted_query): Always answer "yes" when prompts are off. ### Eclipse Workspace Patch 1.0 #P src Index: gdb/utils.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.213 diff -u -r1.213 utils.c --- gdb/utils.c 2 Jul 2009 17:21:07 -0000 1.213 +++ gdb/utils.c 21 Jul 2009 03:12:34 -0000 @@ -1385,7 +1385,9 @@ Ask user a y-or-n question and return 0 if answer is no, 1 if answer is yes, or default the answer to the specified default (for yquery or nquery). DEFCHAR may be 'y' or 'n' to provide a - default answer, or '\0' for no default. + default answer, or '\0' for no default. If prompts are disabled + we answer 'y' automatically; this allows the command in question + to actually be performed. CTLSTR is the control string and should end in "? ". It should not say how to answer, because we do that. ARGS are the arguments passed along with the CTLSTR argument to @@ -1427,10 +1429,9 @@ n_string =3D "[n]"; } =20 - /* Automatically answer the default value if the user did not want - prompts. */ + /* Automatically answer "yes" if the user did not want prompts. */ if (! caution) - return def_value; + return 1; =20 /* If input isn't coming from the user directly, just say what question we're asking, and then answer "yes" automatically. This