public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Giah de Barag <gdb@crelg.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Enabled TUI mode on MSYS2
Date: Wed, 14 Sep 2016 17:22:00 -0000	[thread overview]
Message-ID: <831t0m8kio.fsf@gnu.org> (raw)
In-Reply-To: <B0760973-DB74-4F8C-9C7E-7F1E539C912B@crelg.com> (message from	Giah de Barag on Wed, 14 Sep 2016 02:32:09 -0400)

> From: Giah de Barag <gdb@crelg.com>
> Date: Wed, 14 Sep 2016 02:32:09 -0400
> Cc: gdb-patches@sourceware.org
> 
> I do not understand the apparent conflict between this statement, that “GDB simply should not use that function in the MinGW build,” and the statement above, “I don't think there's a need for any patches.” How should one not use that function without affecting the source? Has this patch (changing getch to _getch) already been applied somewhere other than 7.11 (where I happen to be focused)?

Sorry for not explaining this clearly enough.  Let me try again.

The function getch from ncurses can only work when GDB is invoked with
the -tui command line option, i.e. when you activate the TUI user
interface.  Otherwise, it will always return EOF because no text-mode
window was created by GDB, and ncurses requires a window before it can
take any input.

When GDB is linked with ncurses, the getch function call by Readline
is resolved to the ncurses version of that function, and not to getch
in the MS-Windows runtime library.  (The call to getch in Readline is
MinGW-specific, so this problem doesn't show on other platforms.)
Readline only calls getch when TUI is _not_ in use, so the solution is
to replace the call to getch with a call to _getch.

The Readline library is maintained separately from GDB; GDB imports
Readline into its repository, and has its own copy there.  I submitted
the patch to use _getch (and several other MinGW-related patches) to
the Readline maintainer about 2 years ago, and those patches are
already in the latest versions of Readline.  Unfortunately, GDB did
not yet import those latest versions of Readline, so you don't see the
patches in the GDB sources.  (When I produce the binaries I use and
make available from the ezwinports site, I patch Readline to fix all
thos problems.)

I hope this explains the issue.  The bottom line is that GDB should
import a newer version of Readline, and then these problems will be
fixed without any need for further patches.

  reply	other threads:[~2016-09-14 17:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-13 21:21 Giah de Barag
2016-09-14  2:42 ` Eli Zaretskii
2016-09-14  6:32   ` Giah de Barag
2016-09-14 17:22     ` Eli Zaretskii [this message]
2016-09-14 17:33       ` Pedro Alves
2016-09-14 18:33       ` Giah de Barag
2016-09-14 18:36         ` Pedro Alves
2016-09-14 18:59           ` Eli Zaretskii
2016-09-14 19:04             ` Pedro Alves
2016-09-17  8:53               ` Eli Zaretskii
2016-09-17  9:39                 ` Eli Zaretskii
2016-09-18 23:40                   ` Pedro Alves
2016-09-20 22:45                   ` Sergio Durigan Junior

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=831t0m8kio.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=gdb@crelg.com \
    /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).