Make 'show width/height' display "unlimited" when capped for readline

When we cap the height/width sizes before passing to readline, tweak
the corresponding command variable to show "unlimited":

  (gdb) set height 0x8000
  (gdb) show height
  Number of lines gdb thinks are in a page is unlimited.

Instead of the current output:
  (gdb) set height 0x8000
  (gdb) show height
  Number of lines gdb thinks are in a page is 32768.

gdb/ChangeLog:
2019-02-27  Pedro Alves  <palves@redhat.com>

	* utils.c (set_screen_size): When we cap the height/width sizes,
	tweak the corresponding command variable to show "unlimited":

gdb/testsuite/ChangeLog:
2019-02-27  Pedro Alves  <palves@redhat.com>

	* gdb.base/page.exp: Add tests for "set/show width/height" with
	"infinite" values.
This commit is contained in:
Pedro Alves 2019-02-27 18:48:36 +00:00
parent 23031e3192
commit 8ed252144a
4 changed files with 42 additions and 2 deletions

View file

@ -1394,10 +1394,16 @@ set_screen_size (void)
const int sqrt_int_max = INT_MAX >> (sizeof (int) * 8 / 2);
if (rows <= 0 || rows > sqrt_int_max)
rows = sqrt_int_max;
{
rows = sqrt_int_max;
lines_per_page = UINT_MAX;
}
if (cols <= 0 || cols > sqrt_int_max)
cols = sqrt_int_max;
{
cols = sqrt_int_max;
chars_per_line = UINT_MAX;
}
/* Update Readline's idea of the terminal size. */
rl_set_screen_size (rows, cols);