A few quick comments, 1) Although mmap is not guaranteed to be async-signal-safe, in practice it should be as you mentioned previously. However I see that when using mmap, the implementation uses pthread mutexes. These are not guaranteed to be async-signal-safe either, but I guess in practice as long as you don't try to use the same mutex in "normal" code and the signal handler (in this case, the same state struct), it should be OK. Is this so?
2) In backtrace_print(), in lieu of a standard (de-facto or otherwise) for the backtrace format, why not follow gdb? I.e. a format string like "#%d 0x%lx in %s at %s:%d\n" where the first argument is a frame number, otherwise as currently done. -- Janne Blomqvist