Export symbols for --enable-debug
Please carefully review, the following patches, as I might have modified some mentions of static that should have been kept untouched.
I am not a big fan of these changes (wrapping standard C keywords into macros).
Does anyone know if libunwind produces readable backtraces with entries for static functions?
Problem is, that as quoted in the manpages for backtrace(3) (emphasis mine):
The symbol names may be unavailable without the use of special linker options. For systems using the GNU linker, it is necessary to use the
-rdynamiclinker option. Note that names ofstaticfunctions are not exposed, and won't be available in the backtrace.
Thus, the problem is that these symbols aren't exported if static is used. I couldn't find if this also affects libunwind so this needs to be tested.
@cgzones If you provide a patch to use libunwind when available this might be a way around exporting all symbols in debug mode. But this needs to be tested AND will need a solid fallback if libunwind is not available.
On FreeBSD backtrace_symbols_fd(3) does not work, probably because it is not safe to use in signal handlers (see https://stackoverflow.com/questions/77005/how-to-automatically-generate-a-stacktrace-when-my-program-crashes).
Going to test libunwind...