From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: <gdb-patches@sourceware.org>
Subject: [RFA] Avoid unlimited height on mingw built GDB's.
Date: Thu, 08 Aug 2013 08:35:00 -0000 [thread overview]
Message-ID: <001c01ce9412$2c438df0$84caa9d0$@muller@ics-cnrs.unistra.fr> (raw)
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;
}
next reply other threads:[~2013-08-08 8:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-08 8:35 Pierre Muller [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001c01ce9412$2c438df0$84caa9d0$@muller@ics-cnrs.unistra.fr' \
--to=pierre.muller@ics-cnrs.unistra.fr \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).