diff options
author | Joel Brobecker <brobecker@gnat.com> | 2011-01-21 18:56:43 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2011-01-21 18:56:43 +0000 |
commit | 7bfc943420917444b86391e4f7bf96e79150aa21 (patch) | |
tree | ab4656f486c19164b41f5f6d55822ada3ef5ccd4 /gdb/inflow.c | |
parent | 6da78614a34009388ab8af71cd26f59a451d486a (diff) | |
download | gdb-7bfc943420917444b86391e4f7bf96e79150aa21.zip gdb-7bfc943420917444b86391e4f7bf96e79150aa21.tar.gz gdb-7bfc943420917444b86391e4f7bf96e79150aa21.tar.bz2 |
move handing of "set interactive-mode" to gdb_has_a_terminal
The real purpose of this setting is really to override what the debugger
would otherwise guess from checking the stdin settings. So it seems
more natural to see this setting being handled inside gdb_has_a_terminal
rather than input_is_terminal (which checks for other things, such as
whether the input is stdin, for instance).
This patch also adjust the command help and the associated section in
the GDB Manual to be a little clearer about that.
gdb/ChangeLog:
* inflow.c: Include "gdbcmd.h".
(interactive_mode): New static global, moved here from top.c.
(show_interactive_mode): New function, moved here from top.c.
use gdb_has_a_terminal instead of input_from_terminal_p to
determine the current mode.
(gdb_has_a_terminal): Add handling of the "iteractive-mode"
setting.
(_initialize_inflow): Add the "set/show interactive-mode"
commands. Moved here from top.c, after having adjusted slightly
the help text.
* top.c (interactive_mode, show_interactive_mode): Delete, moved
to inflow.c.
(input_from_terminal_p): Remove handling of "interactive-mode"
setting, moved to infow.c.
(init_main): Remove creation of the "set/show interactive-mode"
commands, moved to inflow.c.
gdb/doc/ChangeLog:
* gdb.texinfo (Other Misc Settings): Rework part of the
documentation of the "set interactive mode" command.
Diffstat (limited to 'gdb/inflow.c')
-rw-r--r-- | gdb/inflow.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/inflow.c b/gdb/inflow.c index 65f48ba..859c74e 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -34,6 +34,7 @@ #include "gdb_select.h" #include "inflow.h" +#include "gdbcmd.h" #ifdef HAVE_SYS_IOCTL_H #include <sys/ioctl.h> @@ -141,10 +142,31 @@ enum } gdb_has_a_terminal_flag = have_not_checked; +/* The value of the "interactive-mode" setting. */ +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, gdb_has_a_terminal () ? "on" : "off"); + else + fprintf_filtered (file, "Debugger's interactive mode is %s.\n", value); +} + /* Does GDB have a terminal (on stdin)? */ int gdb_has_a_terminal (void) { + if (interactive_mode != AUTO_BOOLEAN_AUTO) + return interactive_mode = AUTO_BOOLEAN_TRUE; + switch (gdb_has_a_terminal_flag) { case yes: @@ -853,6 +875,20 @@ _initialize_inflow (void) add_info ("terminal", term_info, _("Print inferior's saved terminal status.")); + add_setshow_auto_boolean_cmd ("interactive-mode", class_support, + &interactive_mode, _("\ +Set whether GDB's standard input is a terminal."), _("\ +Show whether GDB's standard input is a terminal."), _("\ +If on, GDB assumes that standard input is a terminal. In practice, it\n\ +means that GDB should wait for the user to answer queries associated to\n\ +commands entered at the command prompt. If off, GDB assumes that standard\n\ +input is not a terminal, and uses the default answer to all queries.\n\ +If auto (the default), determine which mode to use based on the standard\n\ +input settings."), + NULL, + show_interactive_mode, + &setlist, &showlist); + terminal_is_ours = 1; /* OK, figure out whether we have job control. If neither termios nor |