On Thu, Dec 13, 2012 at 02:22:52PM +0400, Konstantin Serebryany wrote: > I've added two flags, both on by default for now. > > // Use fast (frame-pointer-based) unwinder on fatal errors (if available). > bool fast_unwind_on_fatal; > // Use fast (frame-pointer-based) unwinder on malloc/free (if available). > bool fast_unwind_on_malloc; > > > % clang -fsanitize=address -g > ~/llvm/projects/compiler-rt/lib/asan/lit_tests/overflow-in-qsort.cc > % ASAN_OPTIONS=fast_unwind_on_fatal=0 ./a.out 2>&1 | asan_symbolize.py > / | grep '#' > #0 0x419731 in QsortCallback overflow-in-qsort.cc:18 > #1 0x7fa7e137b61f in msort_with_tmp msort.c:143 > #2 0x7fa7e137baba in msort_with_tmp msort.c:46 > #3 0x419a58 in MyQsort overflow-in-qsort.cc:25 > #4 0x419c94 in main overflow-in-qsort.cc:33 > #5 0x7fa7e136276c in __libc_start_main libc-start.c:226 > #6 0x4193ac in _start ??:0 > % ASAN_OPTIONS=fast_unwind_on_fatal=1 ./a.out 2>&1 | asan_symbolize.py > / | grep '#' > #0 0x419731 in QsortCallback overflow-in-qsort.cc:18 > #1 0x7f816783f61f in msort_with_tmp msort.c:143 > % > > This feature still needs some love. > I'll set fast_unwind_on_fatal to 0 after some testing and then merge > to gcc (unless there is a rush).
I'll wait for your commit, then will test it on Fedora. msort.c and qsort.c are definitely built with -fasynchronous-unwind-tables -fexceptions though, at least by default. > If we want to support new handler and allow asan's malloc to return 0, > it is much easier and cleaner to implement it from scratch. libstdc++ doesn't have __new_handler exported I think, and there is no way to query it outside of libstdc++ itself though. One can only set it. Jakub