2
我正在構建一個包含大量Android源代碼的庫。如果爲Linux x86編譯,該庫工作正常。我正在用獨立的工具鏈構建它。之前我和其他圖書館都有過這方面的成功,所以我覺得我的設置很好。無論如何,編譯和鏈接都很好,但是當我加載生成的共享庫時,我得到一個SEGV。這是我得到的痕跡:需要幫助進一步調試SEGV問題 - Android NDK
03-23 23:37:14.213: I/DEBUG(28): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-23 23:37:14.213: I/DEBUG(28): Build fingerprint: 'generic/sdk/generic/:2.1-update1/ECLAIR/35983:eng/test-keys'
03-23 23:37:14.224: I/DEBUG(28): pid: 332, tid: 332 >>> com.example.hellojni <<<
03-23 23:37:14.224: I/DEBUG(28): signal 11 (SIGSEGV), fault addr 00000000
03-23 23:37:14.224: I/DEBUG(28): r0 00000000 r1 00000000 r2 80808080 r3 00000000
03-23 23:37:14.224: I/DEBUG(28): r4 00000000 r5 bea8154c r6 bea81600 r7 00000000
03-23 23:37:14.224: I/DEBUG(28): r8 bea81820 r9 41971894 10 00000354 fp bea814fc
03-23 23:37:14.224: I/DEBUG(28): ip 80a81058 sp bea814c0 lr 80a63cd8 pc afe0e7c8 cpsr 40000010
03-23 23:37:14.313: I/DEBUG(28): #00 pc 0000e7c8 /system/lib/libc.so
03-23 23:37:14.313: I/DEBUG(28): #01 pc 00063cd4 /data/data/com.example.hellojni/lib/libgnustl_shared.so
03-23 23:37:14.323: I/DEBUG(28): code around pc:
03-23 23:37:14.323: I/DEBUG(28): afe0e7b8 e31c0003 1afffff6 e1a00002 e59f20d8
03-23 23:37:14.323: I/DEBUG(28): afe0e7c8 e490c004 e0433000 f5d0f040 e04c13a2
03-23 23:37:14.323: I/DEBUG(28): afe0e7d8 e0011002 e1d1100c 0490c004 1a000022
03-23 23:37:14.323: I/DEBUG(28): code around lr:
03-23 23:37:14.323: I/DEBUG(28): 80a63cc8 e1a05000 e1a00001 e1a04001 ebff27d0
03-23 23:37:14.323: I/DEBUG(28): 80a63cd8 e1a01004 e1a02000 e1a00005 e8bd4070
03-23 23:37:14.323: I/DEBUG(28): 80a63ce8 eaffffa0 e590c000 e92d45f0 e51ce00c
03-23 23:37:14.323: I/DEBUG(28): stack:
03-23 23:37:14.323: I/DEBUG(28): bea81480 001479d0 [heap]
03-23 23:37:14.323: I/DEBUG(28): bea81484 bea81820 [stack]
03-23 23:37:14.323: I/DEBUG(28): bea81488 41971894 /dev/ashmem/dalvik-LinearAlloc (deleted)
03-23 23:37:14.323: I/DEBUG(28): bea8148c 00000354
03-23 23:37:14.334: I/DEBUG(28): bea81490 bea814fc [stack]
03-23 23:37:14.334: I/DEBUG(28): bea81494 00147a24 [heap]
03-23 23:37:14.334: I/DEBUG(28): bea81498 00000006
03-23 23:37:14.334: I/DEBUG(28): bea8149c 80a63b58 /data/data/com.example.hellojni/lib/libgnustl_shared.so
03-23 23:37:14.334: I/DEBUG(28): bea814a0 00000006
03-23 23:37:14.334: I/DEBUG(28): bea814a4 bea81548 [stack]
03-23 23:37:14.334: I/DEBUG(28): bea814a8 80a82110
03-23 23:37:14.334: I/DEBUG(28): bea814ac 00000000
03-23 23:37:14.334: I/DEBUG(28): bea814b0 bea81820 [stack]
03-23 23:37:14.334: I/DEBUG(28): bea814b4 80a63bcc /data/data/com.example.hellojni/lib/libgnustl_shared.so
03-23 23:37:14.334: I/DEBUG(28): bea814b8 df002777
03-23 23:37:14.334: I/DEBUG(28): bea814bc e3a070ad
03-23 23:37:14.344: I/DEBUG(28): #00 bea814c0 bea814d4 [stack]
03-23 23:37:14.344: I/DEBUG(28): bea814c4 00000000
03-23 23:37:14.344: I/DEBUG(28): #01 bea814c8 bea81548 [stack]
03-23 23:37:14.344: I/DEBUG(28): bea814cc bea81548 [stack]
03-23 23:37:14.344: I/DEBUG(28): bea814d0 bea81600 [stack]
03-23 23:37:14.344: I/DEBUG(28): bea814d4 8131f228 /data/data/com.example.hellojni/lib/libsharedB.so
03-23 23:37:14.344: I/DEBUG(28): bea814d8 afe39190 /system/lib/libc.so
03-23 23:37:14.344: I/DEBUG(28): bea814dc bea8152c [stack]
03-23 23:37:14.344: I/DEBUG(28): bea814e0 001479a0 [heap]
03-23 23:37:14.344: I/DEBUG(28): bea814e4 bea81548 [stack]
03-23 23:37:14.344: I/DEBUG(28): bea814e8 80a8211c
03-23 23:37:14.344: I/DEBUG(28): bea814ec 001479a0 [heap]
03-23 23:37:14.344: I/DEBUG(28): bea814f0 bea81548 [stack]
03-23 23:37:14.344: I/DEBUG(28): bea814f4 bea81548 [stack]
03-23 23:37:14.344: I/DEBUG(28): bea814f8 bea8151c [stack]
03-23 23:37:14.344: I/DEBUG(28): bea814fc 8131eb8c /data/data/com.example.hellojni/lib/libsharedB.so
03-23 23:37:14.344: I/DEBUG(28): bea81500 bea8152c [stack]
03-23 23:37:14.344: I/DEBUG(28): bea81504 0000272e
03-23 23:37:14.344: I/DEBUG(28): bea81508 80a82124
03-23 23:37:14.344: I/DEBUG(28): bea8150c 80a8211c
03-23 23:37:14.884: D/Zygote(30): Process 332 terminated by signal (11)
03-23 23:37:14.893: I/ActivityManager(52): Process com.example.hellojni (pid 332) has died.
03-23 23:37:14.966: I/UsageStats(52): Unexpected resume of com.android.launcher while already resumed in com.example.hellojni
如果我使用addr2line我得到這樣的信息:
android-linux-addr2line.exe -C -f -e libc.so 0000e7c8
strlen
??:0
android-linux-addr2line.exe -C -f -e libgnustl_shared.so 00063cd4
std::string::operator=(char const*)
??:0
好了,有可能是一些與字符串的靜態分配走錯了。這將解釋失敗簽名。那麼,我該如何弄清源代碼在哪裏發生?我如何進行下一步操作並找出導致該問題的任務?再次,這是一個大量的源代碼,它看起來有很多靜態的字符串賦值。我需要縮小範圍。
很高興你已經到了這個底部,這是正確的混淆! libsharedB中的錯誤的性質是什麼? – Wil 2012-04-03 13:38:26