diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-02-01 10:28:18 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2022-04-03 15:31:47 +0100 |
commit | b0fcf3e344438a4d115afdfaa7468bf90cc8c880 (patch) | |
tree | 0fb6d17444f09f11cbc316f10a5e4dbfc7147ffe /gdb/testsuite | |
parent | 47b8e12ffd0ecf924836aed55eb63b9e5d9e8ea1 (diff) | |
download | gdb-b0fcf3e344438a4d115afdfaa7468bf90cc8c880.zip gdb-b0fcf3e344438a4d115afdfaa7468bf90cc8c880.tar.gz gdb-b0fcf3e344438a4d115afdfaa7468bf90cc8c880.tar.bz2 |
gdb/tui: fairer distribution of excess space during apply
When applying layouts gdb computes the size of each window (or rather,
each sub-layout within a layout) using integer arithmetic. As this
rounds down the results, then, when all sub-layouts are sized, there
is the possibility that we have some space left over.
Currently, this space is just assigned to an arbitrary sub-layout.
This can result in some unbalanced results. Consider this set of
steps with current master:
(gdb) tui enable
(gdb) layout regs
(gdb) info win
Name Lines Columns Focus
regs 7 80
src 9 80 (has focus)
status 1 80
cmd 8 80
Notice the weird split between the src and regs windows, the original
layout specification has these windows given equal weight. The
problem is that, with rounding, both the regs and src windows are
initially sized to 7, the extra 2 lines are then arbitrarily added to
the src window.
In this commit, rather than add all the extra space to one single
window, I instead hand out the extra space 1 line at a time, looping
over all the sub-layouts. We take care to respect the min/max sizes,
and so, we now get this result:
(gdb) tui enable
(gdb) layout regs
(gdb) info win
Name Lines Columns Focus
regs 8 80
src 8 80 (has focus)
status 1 80
cmd 8 80
This looks more natural to me.
This is obviously a change in behaviour, and so, lots of the existing
tests need to be updated to take this into account. None of the
changes are huge, it's just a line or two (or column for width) moved
between windows.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/gdb.tui/basic.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.tui/empty.exp | 14 | ||||
-rw-r--r-- | gdb/testsuite/gdb.tui/regs.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.tui/winwidth.exp | 17 |
4 files changed, 22 insertions, 17 deletions
diff --git a/gdb/testsuite/gdb.tui/basic.exp b/gdb/testsuite/gdb.tui/basic.exp index 0e9f2e3..7afb28b 100644 --- a/gdb/testsuite/gdb.tui/basic.exp +++ b/gdb/testsuite/gdb.tui/basic.exp @@ -104,5 +104,5 @@ Term::command "layout split" Term::check_contents "split layout contents" \ "$main_line *$main_re.*$hex <main>" -Term::check_box "source box in split layout" 0 0 80 7 -Term::check_box "asm box in split layout" 0 6 80 9 +Term::check_box "source box in split layout" 0 0 80 8 +Term::check_box "asm box in split layout" 0 7 80 8 diff --git a/gdb/testsuite/gdb.tui/empty.exp b/gdb/testsuite/gdb.tui/empty.exp index ef14fe4..3efa55d 100644 --- a/gdb/testsuite/gdb.tui/empty.exp +++ b/gdb/testsuite/gdb.tui/empty.exp @@ -35,26 +35,26 @@ if {![Term::enter_tui]} { set layouts { {src src {{0 0 80 15}} {{0 0 90 26}} {{"no source" "No Source Available"}}} - {regs src-regs {{0 0 80 7} {0 6 80 9}} {{0 0 90 13} {0 12 90 13}} + {regs src-regs {{0 0 80 8} {0 7 80 8}} {{0 0 90 13} {0 12 90 13}} { {"no source" "No Source Available"} {"no regs" "Register Values Unavailable"} }} - {asm asm {{0 0 80 13}} {{0 0 90 26}} + {asm asm {{0 0 80 15}} {{0 0 90 26}} { {"no asm" "No Assembly Available"} }} - {regs asm-regs {{0 0 80 7} {0 6 80 9}} {{0 0 90 13} {0 12 90 13}} + {regs asm-regs {{0 0 80 8} {0 7 80 8}} {{0 0 90 13} {0 12 90 13}} { {"no asm" "No Assembly Available"} {"no regs" "Register Values Unavailable"} }} - {split split {{0 0 80 6} {0 5 80 8}} {{0 0 90 13} {0 12 90 13}} + {split split {{0 0 80 8} {0 7 80 8}} {{0 0 90 13} {0 12 90 13}} { {"no source" "No Source Available"} {"no asm" "No Assembly Available"} }} - {regs split-regs {{0 0 80 6} {0 5 80 8}} {{0 0 90 13} {0 12 90 13}} + {regs split-regs {{0 0 80 8} {0 7 80 8}} {{0 0 90 13} {0 12 90 13}} { {"no asm" "No Assembly Available"} {"no regs" "Register Values Unavailable"} @@ -97,5 +97,9 @@ foreach layout $layouts { check_text $text_list } Term::resize 24 80 + with_test_prefix "80x24 again" { + check_boxes $small_boxes + check_text $text_list + } } } diff --git a/gdb/testsuite/gdb.tui/regs.exp b/gdb/testsuite/gdb.tui/regs.exp index 178eba0..2f3482f 100644 --- a/gdb/testsuite/gdb.tui/regs.exp +++ b/gdb/testsuite/gdb.tui/regs.exp @@ -38,8 +38,8 @@ if {![Term::enter_tui]} { Term::check_contents "source at startup" "\\|.*21 *return 0" Term::command "layout regs" -Term::check_box "register box" 0 0 80 7 -Term::check_box "source box in regs layout" 0 6 80 9 +Term::check_box "register box" 0 0 80 8 +Term::check_box "source box in regs layout" 0 7 80 8 set text [Term::get_line 1] # Just check for any register window content at all. diff --git a/gdb/testsuite/gdb.tui/winwidth.exp b/gdb/testsuite/gdb.tui/winwidth.exp index b0a838b..1767b25 100644 --- a/gdb/testsuite/gdb.tui/winwidth.exp +++ b/gdb/testsuite/gdb.tui/winwidth.exp @@ -39,24 +39,25 @@ with_test_prefix "original window sizes" { } with_test_prefix "after src +5" { - Term::check_box "source box" 0 0 44 15 - Term::check_box "asm box" 43 0 37 15 + Term::check_box "source box" 0 0 45 15 + Term::check_box "asm box" 44 0 36 15 Term::command "winwidth asm -5" } with_test_prefix "after asm -5" { - Term::check_box "source box" 0 0 48 15 - Term::check_box "asm box" 47 0 33 15 + Term::dump_screen + Term::check_box "source box" 0 0 50 15 + Term::check_box "asm box" 49 0 31 15 Term::command "winwidth asm +8" } with_test_prefix "after asm +8" { - Term::check_box "source box" 0 0 39 15 - Term::check_box "asm box" 38 0 42 15 + Term::check_box "source box" 0 0 42 15 + Term::check_box "asm box" 41 0 39 15 Term::command "winwidth src -2" } with_test_prefix "after src -2" { - Term::check_box "source box" 0 0 36 15 - Term::check_box "asm box" 35 0 45 15 + Term::check_box "source box" 0 0 40 15 + Term::check_box "asm box" 39 0 41 15 } |