Make sure terminal settings are restored before exiting
authorPatrick Palka <patrick@parcs.ath.cx>
Mon, 27 Jul 2015 15:54:07 +0000 (11:54 -0400)
committerPatrick Palka <patrick@parcs.ath.cx>
Wed, 29 Jul 2015 12:39:41 +0000 (08:39 -0400)
commit18206ca3f9367f1488cdfc1475f8da072e7e9636
tree6939220e0cab7c33bff405eb907c133f9911ebb1
parent7afa63c624ae570472381b8e35ce066bf145844a
Make sure terminal settings are restored before exiting

When exiting GDB -- whether it's via the "quit" command, via a SIGTERM,
or otherwise -- we should leave the terminal in the state we acquired
it.  To that end, we have to undo any modifications that may have been
made by the TUI (ncurses) or by the CLI (readline).

Tested on x86_64 Debian Stretch.

gdb/ChangeLog:

* top.c: Include "tui/tui.h".
(undo_terminal_modifications_before_exit): New static function.
(quit_force): Use it.

gdb/testsuite/ChangeLog:

* gdb.base/batch-preserve-term-settings.exp
(test_terminal_settings_preserved_after_cli_exit): New test.
gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/batch-preserve-term-settings.exp
gdb/top.c