[cfe-dev] Debug Info for Symbolification on Darwin using Address Sanitizer?

Alexander Potapenko glider at google.com
Wed Jul 31 06:49:52 PDT 2013


Hi Jeffrey,

You need to export the ASAN_SYMBOLIZER_PATH env var that'll point to
the llvm-symbolizer binary (must reside in the same dir as Clang)
Otherwise you can post-process the output using the
compiler-rt/lib/asan/scripts/asan_symbolize.py script.

HTH,
Alex

On Wed, Jul 31, 2013 at 2:21 AM, Jeffrey Walton <noloader at gmail.com> wrote:
> Hi All,
>
> What additional switches should be added to get a good trace below? Or
> do I need to post-process the output?
>
> Under gdb, I have symbols with -g3.
>
> $export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib/clang/3.3/lib/darwin/
> $ ./testlib
> ...
>
> crypt/sha2.c:342:37: runtime error: left shift of 128 by 24 places
> cannot be represented in type 'int'
> =================================================================
> ==78966==ERROR: AddressSanitizer: global-buffer-overflow on address
> 0x000102b71340 at pc 0x100bc4ce5 bp 0x7fff5f27de90 sp 0x7fff5f27de88
> READ of size 1 at 0x000102b71340 thread T0
>     #0 0x100bc4ce4 (…/./testlib+0x10024cce4)
>     #1 0x10136caaf (…/./testlib+0x1009f4aaf)
>     #2 0x10132058f (…/./testlib+0x1009a858f)
>     #3 0x101329531 (…/./testlib+0x1009b1531)
>     #4 0x101319acc (…/./testlib+0x1009a1acc)
>     #5 0x10149a118 (…/./testlib+0x100b22118)
>     #6 0x101494e56 (…/./testlib+0x100b1ce56)
>     #7 0x101e6e8f7 (…/./testlib+0x1014f68f7)
>     #8 0x101d8d477 (…/./testlib+0x101415477)
>     #9 0x101d7e3a8 (…/./testlib+0x1014063a8)
>     #10 0x1020d9a7b (…/./testlib+0x101761a7b)
>     #11 0x1020d66cb (…/./testlib+0x10175e6cb)
>     #12 0x101eddb27 (…/./testlib+0x101565b27)
>     #13 0x101d8d477 (…/./testlib+0x101415477)
>     #14 0x101d7e3a8 (…/./testlib+0x1014063a8)
>     #15 0x101dbe7e8 (…/./testlib+0x1014467e8)
>     #16 0x101dbb6cf (…/./testlib+0x1014436cf)
>     #17 0x100aeee50 (…/./testlib+0x100176e50)
>     #18 0x100af6c56 (…/./testlib+0x10017ec56)
>     #19 0x7fff98b657e0 (/usr/lib/system/libdyld.dylib+0x27e0)
>     #20 0x0
>
> (The "…" were added for email formatting).
>
> Thanks in advance,
>
> Jeff
>
> $ uname -a
> Darwin riemann.home.pvt 12.4.0 Darwin Kernel Version 12.4.0: Wed May
> 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64
>
> $ /usr/local/bin/clang -v
> clang version 3.3 (tags/RELEASE_33/final)
> Target: x86_64-apple-darwin12.4.0
> Thread model: posix
>
> $ make clean
> rm -f *.o core testlib stestlib tools/endian libcl.a libcl.so.3.4.3
> $ make CC="/usr/local/bin/clang -Wl,-lresolv -fsanitize=address
> -fsanitize=undefined"
> ODBC interface detected, enabling ODBC support.
> LDAP interface detected, enabling LDAP support
>   (Enabling additional source code options for development version).
> /usr/local/bin/clang -Wl,-lresolv -fsanitize=address
> -fsanitize=undefined -c -D__UNIX__ -DNDEBUG -I. -DDATA_LITTLEENDIAN
> -DHAS_ODBC -DUSE_ODBC -DHAS_LDAP -DUSE_LDAP -DUSE_CERT_DNSTRING
> -DUSE_DNSSRV -DUSE_ECC -g3 -DDEBUG=1 -UNDEBUG -DHAS_RECURSIVE_MUTEX
> -DHAS_ROBUST_MUTEX -DOSVERSION=1 -fomit-frame-pointer -o
> ./static-obj/bn_add.o bn/bn_add.c
> ...
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



-- 
Alexander Potapenko
Software Engineer
Google Moscow




More information about the cfe-dev mailing list