This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Cygwin build failure following [PATCH 3/3 v5] Demangler crash handler
- From: Gary Benson <gbenson at redhat dot com>
- To: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: gdb-patches at sourceware dot org, "'Andrew Burgess'" <aburgess at broadcom dot com>, "'Doug Evans'" <xdje42 at gmail dot com>, "'Eli Zaretskii'" <eliz at gnu dot org>, "'Florian Weimer'" <fw at deneb dot enyo dot de>, "'Mark Kettenis'" <mark dot kettenis at xs4all dot nl>, "'Pedro Alves'" <palves at redhat dot com>, "'Tom Tromey'" <tromey at redhat dot com>, "'Corinna Vinschen'" <vinschen at redhat dot com>
- Date: Mon, 14 Jul 2014 09:51:54 +0100
- Subject: Re: Cygwin build failure following [PATCH 3/3 v5] Demangler crash handler
- Authentication-results: sourceware.org; auth=none
- References: <20140609152229 dot GA27494 at blade dot nx> <20140609152434 dot GD27494 at blade dot nx> <000901cf9eb5$16841da0$438c58e0$ at muller@ics-cnrs.unistra.fr>
Hi Pierre,
Pierre Muller wrote:
> I think your patch generates build failure on cygwin32:
>
> ../../../binutils-gdb/gdb/cp-support.c: In function 'gdb_demangle':
> ../../../binutils-gdb/gdb/cp-support.c:1560:21: erreur: 'SA_ONSTACK'
> undeclared (first use in this function)
> sa.sa_flags = SA_ONSTACK;
> ^
[snip]
>
> The reason is that SA_ONSTACK is not defined in cygwin's
> /usr/include/signal.h header whereas SA_RESTART is defined
> in signal header, and HAVE_SIGACTION is set in config.h
>
[snip]
>
> A simple patch would probably be to add a separate check
> #ifdef SA_ONSTACK
> sa.sa_flags = SA_ONSTACK;
> #endif
>
> But I honestly don't know enough about Cygwin signal emulation to
> know if this is a correct fix or not. Maybe Corinna Vinschen can
> comment on this?
I don't know Cygwin, but I had a quick look and indeed, it doesn't
seem to support this functionality.
Could you try the patch inlined below and let me know if it fixes
the build?
Thanks,
Gary
--
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index a8ea6fc..6a09b46 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1557,7 +1557,9 @@ gdb_demangle (const char *name, int options)
#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
sa.sa_handler = gdb_demangle_signal_handler;
sigemptyset (&sa.sa_mask);
+#ifdef HAVE_SIGALTSTACK
sa.sa_flags = SA_ONSTACK;
+#endif
sigaction (SIGSEGV, &sa, &old_sa);
#else
ofunc = (void (*)()) signal (SIGSEGV, gdb_demangle_signal_handler);