From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120893 invoked by alias); 23 Apr 2015 11:07:09 -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 120818 invoked by uid 89); 23 Apr 2015 11:07:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 23 Apr 2015 11:07:07 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3NB73au002306 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 23 Apr 2015 07:07:04 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3NB711b015374; Thu, 23 Apr 2015 07:07:02 -0400 Message-ID: <5538D255.7050108@redhat.com> Date: Thu, 23 Apr 2015 11:07:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Patrick Palka , gdb-patches@sourceware.org Subject: Re: [PATCH] Explicitly call rl_resize_terminal() in TUI's SIGWINCH handler References: <1429746560-16979-1-git-send-email-patrick@parcs.ath.cx> In-Reply-To: <1429746560-16979-1-git-send-email-patrick@parcs.ath.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-04/txt/msg00863.txt.bz2 On 04/23/2015 12:49 AM, Patrick Palka wrote: > (I am looking into syncing our copy of readline to the latest version, > 6.3.) > > In readline 6.3, the semantics of SIGWINCH handling has changed. > When a SIGWINCH signal is raised, readline's rl_sigwinch_handler() now > does not immediately call rl_resize_terminal(). Instead it sets a flag > that is checked by RL_CHECK_SIGNALS() at a point where readline has > control, and calls rl_resize_terminal() if said flag is set. > > This change is item (c) in https://cnswww.cns.cwru.edu/php/chet/readline/CHANGES > > c. Fixed a bug that caused readline to try and run code to modify its idea > of the screen size in a signal handler context upon receiving a SIGWINCH. > > This change in behavior is important to us because TUI's > tui_sigwinch_handler() relies on the assumption that by the time it's > called, readline will have updated its knowledge of the terminal > dimensions via rl_resize_terminal(). Since this assumption no longer > holds true, TUI's SIGWINCH handling does not work correctly with > readline 6.3. > > To fix this issue this patch makes TUI explicitly call > rl_resize_terminal() in tui_async_resize_screen() at the point where > current terminal dimensions are needed. (We could call it in > tui_sigwinch_handler too, but since readline avoids doing it, we are > probably safer off avoiding to call it in signal handler context as > well.) After this change, SIGWINCH handling continues to work properly > with both readline 6.2 and 6.3. OK with ChangeLog entry. I wonder if this fixes PR18155? I think we should call this and update gdb's sense of the screen size even with the tui disabled though. I currently see, outside the TUI: (gdb) show height Number of lines gdb thinks are in a page is 45. *resize* (gdb) show height Number of lines gdb thinks are in a page is 45. * switch TUI on and off * (gdb) show height Number of lines gdb thinks are in a page is 27. > > Since we no longer need it, we could now explicitly disable readline's > SIGWINCH handler by setting rl_handle_sigwinch to zero early on in the > program startup but I can't seem to find a good spot to place this > assignment (the first call to rl_initialize() occurs in > tui_initialize_readline() so the assignment should occur before then), > and the handler is harmless anyway. ITYM rl_catch_sigwinch: /* If non-zero, readline will install a signal handler for SIGWINCH that also attempts to call any calling application's SIGWINCH signal handler. Note that the terminal is not cleaned up before the application's signal handler is called; use rl_cleanup_after_signal() to do that. */ extern int rl_catch_sigwinch; Maybe in init_page_info, and probably move the init_page_info call to gdb_init directly for clarity. (I found that with "rbreak rl_*".) Thanks, Pedro Alves