public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA] Avoid unlimited height on mingw built GDB's.
@ 2013-08-08  8:35 Pierre Muller
  2013-08-08  9:18 ` Yao Qi
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre Muller @ 2013-08-08  8:35 UTC (permalink / raw)
  To: gdb-patches

  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__)

Comments?

2013-08-08  Pierre Muller  <muller@sourceware.org>

        * src/gdb/utils.c (init_page_info): Only call tgetnum function
        if rl_get_screen_size did not return useful values.


Index: src/gdb/utils.c
===================================================================
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;
        }


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-13  8:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <"001c01ce9412$2c438df0$84caa9d0$@muller"@ics-cnrs.unistra.fr>
2013-08-09 13:59 ` [RFA] Avoid unlimited height on mingw built GDB's Eli Zaretskii
2013-08-13  8:40   ` Pierre Muller
2013-08-08  8:35 Pierre Muller
2013-08-08  9:18 ` Yao Qi
2013-08-09 14:12   ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).