diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2015-05-21 00:45:26 +0200 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2015-05-21 20:48:34 +0200 |
commit | 880d1e40c771e4a389d0b29bf196b50f1b696ea9 (patch) | |
tree | d3815a8986be7a608113883b4de4b48f5c63f5d5 | |
parent | a014503004ad016d754bc9a4b143973ee18b0bbf (diff) | |
download | binutils-gdb-880d1e40c771e4a389d0b29bf196b50f1b696ea9.tar.gz |
gdb: Don't call tui_enable too early.
Calling tui_enable too early in tui_layout_command can leave the tui in
an enabled state if the user has entered an invalid layout name.
Instead postpone the call to tui_enable until later in
tui_set_layout_for_display_command just before the layout is changed.
gdb/ChangeLog:
* tui/tui-layout.c (tui_layout_command): Move call to tui_enable
into ...
(tui_set_layout_for_display_command): ...here, before calling
tui_set_layout. Only set the layout if gdb has not already
entered the TUI_FAILURE state.
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/tui/tui-layout.c | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 84e6b25c23a..3c80d3a247c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2015-05-21 Andrew Burgess <andrew.burgess@embecosm.com> + * tui/tui-layout.c (tui_layout_command): Move call to tui_enable + into ... + (tui_set_layout_for_display_command): ...here, before calling + tui_set_layout. Only set the layout if gdb has not already + entered the TUI_FAILURE state. + +2015-05-21 Andrew Burgess <andrew.burgess@embecosm.com> + * tui/tui-layout.c (layout_completer): New function. (_initialize_tui_layout): Set completer on layout command. diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index e3993ab9f11..abd9810c3ad 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -443,7 +443,12 @@ tui_set_layout_by_name (const char *layout_name) else status = TUI_FAILURE; - tui_set_layout (new_layout); + if (status == TUI_SUCCESS) + { + /* Make sure the curses mode is enabled. */ + tui_enable (); + tui_set_layout (new_layout); + } } xfree (buf_ptr); } @@ -492,9 +497,6 @@ extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p) static void tui_layout_command (char *arg, int from_tty) { - /* Make sure the curses mode is enabled. */ - tui_enable (); - /* Switch to the selected layout. */ if (tui_set_layout_by_name (arg) != TUI_SUCCESS) warning (_("Invalid layout specified.\n%s"), LAYOUT_USAGE); |