On OS X, dladdr() provides mangled names only, so we need need to demangle in DlAddrSymbolizer::SymbolizePC.
Details
Diff Detail
Event Timeline
lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc | ||
---|---|---|
42 | Maybe we should provide an option that allows us to turn off demangling? It would make it easier to isolate cases where we get a second failure while reporting. Clients who don't need this (ex: running under the debugger) could turn this off. What do you think? |
lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc | ||
---|---|---|
42 | Can demangling really cause such a bad failure? I was under the impression that either __cxa_demangle could be missing (because we're not linked against libcxx) or it could return NULL, and we handle both these cases here. (Which reminds me that the extra check for NULL-ness above in sanitizer_symbolizer_mac.cc is not necessary, because DemangleCXXABI can never return NULL). However, if you suspect that it could actually cause a crash, having an option to turn it on/off sounds like a good idea. FYI, if you use ASAN_OPTIONS=symbolize=0, stack traces will not be symbolicated at all, and no demangling will occur either. |
I've just noticed this FIXME in the comment:
" __cxa_demangle aggressively insists on allocating memory."
Allocating memory while in a bad state could result in unpredictable behavior.
FYI I'm ok with this patch. Allocating memory during report printing is bad, will roundtrip through our allocator, and can cause different side-effects. However, we can't do much better here. InternalSymbolizer we're using internally allocates a *lot* of memory, and we were able to get away with it for quite a while for now.
Landed in r232910. Later I'll try to take another look into memory allocations during report printing.
Maybe we should provide an option that allows us to turn off demangling? It would make it easier to isolate cases where we get a second failure while reporting. Clients who don't need this (ex: running under the debugger) could turn this off.
What do you think?