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

* Re: [RFA] Avoid unlimited height on mingw built GDB's.
  2013-08-08  8:35 [RFA] Avoid unlimited height on mingw built GDB's Pierre Muller
@ 2013-08-08  9:18 ` Yao Qi
  2013-08-09 14:12   ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2013-08-08  9:18 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

On 08/08/2013 04:35 PM, Pierre Muller wrote:
> 2013-08-08  Pierre Muller<muller@sourceware.org>
>
>          * src/gdb/utils.c (init_page_info): Only call tgetnum function

Remove "src/gdb/".

>          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;

It looks suspicious to me that we assign a signed integer to a unsigned
one, but it is not related to this patch.

I don't have comments on this patch.  This issue was discussed in 2012
here http://sourceware.org/ml/gdb-patches/2012-10/msg00282.html and Eli
suggested that we can get rid of windows-termcap.c and use mingw
ncurses build for gdb, so we don't want to pursue this way?

-- 
Yao (齐尧)

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

* Re: [RFA] Avoid unlimited height on mingw built GDB's.
       [not found] <"001c01ce9412$2c438df0$84caa9d0$@muller"@ics-cnrs.unistra.fr>
@ 2013-08-09 13:59 ` Eli Zaretskii
  2013-08-13  8:40   ` Pierre Muller
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2013-08-09 13:59 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

> From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> Date: Thu, 8 Aug 2013 10:35:01 +0200
> 
>   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.

Looks good to me, thanks.

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

* Re: [RFA] Avoid unlimited height on mingw built GDB's.
  2013-08-08  9:18 ` Yao Qi
@ 2013-08-09 14:12   ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2013-08-09 14:12 UTC (permalink / raw)
  To: Yao Qi; +Cc: pierre.muller, gdb-patches

> Date: Thu, 8 Aug 2013 17:17:30 +0800
> From: Yao Qi <yao@codesourcery.com>
> CC: <gdb-patches@sourceware.org>
> 
> This issue was discussed in 2012 here
> http://sourceware.org/ml/gdb-patches/2012-10/msg00282.html and Eli
> suggested that we can get rid of windows-termcap.c and use mingw
> ncurses build for gdb, so we don't want to pursue this way?

Volunteers are welcome to do that.

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

* RE: [RFA] Avoid unlimited height on mingw built GDB's.
  2013-08-09 13:59 ` Eli Zaretskii
@ 2013-08-13  8:40   ` Pierre Muller
  0 siblings, 0 replies; 5+ messages in thread
From: Pierre Muller @ 2013-08-13  8:40 UTC (permalink / raw)
  To: 'Eli Zaretskii'; +Cc: gdb-patches

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Eli Zaretskii
> Envoyé : vendredi 9 août 2013 16:00
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFA] Avoid unlimited height on mingw built GDB's.
> 
> > From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> > Date: Thu, 8 Aug 2013 10:35:01 +0200
> >
> >   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.
> 
> Looks good to me, thanks.

  Thank you for the approval,

patch committed,

Pierre Muller

^ 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 --
2013-08-08  8:35 [RFA] Avoid unlimited height on mingw built GDB's Pierre Muller
2013-08-08  9:18 ` Yao Qi
2013-08-09 14:12   ` Eli Zaretskii
     [not found] <"001c01ce9412$2c438df0$84caa9d0$@muller"@ics-cnrs.unistra.fr>
2013-08-09 13:59 ` Eli Zaretskii
2013-08-13  8:40   ` Pierre Muller

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