If running ASan on the host architecture, we can symbolize output with: export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer` ./myInstrumentedProgram but on Android symbolizing is more complex. The bash script below is a "hello world" for symbolizing ASan output on Android. Is there a simpler way to do this? # Execute the test and save its output adb push myInstrumentedProgram /data/data/ adb shell "LD_PRELOAD=/data/data/libclang_rt.asan-arm-android.so /data/data/myInstrumentedProgram" | tee out/err.txt # Pull runtime dependencies so we can demangle the output adb pull /system/lib/libc.so out/ adb pull /data/data/libclang_rt.asan-arm-android.so out/ # Fix-up the output and demangle sed 's/\/data\/data/out/g' out/err.txt | \ sed 's/\/system\/lib/out/g' | \ $LLVM_DIR/utils/sanitizers/asan_symbolize.py --demangle Is it possible to embed llvm-symbolizer into the ASan runtime? Thanks, Greg
On Wed, Oct 30, 2013 at 2:08 PM, Greg Fitzgerald <garious at gmail.com> wrote:> If running ASan on the host architecture, we can symbolize output with: > > export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer` > ./myInstrumentedProgram > > but on Android symbolizing is more complex. The bash script below is > a "hello world" for symbolizing ASan output on Android. Is there a > simpler way to do this? > > # Execute the test and save its output > adb push myInstrumentedProgram /data/data/ > adb shell "LD_PRELOAD=/data/data/libclang_rt.asan-arm-android.so > /data/data/myInstrumentedProgram" | tee out/err.txt > > # Pull runtime dependencies so we can demangle the output > adb pull /system/lib/libc.so out/ > adb pull /data/data/libclang_rt.asan-arm-android.so out/ > > # Fix-up the output and demangle > sed 's/\/data\/data/out/g' out/err.txt | \ > sed 's/\/system\/lib/out/g' | \ > $LLVM_DIR/utils/sanitizers/asan_symbolize.py --demangle > > Is it possible to embed llvm-symbolizer into the ASan runtime? >We have a working solution for using in-process symbolization in sanitizer tools (for Linux/x86_64), but it's somewhat complicated and is not yet upstreamed. Once it's in the trunk, it should be possible to port it to Android as well. Can't give you a very promising estimate, though :(> > Thanks, > Greg > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- Alexey Samsonov, MSK -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131031/2060f0bb/attachment.html>
Thanks for letting me know that this is in the works. This is something that would make running ASan (and all other sanitizers I assume) quite a bit more appealing on Android. If there's anything I can do to help, please let me know. If you'd like to discuss in person, I'll be at the Developers' Meeting next week. -Greg On Thu, Oct 31, 2013 at 1:58 PM, Alexey Samsonov <samsonov at google.com> wrote:> > On Wed, Oct 30, 2013 at 2:08 PM, Greg Fitzgerald <garious at gmail.com> wrote: >> >> If running ASan on the host architecture, we can symbolize output with: >> >> export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer` >> ./myInstrumentedProgram >> >> but on Android symbolizing is more complex. The bash script below is >> a "hello world" for symbolizing ASan output on Android. Is there a >> simpler way to do this? >> >> # Execute the test and save its output >> adb push myInstrumentedProgram /data/data/ >> adb shell "LD_PRELOAD=/data/data/libclang_rt.asan-arm-android.so >> /data/data/myInstrumentedProgram" | tee out/err.txt >> >> # Pull runtime dependencies so we can demangle the output >> adb pull /system/lib/libc.so out/ >> adb pull /data/data/libclang_rt.asan-arm-android.so out/ >> >> # Fix-up the output and demangle >> sed 's/\/data\/data/out/g' out/err.txt | \ >> sed 's/\/system\/lib/out/g' | \ >> $LLVM_DIR/utils/sanitizers/asan_symbolize.py --demangle >> >> Is it possible to embed llvm-symbolizer into the ASan runtime? > > > We have a working solution for using in-process symbolization in sanitizer > tools > (for Linux/x86_64), but it's somewhat complicated and is not yet upstreamed. > Once it's in the trunk, it should be possible to port it to Android as well. > Can't give you a very promising estimate, though :( > >> >> >> Thanks, >> Greg >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > > -- > Alexey Samsonov, MSK