* [RFA/doco] document "set/show interactive-mode"
@ 2009-06-23 18:13 Joel Brobecker
2009-09-09 18:04 ` PING: " Joel Brobecker
0 siblings, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2009-06-23 18:13 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]
Eli,
Here is a documentation update for the patch suggested at:
http://www.sourceware.org/ml/gdb-patches/2009-06/msg00403.html
The patch just adds a setting that allows the user to override
the guessing that GDB does in order to determine whether it should
run in interactive or non-interactive mode.
I'm also attaching the code patch, in case you have some comments
about the option and its help documentation itself.
2009-06-23 Joel Brobecker <brobecker@adacore.com>
* gdb.texinfo (Other Misc Settings): New node.
I tried to find a good place for it, but nothing really seemed
appropriate. Peharps if we renamed the "Screen Size" section
to be a little more generic, we could put our new option there.
But it seemed a little artificial, and might make finding these
screen-size related option a little harder to find. Since the latter
will probably be much more widely used, I didn't think it was the
best thing to do. Hence the new "misc" section.
OK to apply?
Thanks,
--
Joel
[-- Attachment #2: tc-interactive.diff --]
[-- Type: text/x-diff, Size: 1763 bytes --]
commit 1c0d02ae504f32e2728723f62d6b1c290c9c12b0
Author: Joel Brobecker <brobecker@adacore.com>
Date: Tue Jun 23 10:32:56 2009 -0700
Add documentation for set/show interactive-mode.
* gdb.texinfo (Other Misc Settings): New node.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 94852ec..f8e77e0 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -17392,6 +17392,7 @@ described here.
* ABI:: Configuring the current ABI
* Messages/Warnings:: Optional warnings and messages
* Debugging Output:: Optional messages about internal happenings
+* Other Misc Settings:: Other Miscellaneous Settings
@end menu
@node Prompt
@@ -18021,6 +18022,28 @@ Turns on or off debugging messages for built-in XML parsers.
Displays the current state of XML debugging messages.
@end table
+@node Other Misc Settings
+@section Other Miscellaneous Settings
+@cindex Miscellaneous Settings
+
+@table @code
+@kindex set interactive-mode
+@item set interactive-mode
+If @code{on}, forces @value{GDBN} to operate interactively.
+If @code{off}, forces @value{GDBN} to operate non-interactively,
+If @code{auto} (the default), @value{GDBN} guesses which mode to use,
+based on whether the debugger was started in a terminal or not.
+
+In the vast majority of cases, the debugger should be able to guess
+correctly which mode should be used. But this setting can be useful
+in certain specific cases, such as running a MinGW @value{GDBN}
+inside a cygwin window.
+
+@kindex show interactive-mode
+@item show interactive-mode
+Displays whether the debugger is operating in interactive mode or not.
+@end table
+
@node Extending GDB
@chapter Extending @value{GDBN}
@cindex extending GDB
[-- Attachment #3: interactive.diff --]
[-- Type: text/x-diff, Size: 2587 bytes --]
Index: top.c
===================================================================
--- top.c (.../branches/gdb/FSF/current/gdb/top.c) (revision 149871)
+++ top.c (.../trunk/gdb/gdb-head/gdb/top.c) (revision 149871)
@@ -1288,12 +1308,38 @@ quit_force (char *args, int from_tty)
exit (exit_code);
}
+/* If OFF, the debugger will run in non-interactive mode, which means
+ that it will automatically select the default answer to all the
+ queries made to the user. If ON, gdb will wait for the user to
+ answer all queries. If AUTO, gdb will determine whether to run
+ in interactive mode or not depending on whether stdin is a terminal
+ or not. */
+static enum auto_boolean interactive_mode = AUTO_BOOLEAN_AUTO;
+
+/* Implement the "show interactive-mode" option. */
+
+static void
+show_interactive_mode (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ if (interactive_mode == AUTO_BOOLEAN_AUTO)
+ fprintf_filtered (file, "\
+Debugger's interactive mode is %s (currently %s).\n",
+ value, input_from_terminal_p () ? "on" : "off");
+ else
+ fprintf_filtered (file, "Debugger's interactive mode is %s.\n", value);
+}
+
/* Returns whether GDB is running on a terminal and input is
currently coming from that terminal. */
int
input_from_terminal_p (void)
{
+ if (interactive_mode != AUTO_BOOLEAN_AUTO)
+ return interactive_mode == AUTO_BOOLEAN_TRUE;
+
if (gdb_has_a_terminal () && instream == stdin)
return 1;
@@ -1625,6 +1675,19 @@ Use \"on\" to enable the notification, a
show_exec_done_display_p,
&setlist, &showlist);
+ add_setshow_auto_boolean_cmd ("interactive-mode", class_support,
+ &interactive_mode, _("\
+Set whether gdb should run in interactive mode or not"), _("\
+Show whether gdb runs in interactive mode"), _("\
+If on, gdb runs in interactive mode and waits for the user to answer\n\
+all its queries. If off, gdb runs in non-interactive mode and\n\
+automatically assumes the default answer to all its queries. If auto\n\
+(which is the default), automatically determine which mode to use based\n\
+on the standard input settings"),
+ NULL,
+ show_interactive_mode,
+ &setlist, &showlist);
+
add_setshow_filename_cmd ("data-directory", class_maintenance,
&gdb_datadir, _("Set GDB's data directory."),
_("Show GDB's data directory."),
^ permalink raw reply [flat|nested] 6+ messages in thread* PING: [RFA/doco] document "set/show interactive-mode"
2009-06-23 18:13 [RFA/doco] document "set/show interactive-mode" Joel Brobecker
@ 2009-09-09 18:04 ` Joel Brobecker
2009-09-09 19:17 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2009-09-09 18:04 UTC (permalink / raw)
To: gdb-patches
Looks like this one fell through the cracks. Eli, what do you think?
Thanks!
On Tue, Jun 23, 2009 at 11:13:41AM -0700, Joel Brobecker wrote:
> Eli,
>
> Here is a documentation update for the patch suggested at:
> http://www.sourceware.org/ml/gdb-patches/2009-06/msg00403.html
>
> The patch just adds a setting that allows the user to override
> the guessing that GDB does in order to determine whether it should
> run in interactive or non-interactive mode.
>
> I'm also attaching the code patch, in case you have some comments
> about the option and its help documentation itself.
>
> 2009-06-23 Joel Brobecker <brobecker@adacore.com>
>
> * gdb.texinfo (Other Misc Settings): New node.
>
> I tried to find a good place for it, but nothing really seemed
> appropriate. Peharps if we renamed the "Screen Size" section
> to be a little more generic, we could put our new option there.
> But it seemed a little artificial, and might make finding these
> screen-size related option a little harder to find. Since the latter
> will probably be much more widely used, I didn't think it was the
> best thing to do. Hence the new "misc" section.
>
> OK to apply?
>
> Thanks,
> --
> Joel
> commit 1c0d02ae504f32e2728723f62d6b1c290c9c12b0
> Author: Joel Brobecker <brobecker@adacore.com>
> Date: Tue Jun 23 10:32:56 2009 -0700
>
> Add documentation for set/show interactive-mode.
>
> * gdb.texinfo (Other Misc Settings): New node.
>
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 94852ec..f8e77e0 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -17392,6 +17392,7 @@ described here.
> * ABI:: Configuring the current ABI
> * Messages/Warnings:: Optional warnings and messages
> * Debugging Output:: Optional messages about internal happenings
> +* Other Misc Settings:: Other Miscellaneous Settings
> @end menu
>
> @node Prompt
> @@ -18021,6 +18022,28 @@ Turns on or off debugging messages for built-in XML parsers.
> Displays the current state of XML debugging messages.
> @end table
>
> +@node Other Misc Settings
> +@section Other Miscellaneous Settings
> +@cindex Miscellaneous Settings
> +
> +@table @code
> +@kindex set interactive-mode
> +@item set interactive-mode
> +If @code{on}, forces @value{GDBN} to operate interactively.
> +If @code{off}, forces @value{GDBN} to operate non-interactively,
> +If @code{auto} (the default), @value{GDBN} guesses which mode to use,
> +based on whether the debugger was started in a terminal or not.
> +
> +In the vast majority of cases, the debugger should be able to guess
> +correctly which mode should be used. But this setting can be useful
> +in certain specific cases, such as running a MinGW @value{GDBN}
> +inside a cygwin window.
> +
> +@kindex show interactive-mode
> +@item show interactive-mode
> +Displays whether the debugger is operating in interactive mode or not.
> +@end table
> +
> @node Extending GDB
> @chapter Extending @value{GDBN}
> @cindex extending GDB
> Index: top.c
> ===================================================================
> --- top.c (.../branches/gdb/FSF/current/gdb/top.c) (revision 149871)
> +++ top.c (.../trunk/gdb/gdb-head/gdb/top.c) (revision 149871)
> @@ -1288,12 +1308,38 @@ quit_force (char *args, int from_tty)
> exit (exit_code);
> }
>
> +/* If OFF, the debugger will run in non-interactive mode, which means
> + that it will automatically select the default answer to all the
> + queries made to the user. If ON, gdb will wait for the user to
> + answer all queries. If AUTO, gdb will determine whether to run
> + in interactive mode or not depending on whether stdin is a terminal
> + or not. */
> +static enum auto_boolean interactive_mode = AUTO_BOOLEAN_AUTO;
> +
> +/* Implement the "show interactive-mode" option. */
> +
> +static void
> +show_interactive_mode (struct ui_file *file, int from_tty,
> + struct cmd_list_element *c,
> + const char *value)
> +{
> + if (interactive_mode == AUTO_BOOLEAN_AUTO)
> + fprintf_filtered (file, "\
> +Debugger's interactive mode is %s (currently %s).\n",
> + value, input_from_terminal_p () ? "on" : "off");
> + else
> + fprintf_filtered (file, "Debugger's interactive mode is %s.\n", value);
> +}
> +
> /* Returns whether GDB is running on a terminal and input is
> currently coming from that terminal. */
>
> int
> input_from_terminal_p (void)
> {
> + if (interactive_mode != AUTO_BOOLEAN_AUTO)
> + return interactive_mode == AUTO_BOOLEAN_TRUE;
> +
> if (gdb_has_a_terminal () && instream == stdin)
> return 1;
>
> @@ -1625,6 +1675,19 @@ Use \"on\" to enable the notification, a
> show_exec_done_display_p,
> &setlist, &showlist);
>
> + add_setshow_auto_boolean_cmd ("interactive-mode", class_support,
> + &interactive_mode, _("\
> +Set whether gdb should run in interactive mode or not"), _("\
> +Show whether gdb runs in interactive mode"), _("\
> +If on, gdb runs in interactive mode and waits for the user to answer\n\
> +all its queries. If off, gdb runs in non-interactive mode and\n\
> +automatically assumes the default answer to all its queries. If auto\n\
> +(which is the default), automatically determine which mode to use based\n\
> +on the standard input settings"),
> + NULL,
> + show_interactive_mode,
> + &setlist, &showlist);
> +
> add_setshow_filename_cmd ("data-directory", class_maintenance,
> &gdb_datadir, _("Set GDB's data directory."),
> _("Show GDB's data directory."),
--
Joel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: PING: [RFA/doco] document "set/show interactive-mode"
2009-09-09 18:04 ` PING: " Joel Brobecker
@ 2009-09-09 19:17 ` Eli Zaretskii
2009-09-10 0:58 ` Joel Brobecker
0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2009-09-09 19:17 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
> Date: Wed, 9 Sep 2009 11:03:55 -0700
> From: Joel Brobecker <brobecker@adacore.com>
>
> Looks like this one fell through the cracks.
Yes, sorry. It was sitting in my inbox all this time.
> +@cindex Miscellaneous Settings
Index entries should not use capital letters in simple words. Our
convention is to use only lower-case text.
> + add_setshow_auto_boolean_cmd ("interactive-mode", class_support,
> + &interactive_mode, _("\
> +Set whether gdb should run in interactive mode or not"), _("\
"gdb" or "GDB"?
> +If on, gdb runs in interactive mode and waits for the user to answer\n\
> +all its queries. If off, gdb runs in non-interactive mode and\n\
> +automatically assumes the default answer to all its queries. If auto\n\
> +(which is the default), automatically determine which mode to use based\n\
> +on the standard input settings"),
A couple of minor stylistic comments:
. For "on" and "off", you use "gdb runs", but for "auto" you say
"automatically determine", which is inconsistent. "gdb determines"
in the latter case or "run" in the former case is more consistent.
(I like the second alternative better, as it's more concise.)
. I would lose the "automatically" part in the last sentence, since
"auto" already says that.
Finally, what about NEWS?
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: PING: [RFA/doco] document "set/show interactive-mode"
2009-09-09 19:17 ` Eli Zaretskii
@ 2009-09-10 0:58 ` Joel Brobecker
2009-09-10 3:14 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2009-09-10 0:58 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 172 bytes --]
Hi Eli,
Thanks for the super-fast reply. Here is a new version which hopefully
addresses all your comments (and adds a NEWS entry). Does it look
better?
Thanks,
--
Joel
[-- Attachment #2: interactive.diff --]
[-- Type: text/x-diff, Size: 5249 bytes --]
commit d58a0dcbec3bc69d86509c2c5bc30642be11dffe
Author: Joel Brobecker <brobecker@adacore.com>
Date: Wed Sep 9 17:39:10 2009 -0700
gdb/:
* top.c (interactive_mode): New static variable.
(show_interactive_mode): New function.
(input_from_terminal_p): If interactive_mode is not auto, then
use that rather than checking the stdin settings.
(init_main): Add "set/show interactive-mode" command.
* NEWS: Add entry for new "set/show interactive-mode" command.
gdb/doc/:
Add documentation for set/show interactive-mode.
* gdb.texinfo (Other Misc Settings): New node.
diff --git a/gdb/NEWS b/gdb/NEWS
index e3e6774..14da6c8 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -400,6 +400,14 @@ show stack-cache
performance of remote debugging (particularly backtraces) without
affecting correctness.
+set interactive-mode (on|off|auto)
+show interactive-mode
+ Control whether GDB runs in interactive mode (on) or not (off).
+ When in interactive mode, GDB waits for the user to answer all
+ queries. Otherwise, GDB does not wait and assumes the default
+ answer. When set to auto (the default), GDB determines which
+ mode to use based on the stdin settings.
+
* Removed commands
info forks
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 52ead12..7b26675 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -17620,6 +17620,7 @@ described here.
* ABI:: Configuring the current ABI
* Messages/Warnings:: Optional warnings and messages
* Debugging Output:: Optional messages about internal happenings
+* Other Misc Settings:: Other Miscellaneous Settings
@end menu
@node Prompt
@@ -18250,6 +18251,28 @@ Turns on or off debugging messages for built-in XML parsers.
Displays the current state of XML debugging messages.
@end table
+@node Other Misc Settings
+@section Other Miscellaneous Settings
+@cindex miscellaneous settings
+
+@table @code
+@kindex set interactive-mode
+@item set interactive-mode
+If @code{on}, forces @value{GDBN} to operate interactively.
+If @code{off}, forces @value{GDBN} to operate non-interactively,
+If @code{auto} (the default), @value{GDBN} guesses which mode to use,
+based on whether the debugger was started in a terminal or not.
+
+In the vast majority of cases, the debugger should be able to guess
+correctly which mode should be used. But this setting can be useful
+in certain specific cases, such as running a MinGW @value{GDBN}
+inside a cygwin window.
+
+@kindex show interactive-mode
+@item show interactive-mode
+Displays whether the debugger is operating in interactive mode or not.
+@end table
+
@node Extending GDB
@chapter Extending @value{GDBN}
@cindex extending GDB
diff --git a/gdb/top.c b/gdb/top.c
index b98fa9a..1b4aa9d 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1318,12 +1318,38 @@ quit_force (char *args, int from_tty)
exit (exit_code);
}
+/* If OFF, the debugger will run in non-interactive mode, which means
+ that it will automatically select the default answer to all the
+ queries made to the user. If ON, gdb will wait for the user to
+ answer all queries. If AUTO, gdb will determine whether to run
+ in interactive mode or not depending on whether stdin is a terminal
+ or not. */
+static enum auto_boolean interactive_mode = AUTO_BOOLEAN_AUTO;
+
+/* Implement the "show interactive-mode" option. */
+
+static void
+show_interactive_mode (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ if (interactive_mode == AUTO_BOOLEAN_AUTO)
+ fprintf_filtered (file, "\
+Debugger's interactive mode is %s (currently %s).\n",
+ value, input_from_terminal_p () ? "on" : "off");
+ else
+ fprintf_filtered (file, "Debugger's interactive mode is %s.\n", value);
+}
+
/* Returns whether GDB is running on a terminal and input is
currently coming from that terminal. */
int
input_from_terminal_p (void)
{
+ if (interactive_mode != AUTO_BOOLEAN_AUTO)
+ return interactive_mode == AUTO_BOOLEAN_TRUE;
+
if (gdb_has_a_terminal () && instream == stdin)
return 1;
@@ -1655,6 +1681,18 @@ Use \"on\" to enable the notification, and \"off\" to disable it."),
show_exec_done_display_p,
&setlist, &showlist);
+ add_setshow_auto_boolean_cmd ("interactive-mode", class_support,
+ &interactive_mode, _("\
+Set whether GDB should run in interactive mode or not"), _("\
+Show whether GDB runs in interactive mode"), _("\
+If on, run in interactive mode and wait for the user to answer\n\
+all queries. If off, run in non-interactive mode and automatically\n\
+assume the default answer to all queries. If auto (the default),\n\
+determine which mode to use based on the standard input settings"),
+ NULL,
+ show_interactive_mode,
+ &setlist, &showlist);
+
add_setshow_filename_cmd ("data-directory", class_maintenance,
&gdb_datadir, _("Set GDB's data directory."),
_("Show GDB's data directory."),
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-09-10 18:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-23 18:13 [RFA/doco] document "set/show interactive-mode" Joel Brobecker
2009-09-09 18:04 ` PING: " Joel Brobecker
2009-09-09 19:17 ` Eli Zaretskii
2009-09-10 0:58 ` Joel Brobecker
2009-09-10 3:14 ` Eli Zaretskii
2009-09-10 18:58 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox