Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Marc Khouzam" <marc.khouzam@ericsson.com>
To: <gdb@sourceware.org>
Subject: [RFC] Queries and frontends
Date: Tue, 21 Jul 2009 03:18:00 -0000	[thread overview]
Message-ID: <6D19CA8D71C89C43A057926FE0D4ADAA07C00023@ecamlmw720.eamcs.ericsson.se> (raw)

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 
commands, you can disable this "feature":"

So, from the doc and from what seems (to me :-)) like the proper 
behavior, when we "set confirm off", all commands that use a query 
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 
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 
'batch mode problem' that caused this whole defaulted query thing.
Any thoughts?

Thanks

Marc

2009-07-20  Marc Khouzam  <marc.khouzam@ericsson.com>

	* utils.c (defaulted_query): Always answer "yes" when prompts
	are off.

### Eclipse Workspace Patch 1.0
#P src
Index: gdb/utils.c
===================================================================
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 = "[n]";
     }
 
-  /* 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;
 
   /* If input isn't coming from the user directly, just say what
      question we're asking, and then answer "yes" automatically.  This


             reply	other threads:[~2009-07-21  3:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21  3:18 Marc Khouzam [this message]
2009-07-21  6:13 ` Nick Roberts
2009-07-21  8:26   ` Hui Zhu
2009-07-21  8:29     ` Hui Zhu
2009-07-21 11:51       ` Nick Roberts
2009-07-22  6:11         ` Hui Zhu
2009-07-21 17:57   ` Michael Snyder
2009-07-21 18:37   ` Marc Khouzam
2009-07-21 18:55     ` Daniel Jacobowitz
2009-07-21 23:29       ` Nick Roberts
2009-07-22 13:38       ` Marc Khouzam
2009-07-26  5:04   ` Tom Tromey
2009-07-27  1:52     ` Nick Roberts
2009-07-27 16:17       ` Tom Tromey
2009-07-28  1:55         ` Nick Roberts
2009-07-29 21:13           ` Tom Tromey
2009-07-29 23:56             ` [PATCH] util.c + doc [was Re: [RFC] Queries and frontends] Nick Roberts
2009-07-30  0:28               ` Marc Khouzam
2009-07-30  3:13               ` Eli Zaretskii
2009-08-04 16:32               ` [PATCH] util.c + doc Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6D19CA8D71C89C43A057926FE0D4ADAA07C00023@ecamlmw720.eamcs.ericsson.se \
    --to=marc.khouzam@ericsson.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox