From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4094 invoked by alias); 22 Sep 2007 17:13:24 -0000 Received: (qmail 4079 invoked by uid 22791); 22 Sep 2007 17:13:24 -0000 X-Spam-Check-By: sourceware.org Received: from igw1.br.ibm.com (HELO igw1.br.ibm.com) (32.104.18.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 22 Sep 2007 17:13:21 +0000 Received: from mailhub3.br.ibm.com (mailhub3 [9.18.232.110]) by igw1.br.ibm.com (Postfix) with ESMTP id 084BE148035 for ; Sat, 22 Sep 2007 13:54:40 -0300 (BRT) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.18.232.46]) by mailhub3.br.ibm.com (8.13.8/8.13.8/NCO v8.5) with ESMTP id l8MHDIZO2535556 for ; Sat, 22 Sep 2007 14:13:18 -0300 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l8MHDI2E030071 for ; Sat, 22 Sep 2007 14:13:18 -0300 Received: from [9.18.201.126] ([9.18.201.126]) by d24av01.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l8MHDHxA030065; Sat, 22 Sep 2007 14:13:17 -0300 Message-ID: <46F54D25.3050603@linux.vnet.ibm.com> Date: Sat, 22 Sep 2007 17:13:00 -0000 From: Carlos Eduardo Seo User-Agent: Thunderbird 2.0.0.6 (X11/20070907) MIME-Version: 1.0 To: Pedro Alves CC: gdb-patches@sourceware.org, eliz@gnu.org Subject: Re: [patch] tui: initialize signal handler References: <46F46E9E.5070003@linux.vnet.ibm.com> <46F4F1D6.6060108@portugalmail.pt> In-Reply-To: <46F4F1D6.6060108@portugalmail.pt> OpenPGP: id=8BFFA900 Content-Type: multipart/mixed; boundary="------------050200000208020003020607" X-IsSubscribed: yes 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 X-SW-Source: 2007-09/txt/msg00303.txt.bz2 This is a multi-part message in MIME format. --------------050200000208020003020607 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 1040 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Pedro Alves wrote: > Carlos Eduardo Seo wrote: >> I noticed that the TUI signal handler isn't initialized anywhere. >> Here's >> a patch to fix it. I'm not sure if this is the correct file to add >> this, >> though. >> >> What do you think? >> > > Thanks! I wondered why it wouldn't resize :) > > (Addicionally to Elli's remark, testing for ifdef SIGWINCH would be > a good idea too.) > > I don't think tui_initialize_readline is the best place for this. > > How about a new tui_initialize_win in tui-win.c, and call it from > next to where tui_initialize_readline is called in tui_init ? > > Cheers, > Pedro Alves > > Updated patch with your suggestions. Regards, - -- Carlos Eduardo Seo Software Engineer IBM Linux Technology Center -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG9U0kqvq7Aov/qQARAmUjAJ4u5ZnggyNH8XDMRtc8HoL5zq5SNACeMhHy Z9dB+dQQopxaTidh+LemuyI= =rHwG -----END PGP SIGNATURE----- --------------050200000208020003020607 Content-Type: text/x-patch; name="tui-sighandler.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="tui-sighandler.diff" Content-length: 2097 2007-09-22 Carlos Eduardo Seo gdb/tui/tui-interp.c (tui_init): initialize tui's SIGWINCH signal handler. gdb/tui/tui-win.c (tui_initialize_win): new function for initializing tui's SIGWINCH signal handler. gdb/tui/tui-win.h (tui_initialize_win): added Index: src/gdb/tui/tui-interp.c =================================================================== --- src.orig/gdb/tui/tui-interp.c +++ src/gdb/tui/tui-interp.c @@ -56,6 +56,7 @@ tui_init (void) tui_initialize_static_data (); tui_initialize_io (); + tui_initialize_win (); tui_initialize_readline (); return NULL; Index: src/gdb/tui/tui-win.c =================================================================== --- src.orig/gdb/tui/tui-win.c +++ src/gdb/tui/tui-win.c @@ -50,6 +50,8 @@ #include #include "readline/readline.h" +#include + /******************************* ** Static Local Decls ********************************/ @@ -802,6 +804,7 @@ tui_resize_all (void) } +#ifdef SIGWINCH /* SIGWINCH signal handler for the tui. This signal handler is always called, even when the readline package clears signals because it is set as the old_sigwinch() (TUI only). */ @@ -813,6 +816,20 @@ tui_sigwinch_handler (int signal) tui_set_win_resized_to (TRUE); } +/* Initializes SIGWINCH signal handler for the tui. */ +void +tui_initialize_win (void) +{ +#ifdef HAVE_SIGACTION + struct sigaction old_winch; + memset (&old_winch, 0, sizeof (old_winch)); + old_winch.sa_handler = &tui_sigwinch_handler; + sigaction (SIGWINCH, &old_winch, NULL); +#else + signal (SIGWINCH, &tui_sigwinch_handler); +#endif +} +#endif /************************* Index: src/gdb/tui/tui-win.h =================================================================== --- src.orig/gdb/tui/tui-win.h +++ src/gdb/tui/tui-win.h @@ -49,6 +49,8 @@ extern int tui_active_border_attrs; extern int tui_update_variables (void); +extern void tui_initialize_win (void); + /* Update gdb's knowledge of the terminal size. */ extern void tui_update_gdb_sizes (void); --------------050200000208020003020607 Content-Type: application/octet-stream; name="tui-sighandler.diff.sig" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="tui-sighandler.diff.sig" Content-length: 90 iD8DBQBG9U0kqvq7Aov/qQARArJcAJ0V+BqSBTl8MGABQZ/XwYU/24RHrACf d+t5alltrDhCfoKvcr1eA9WjGjI= --------------050200000208020003020607--