When calling tui_add_win_to_layout, use tui_set_layout not show_layout
so that window focus is correctly updated. If the focus is not
correctly maintained then GDB can be crashed like this:
start
tui enable
layout asm
list SOME_FUNCTION
At this point GDB will have "popped up" the source window to
display SOME_FUNCTION. Previously no window would have focus at this
point, and so if the user now does 'focus next' or 'focus prev', then
GDB would crash.
Calling tui_set_layout ensures that focus is correctly calculated as
the source window is "popped up", and this fixes the issue.
gdb/ChangeLog:
* tui/tui-layout.c (tui_add_win_to_layout): Use tui_set_layout not
show_layout.
gdb/testsuite/ChangeLog:
* gdb.tui/list.exp: Test 'focus next' after 'list main'.
Change-Id: Id0b13f99b0e889261efedfd0adabe82020202f44
+2020-01-05 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * tui/tui-layout.c (tui_add_win_to_layout): Use tui_set_layout not
+ show_layout.
+
2020-01-05 Luis Machado <luis.machado@linaro.org>
* aarch64-linux-nat.c
2020-01-05 Luis Machado <luis.machado@linaro.org>
* aarch64-linux-nat.c
+2020-01-05 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.tui/list.exp: Test 'focus next' after 'list main'.
+
2020-01-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/style.exp: Test that warnings are styled.
2020-01-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/style.exp: Test that warnings are styled.
Term::command "list main"
Term::check_contents "list main" "21 *return 0"
Term::command "list main"
Term::check_contents "list main" "21 *return 0"
+# The following 'focus next' must be immediately after 'list main' to
+# ensure that GDB has a valid idea of what is currently focused.
+Term::command "focus next"
&& cur_layout != SRC_DATA_COMMAND)
{
if (cur_layout == DISASSEM_DATA_COMMAND)
&& cur_layout != SRC_DATA_COMMAND)
{
if (cur_layout == DISASSEM_DATA_COMMAND)
- show_layout (SRC_DATA_COMMAND);
+ tui_set_layout (SRC_DATA_COMMAND);
- show_layout (SRC_COMMAND);
+ tui_set_layout (SRC_COMMAND);
}
break;
case DISASSEM_WIN:
}
break;
case DISASSEM_WIN:
&& cur_layout != DISASSEM_DATA_COMMAND)
{
if (cur_layout == SRC_DATA_COMMAND)
&& cur_layout != DISASSEM_DATA_COMMAND)
{
if (cur_layout == SRC_DATA_COMMAND)
- show_layout (DISASSEM_DATA_COMMAND);
+ tui_set_layout (DISASSEM_DATA_COMMAND);
- show_layout (DISASSEM_COMMAND);
+ tui_set_layout (DISASSEM_COMMAND);
&& cur_layout != DISASSEM_DATA_COMMAND)
{
if (cur_layout == DISASSEM_COMMAND)
&& cur_layout != DISASSEM_DATA_COMMAND)
{
if (cur_layout == DISASSEM_COMMAND)
- show_layout (DISASSEM_DATA_COMMAND);
+ tui_set_layout (DISASSEM_DATA_COMMAND);
- show_layout (SRC_DATA_COMMAND);
+ tui_set_layout (SRC_DATA_COMMAND);