From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25792 invoked by alias); 9 May 2013 11:32: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 25780 invoked by uid 89); 9 May 2013 11:32:15 -0000 X-Spam-SWARE-Status: No, score=-8.3 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 09 May 2013 11:32:15 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r49BWC31013076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 9 May 2013 07:32:12 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r49BW7WX006221; Thu, 9 May 2013 07:32:10 -0400 Message-ID: <518B8936.3050900@redhat.com> Date: Thu, 09 May 2013 11:32:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: mbilal CC: gdb-patches@sourceware.org, jan.kratochvil@redhat.com Subject: Re: [PATCH 2/7] PR gdb/15224 fix for Unify interactivity tests to use input_from_terminal_p References: <51877A32.1030503@codesourcery.com> <51877A99.4060503@codesourcery.com> <5188AA15.5010904@codesourcery.com> <5188AC27.1050407@codesourcery.com> <5188AC99.6060504@codesourcery.com> <518A0B4E.50808@codesourcery.com> <518B83A7.3060804@codesourcery.com> In-Reply-To: <518B83A7.3060804@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-05/txt/msg00307.txt.bz2 On 05/09/2013 12:08 PM, mbilal wrote: > On Wednesday, May 08, 2013 9:22 PM Pedro Alves wrote: > >>I'd guess that input_from_terminal_p already does some of the >>checks this is also making, so that this could be simplified. > > I don't think that because input_from_terminal_p > checks the condition instream==stdin that > is equal in both sanario , but input_from_terminal_p > also return 1 when instream==NULL. > So I think that there is no any condition that is overlapping with > input_from_terminal_p. /* If INSTREAM is unset, and we are not in a user command, we must be in Insight. That's like having a terminal, for our purposes. */ if (instream == NULL && !in_user_command) return 1; This very much looks like a case where history should work, but won't unless we simplify to check input_from_terminal_p only. The point of unifying interactivity tests is exactly so that all these little details are centralized in a single place. Doesn't - if (instream == stdin - && ISATTY (stdin) && *linebuffer) + if (*linebuffer && input_from_terminal_p ()) work? If not, why not? It'd be great to try that on GNU/Linux, mingw32 gdb running under cmd.exe, and mingw32 gdb under Cygwin bash, the latter with and without "set interactive-mode on". I suspect this change would fix history for the forced "set interactive-mode on" case too. > Index: event-top.c > =================================================================== > RCS file: /cvs/src/src/gdb/event-top.c,v > retrieving revision 1.94 > diff -u -p -r1.94 event-top.c > --- event-top.c 21 Mar 2013 17:37:29 -0000 1.94 > +++ event-top.c 9 May 2013 10:23:21 -0000 > @@ -604,7 +604,8 @@ command_line_handler (char *rl) > > /* Add line to history if appropriate. */ > if (instream == stdin > - && ISATTY (stdin) && *linebuffer) > + && ISATTY (stdin) && *linebuffer > + && input_from_terminal_p ()) > add_history (linebuffer); Please grep for add_history. There's at least one more call in the tree. -- Pedro Alves