This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
[RFC] Queries and frontends
- From: "Marc Khouzam" <marc dot khouzam at ericsson dot com>
- To: <gdb at sourceware dot org>
- Date: Mon, 20 Jul 2009 23:15:53 -0400
- Subject: [RFC] Queries and frontends
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