diff options
author | Joel Brobecker <brobecker@gnat.com> | 2009-09-10 18:56:45 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2009-09-10 18:56:45 +0000 |
commit | 910c5da8fe593c019c041bb7df5760494d6270b2 (patch) | |
tree | 0776efa1eb507cf2af5999160f91c1c878c7b6d6 /gdb | |
parent | 800f6ec8e25806362f05460ed0e8804b60a59960 (diff) | |
download | gdb-910c5da8fe593c019c041bb7df5760494d6270b2.zip gdb-910c5da8fe593c019c041bb7df5760494d6270b2.tar.gz gdb-910c5da8fe593c019c041bb7df5760494d6270b2.tar.bz2 |
* 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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/NEWS | 8 | ||||
-rw-r--r-- | gdb/top.c | 38 |
3 files changed, 55 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4c1d348..e7b2748 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,14 @@ 2009-09-10 Joel Brobecker <brobecker@adacore.com> + * 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. + +2009-09-10 Joel Brobecker <brobecker@adacore.com> + * configure.ac: Fix the names of the python source and object files following the renaming done in an earlier change. * configure: Regenerate. @@ -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 @@ -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."), |