This is the mail archive of the
mailing list for the GDB project.
[RFA] Avoid unlimited height on mingw built GDB's.
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: <gdb-patches at sourceware dot org>
- Date: Thu, 8 Aug 2013 10:35:01 +0200
- Subject: [RFA] Avoid unlimited height on mingw built GDB's.
Mingw builds are using windows-termcap.c source
to allow compilation despite the fact that there
is often no termcap library for mingw.
The stub tgetnum function returns -1 unconditionally,
this leads to the screen height being set to unlimited
in init_page_info function.
Before this, lines_per_page was set correctly
by the call to rl_get_screen_size.
The patch simply avoid checking tgetnum ("li") if
the rows parameter was set to a positive value.
I do not know if this patch may have
an adverse effect on other systems, but I have a hard time
to imagine case where a function tgetnum would return -1
while rl_get_screen_size returns a positive value.
If there are useful case for which this can happen, we
could also restrict this change to
#ifdef _WIN32 (or #ifdef __MINGW32__)
2013-08-08 Pierre Muller <email@example.com>
* src/gdb/utils.c (init_page_info): Only call tgetnum function
if rl_get_screen_size did not return useful values.
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.305
diff -u -p -r1.305 utils.c
--- src/gdb/utils.c 1 Aug 2013 09:09:58 -0000 1.305
+++ src/gdb/utils.c 7 Aug 2013 12:56:49 -0000
@@ -1660,12 +1660,16 @@ init_page_info (void)
lines_per_page = rows;
chars_per_line = cols;
- /* Readline should have fetched the termcap entry for us. */
- if (tgetnum ("li") < 0 || getenv ("EMACS"))
+ /* Readline should have fetched the termcap entry for us.
+ Only try to use tgetnum function if rl_get_screen_size
+ did not return a useful value. */
+ if (((rows <= 0) && (tgetnum ("li") < 0))
+ /* Also disable paging if inside EMACS. */
+ || getenv ("EMACS"))
- /* The number of lines per page is not mentioned in the
- terminal description. This probably means that paging is
- not useful (e.g. emacs shell window), so disable paging. */
+ /* The number of lines per page is not mentioned in the terminal
+ description or EMACS evironment variable is set. This probably
+ means that paging is not useful, so disable paging. */
lines_per_page = UINT_MAX;