diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-12-20 15:01:29 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2023-01-25 10:50:57 +0000 |
commit | 24f3aded1d42f515527e2de7e8e9e26f0b77c932 (patch) | |
tree | 9f12fba044ed7ffeee8af28261e72f1c0ecd46a1 /gdb/tui | |
parent | 3602634035f6a346ac043a7f01442a7290b9f588 (diff) | |
download | gdb-24f3aded1d42f515527e2de7e8e9e26f0b77c932.zip gdb-24f3aded1d42f515527e2de7e8e9e26f0b77c932.tar.gz gdb-24f3aded1d42f515527e2de7e8e9e26f0b77c932.tar.bz2 |
gdb/testsuite/tui: more testing of the 'focus' command
I noticed that we didn't have many tests of the tui 'focus' command,
so I started adding some. This exposed a bug in GDB; we are able to
focus windows that should not be focusable, e.g. the 'status' window.
This is harmless until we then do 'focus next' or 'focus prev', along
this code path we assert that the currently focused window is
focusable, which obviously, is not always true, so GDB fails with an
assertion error.
The fix is simple; add a check to the tui_set_focus_command function
to ensure that the selected window is focusable. If it is not then an
error is thrown. The new tests I've added cover this case.
Diffstat (limited to 'gdb/tui')
-rw-r--r-- | gdb/tui/tui-win.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 5837200..9c08889 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -723,6 +723,9 @@ tui_set_focus_command (const char *arg, int from_tty) if (!win_info->is_visible ()) error (_("Window \"%s\" is not visible"), arg); + if (!win_info->can_focus ()) + error (_("Window \"%s\" cannot be focused"), arg); + tui_set_win_focus_to (win_info); gdb_printf (_("Focus set to %s window.\n"), tui_win_with_focus ()->name ()); |