This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH] Against SIGWINCH annoyance in edit cli cmd
- From: Tom Tromey <tromey at redhat dot com>
- To: LluÃs Batlle i Rossell <viric at viric dot name>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 15 Aug 2012 10:18:01 -0600
- Subject: Re: [PATCH] Against SIGWINCH annoyance in edit cli cmd
- References: <20120709194051.GZ2039@vicerveza.homeunix.net>
>>>>> "LluÃs" == LluÃs Batlle i Rossell <email@example.com> writes:
LluÃs> I wrote this small patch that fixes a very annoying bug I hit
LluÃs> often in gdb. To get the annoyance, it only requires to run
LluÃs> "edit" in the gdb cli to launch an in-terminal editor, and then
LluÃs> resize the terminal. Easy to happen on a tiling wm.
Thanks for the report.
LluÃs> I found that the readline code takes out the SIGWINCH handler
LluÃs> that has SA_RESTART; then the edit-cmd calls 'waitpid()'
LluÃs> careless, and as there is no restart of syscalls, waitpid()
LluÃs> unblocks and goes back to the gdb prompt. But only SIGWINCH
I looked into this a little.
It is weird to me that we have so many calls to waitpid and other things
that don't check for EINTR.
I wonder whether tui_initialize_win should just use SA_RESTART. I think
that would solve your problem and also avoid odd problems in these other
Could you try this patch?
Maybe your patch is also needed, to deal with other signals where we
can't use SA_RESTART. I am not sure.
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index c12f036..245b0ee 100644
@@ -831,11 +831,12 @@ void
+#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
struct sigaction old_winch;
- memset (&old_winch, 0, sizeof (old_winch));
+ sigemptyset (&old_winch.sa_mask);
old_winch.sa_handler = &tui_sigwinch_handler;
+ old_winch.sa_flags = SA_RESTART;
sigaction (SIGWINCH, &old_winch, NULL);
signal (SIGWINCH, &tui_sigwinch_handler);