This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] tui: initialize signal handler


-----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-----

2007-09-22   Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>

	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 <ctype.h>
 #include "readline/readline.h"
 
+#include <signal.h>
+
 /*******************************
 ** 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);
 

Attachment: tui-sighandler.diff.sig
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]