How to confirm which line is wrong
Thank you for your help I used ExampleASAN to find bugs 。I can get the log like below ,but How to confirm which line is wrong: 2018-11-22 17:32:25.553 26638-26638/? I/wrap.sh: ================================================================= 2018-11-22 17:32:25.553 26638-26638/? I/wrap.sh: [1m[31m==26644==ERROR: AddressSanitizer: stack-buffer-overflow on address 0xff8cdf98 at pc 0xb7288e7f bp 0xff8cdf58 sp 0xff8cdf54
you can use command:
arm-linux-androideabi-addr2line -f -e xxx.so ${offset}
xxx.so is the lib which is not-stripped
${offset} is the offset in the log
for example:
wrap.sh : =================================================================
wrap.sh : [1m[31m==14590==ERROR: AddressSanitizer: stack-buffer-overflow on address 0xa0ae02a8 at pc 0xf225a888 bp 0xb64fe138 sp 0xb64fdd08
wrap.sh : [1m[0m[1m[34mREAD of size 40 at 0xa0ae02a8 thread T280 (KernelThread-2)[1m[0m
wrap.sh : #0 0xf225a884 (/data/app/com.test-NeS9E1SoXLVvkx6gIATFRw==/lib/arm/libclang_rt.asan-arm-android.so+0x95884)
wrap.sh : #1 0xf2b33898 (/system/lib/libc.so+0x20898)
wrap.sh : #2 0xf225a254 (/data/app/com.test-NeS9E1SoXLVvkx6gIATFRw==/lib/arm/libclang_rt.asan-arm-android.so+0x95254)
wrap.sh : #3 0xafa3c212 (/data/app/com.test-NeS9E1SoXLVvkx6gIATFRw==/lib/arm/libtest.so+0xd4212)
wrap.sh : #4 0xafa3b296 (/data/app/com.test-NeS9E1SoXLVvkx6gIATFRw==/lib/arm/libtest.so+0xd3296)
look the log above, u can symbolize by:
arm-linux-androideabi-addr2line -f -e libtest.so 0xd4212
arm-linux-androideabi-addr2line -f -e libtest.so 0xd3296