From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113976 invoked by alias); 14 Sep 2016 17:22:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 113966 invoked by uid 89); 14 Sep 2016 17:22:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=site X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Sep 2016 17:22:04 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkDsi-0003SH-8e for gdb-patches@sourceware.org; Wed, 14 Sep 2016 13:22:01 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51933) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkDsi-0003RV-5a; Wed, 14 Sep 2016 13:21:56 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3766 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bkDsc-0008N2-LN; Wed, 14 Sep 2016 13:21:54 -0400 Date: Wed, 14 Sep 2016 17:22:00 -0000 Message-Id: <831t0m8kio.fsf@gnu.org> From: Eli Zaretskii To: Giah de Barag CC: gdb-patches@sourceware.org In-reply-to: (message from Giah de Barag on Wed, 14 Sep 2016 02:32:09 -0400) Subject: Re: Enabled TUI mode on MSYS2 Reply-to: Eli Zaretskii References: <1E55DA7D-4F01-49BB-99FF-5A79933415A4@crelg.com> <83d1k78an5.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00111.txt.bz2 > From: Giah de Barag > 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.