Cygwin build failure following [PATCH 3/3 v5] Demangler crash handler

Gary Benson
Mon Jul 14 08:54:00 GMT 2014

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;
>                      ^
> 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
> 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?


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);
       sa.sa_flags = SA_ONSTACK;
       sigaction (SIGSEGV, &sa, &old_sa);
       ofunc = (void (*)()) signal (SIGSEGV, gdb_demangle_signal_handler);

More information about the Gdb-patches mailing list