[LLVMdev] Symbolized ASan output on Android

Greg Fitzgerald garious at gmail.com
Wed Oct 30 14:08:29 PDT 2013


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



More information about the llvm-dev mailing list