4 ms·
libunwind is awesome. It uses the same information for its job that the actual compiler uses for unwinding exceptions in C++, etc (DWARF .eh_frame & co). It's a
by eliben 11y ago
libunwind is awesome. It uses the same information for its job that the actual compiler uses for unwinding exceptions in C++, etc (DWARF .eh_frame & co). It's also much more portable these days (I believe backtrace() is glibc-specific). There are also remote unwinding capabilities I want to play with
- cokernel_hacker 11y agoDarwin (iOS and Mac OS) have it too: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/backtrace_symbols.3.html https://developer.apple.com/library/mac/documentation/Darwin...
- eliben 11y agoAh cool. But I'm fairly sure that these days os x uses libcxx which uses libunwind
- boulos 11y agoI seem to recall them implementing the unwind interface but with standard rbp/ebp unwinding. As in http://www.opensource.apple.com/source/Libc/Libc-498.1.1/gen/backtrace.c http://www.opensource.apple.com/source/Libc/Libc-498.1.1/gen... and http://www.opensource.apple.com/source/Libc/Libc-825.25/gen/thread_stack_pcs.c http://www.opensource.apple.com/source/Libc/Libc-825.25/gen/... My biggest problem with "standard" libunwind is how slow it is compared to a whole loop against the registers (which of course isn't reliable with -fomit-frame-pointer). IIRC, the gcc's call to backtrace actually parses DWARF to work around this (and thus is super slow).
- mzs 11y agoYes backtrace() and friends is a glibc thing, but libexecinfo tries to be compatible and portable. Back when I used backtrace(), that was about the best there was, and it was not that great really. I'm glad I know about libunwind now thanks to this post.