> > > The stack-trace and abort-debug modules are now in a state where they
> > > can be documented. Done as follows:
> > 
> > Thanks. Are these modules safe to use in signal handlers?
> 
> No, they aren't.

They aren't. But you can still get a stack traces, even from signal handlers,
with some additional work. Ian Lance Taylor has added this documentation to
libbacktrace, just yesterday:

  In general the functions provided by this library are async-signal-safe,
  meaning that they may be safely called from a signal handler.
  That said, on systems that use `dl_iterate_phdr`, such as GNU/Linux,
  the first call to a libbacktrace function will call `dl_iterate_phdr`,
  which is not in general async-signal-safe.  Therefore, programs
  that call libbacktrace from a signal handler should ensure that they
  make an initial call from outside of a signal handler.
  Similar considerations apply when arranging to call libbacktrace
  from within malloc; `dl_iterate_phdr` can also call malloc,
  so make an initial call to a libbacktrace function outside of
  malloc before trying to call libbacktrace functions within malloc.

Bruno




Reply via email to