From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15702 invoked by alias); 23 Apr 2015 11:51:18 -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 15687 invoked by uid 89); 23 Apr 2015 11:51:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-pa0-f54.google.com Received: from mail-pa0-f54.google.com (HELO mail-pa0-f54.google.com) (209.85.220.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 23 Apr 2015 11:51:16 +0000 Received: by pacyx8 with SMTP id yx8so16234787pac.1 for ; Thu, 23 Apr 2015 04:51:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=3bm5z6kTdzRWipI5Lbs0sBOGtiKuxoK1n/h++uS17UU=; b=ArKAQg+w1QtadZFjKmYc7ivo7fmDiAM8ynxpMT+2ULAN1LCvM//UXRK3YqTcYXvp3U 3EcMR03u2IVePYgmZ1z6BOY3lzybs7UHniJT/RUFDVsTptFwig5aQcOVpa1/9gc+9WLH vItKa7HOhA8U+MclOPn75fDtmie7mcUw/Lf4gFa0agfb9RINl+cEUeL891/04ogFd5Yx T+7gOgKnED2dd0Z5wzDDL5U0mSzPmnTmdNEVAcQSbZw7EwoihVsnjzSdf//6bCT2ErWG wZkNSKOZUR5oHeK+TFNPuiZ2ZMtyyjboRtYgyQROUdGUkrwXWV2rZeTnk3yUuByIN/OE IqRw== X-Gm-Message-State: ALoCoQkCM2h5g9CrS/O1epOdxJLcLorfzIwyyb6md7ME8DidVGdYjz754PvngpGUGA/RLzlpR5xZ X-Received: by 10.68.110.37 with SMTP id hx5mr4622001pbb.46.1429789874770; Thu, 23 Apr 2015 04:51:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.70.102.99 with HTTP; Thu, 23 Apr 2015 04:50:54 -0700 (PDT) In-Reply-To: <5538D255.7050108@redhat.com> References: <1429746560-16979-1-git-send-email-patrick@parcs.ath.cx> <5538D255.7050108@redhat.com> From: Patrick Palka Date: Thu, 23 Apr 2015 11:51:00 -0000 Message-ID: Subject: Re: [PATCH] Explicitly call rl_resize_terminal() in TUI's SIGWINCH handler To: Pedro Alves Cc: "gdb-patches@sourceware.org" Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-04/txt/msg00867.txt.bz2 On Thu, Apr 23, 2015 at 7:07 AM, Pedro Alves wrote: > 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? Nope, it doesn't. Strange that resizing in "layout src" or "layout split" works but not in "layout asm". I'll take a look at this. > > 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. Ah yeah. That will be easy I think. I'll take a look at this too. > >> >> 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_*".) Good idea, I'll do this too. > > Thanks, > Pedro Alves >