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: Cygwin build failure following [PATCH 3/3 v5] Demangler crash handler


On Jul 13 18:11, Pierre Muller wrote:
>    Hi Gary,
> 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;
>                      ^
> ../../../binutils-gdb/gdb/cp-support.c:1560:21: note: each undeclared
> identifier is reported only once for each function it appears in
> Makefile:1075: recipe for target 'cp-support.o' failed
> 
> 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
> 
> 
> > +#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);
> > +#else
> > +      ofunc = (void (*)()) signal (SIGSEGV,
> > gdb_demangle_signal_handler);
> > +#endif
> 
> A simple patch would probably be to add a separate check
> #ifdef SA_ONSTACK
>   sa.sa_flags = SA_O?STACK;
> #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?

Right, Cygwin doesn't support SA_ONSTACK yet.  It should be
possible to add, but there are no immediate plans to do so.

As for the above, wouldn't it be better to add something like

  #ifndef SA_ONSTACK
  #define SA_ONSTACK 0
  #endif

to some header?


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: pgpTqS_phB2QA.pgp
Description: PGP signature


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