I'm trying to debug a crash in a python extension (cythonized) from pyjnius. The crash signature is as follows:
It occurs any time after callback is invoked when using a PythonJavaClass. In order to figure out where in jnius.so this is occuring I had to use the following command:
Which shows how to use addr2line to get the source line of the cythonized file that was leading to the crash. Nice!
Note, if using p4a, you must make sure that the debug symbols are NOT stripped (in recipes.py) as it is done by default.
06-05 18:41:46.111 3631-3631/com.jventura.pyapp I/System.out: + java:invoke(, public abstract void android.text.TextWatcher.beforeTextChanged(java.lang.CharSequence,int,int,int), [Ljava.lang.Object;@c30cd5c) 06-05 18:41:46.113 3631-3631/com.jventura.pyapp I/pybridge: beforeTextChanged called 06-05 18:41:46.114 3631-3631/com.jventura.pyapp A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 3631 (.jventura.pyapp) [ 06-05 18:41:46.114 151: 151 W/ ] debuggerd: handling request: pid=3631 uid=10103 gid=10103 tid=3631 06-05 18:41:46.112 4374-4374/? W/debuggerd: type=1400 audit(0.0:1696): avc: denied { search } for name="com.jventura.pyapp" dev="dm-0" ino=130503 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 06-05 18:41:46.112 4374-4374/? W/debuggerd: type=1400 audit(0.0:1697): avc: denied { search } for name="com.jventura.pyapp" dev="dm-0" ino=130503 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 06-05 18:41:46.112 4374-4374/? W/debuggerd: type=1400 audit(0.0:1698): avc: denied { search } for name="com.jventura.pyapp" dev="dm-0" ino=130503 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 06-05 18:41:46.112 4374-4374/? W/debuggerd: type=1400 audit(0.0:1699): avc: denied { search } for name="com.jventura.pyapp" dev="dm-0" ino=130503 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 06-05 18:41:46.112 4374-4374/? W/debuggerd: type=1400 audit(0.0:1700): avc: denied { search } for name="com.jventura.pyapp" dev="dm-0" ino=130503 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 06-05 18:41:46.112 4374-4374/? W/debuggerd: type=1400 audit(0.0:1701): avc: denied { search } for name="com.jventura.pyapp" dev="dm-0" ino=130503 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 06-05 18:41:46.112 4374-4374/? W/debuggerd: type=1400 audit(0.0:1702): avc: denied { search } for name="com.jventura.pyapp" dev="dm-0" ino=130503 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 06-05 18:41:46.112 4374-4374/? W/debuggerd: type=1400 audit(0.0:1703): avc: denied { search } for name="com.jventura.pyapp" dev="dm-0" ino=130503 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 06-05 18:41:46.193 4374-4374/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 06-05 18:41:46.193 4374-4374/? A/DEBUG: LineageOS Version: '14.1-20170502-NIGHTLY-hammerhead' 06-05 18:41:46.193 4374-4374/? A/DEBUG: Build fingerprint: 'google/hammerhead/hammerhead:6.0.1/M4B30Z/3437181:user/release-keys' 06-05 18:41:46.193 4374-4374/? A/DEBUG: Revision: '11' 06-05 18:41:46.193 4374-4374/? A/DEBUG: ABI: 'arm' 06-05 18:41:46.194 4374-4374/? A/DEBUG: pid: 3631, tid: 3631, name: .jventura.pyapp >>> com.jventura.pyapp <<< 06-05 18:41:46.194 4374-4374/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 06-05 18:41:46.194 4374-4374/? A/DEBUG: r0 00000000 r1 3fffffff r2 b516737c r3 98bed684 06-05 18:41:46.194 4374-4374/? A/DEBUG: r4 00000000 r5 00000000 r6 00000000 r7 b2c17770 06-05 18:41:46.194 4374-4374/? A/DEBUG: r8 96fb22d0 r9 b42a3230 sl 989d0db4 fp 98d85d30 06-05 18:41:46.194 4374-4374/? A/DEBUG: ip 98ba2c88 sp beef7148 lr 989fdd3f pc b50f2b68 cpsr 600f0030 06-05 18:41:46.199 4374-4374/? A/DEBUG: backtrace: 06-05 18:41:46.199 4374-4374/? A/DEBUG: #00 pc 0001db68 /system/lib/libc.so (sem_post+11) 06-05 18:41:46.199 4374-4374/? A/DEBUG: #01 pc 00028d3b /data/app/com.jventura.pyapp-2/lib/arm/libpython2.7.so (PyThread_release_lock+2) 06-05 18:41:46.199 4374-4374/? A/DEBUG: #02 pc 0003b48d /data/data/com.jventura.pyapp/assets/python/site-packages/jnius/jnius.so [ 06-05 18:41:46.621 151: 151 W/ ] debuggerd: resuming target 3631
It occurs any time after callback is invoked when using a PythonJavaClass. In order to figure out where in jnius.so this is occuring I had to use the following command:
~/Android/Crystax/crystax-ndk/toolchains/arm-linux-androideabi-5/prebuilt/linux-x86_64/bin/arm-linux-androideabi-addr2line -f -e ~/.local/share/python-for-android/build/other_builds/pyjnius-genericndkbuild-python2crystax/armeabi-v7a/pyjnius/build/lib.linux-x86_64-2.7/jnius/jnius.so 0003a9bd __pyx_f_5jnius_invoke0 ~/.local/share/python-for-android/build/other_builds/pyjnius-genericndkbuild-python2crystax/armeabi-v7a/pyjnius/jnius/jnius.c:32226
Which shows how to use addr2line to get the source line of the cythonized file that was leading to the crash. Nice!
Note, if using p4a, you must make sure that the debug symbols are NOT stripped (in recipes.py) as it is done by default.
Comments
Post a Comment