问题
I am creating a 2D game on Android using OpenGL. Currently I am testing and debugging the game on several devices. The problem I am facing, is the terrible "signal 11" error.
When I am playing on my Samsung Galaxy Nexus, everything runs smooth, and I can play it for hours without the game throwing any errors. My Nexus is running Android 4.0 Ice Cream Sandwich.
Now, when I run it on other devices, I am getting this signal 11 error. This are the devices which throw the error:
- HTC Desire HD (Gingerbread)
- HTC Desire Z (Gingerbread)
- HTC Wildfire (Gingerbread)
- Advent Vega tablet (Vegacomb)
- Asus EE Pad Transformer (Icecream Sandwich)
I can't use USB debugging on my Advent Vega, but the other 3 devices that pop the error are debuggable. It seems I need to root my device to get some more info about the signal 11 error. I was able to root my Galaxy Nexus and my Desire HD.
As the error always seems to appear at the same moment (when the game is just finished loading the textures), I supposed I could do with just one rooted device to find out what the cause of the problem is, then fix it, and test the new version on the other device.
First I thought it had something to do with memory management (not freeing my objects, therefore performing a lot of GC requests). So after a few hours profiling, optimizing, testing, etc, I found that this was not the problem.
Then I assumed it had something to do with Thread Safety (one thread trying to get something from memory, where another thread has just destroyed the reference). But this doesn't seem to be the case either.
Ok, so now I have my rooted Desire HD wired to my laptop, and I have my Eclipse project open and DDMS running.
Now, what does logcat tell me when the game/application crashes?
04-02 13:24:50.561: D/dalvikvm(3526): GC_CONCURRENT freed 739K, 43% free 4225K/7303K, external 1478K/1939K, paused 2ms+4ms
04-02 13:24:50.661: D/dalvikvm(3526): GC_FOR_MALLOC freed 99K, 43% free 4261K/7431K, external 1466K/1939K, paused 29ms
04-02 13:24:50.701: I/DEBUG(3412): debuggerd: 2012-04-02 13:24:50
04-02 13:24:50.701: I/DEBUG(3412): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-02 13:24:50.701: I/DEBUG(3412): Build fingerprint: 'vodafone_uk/htc_ace/ace:2.3.5/GRJ90/208029.3:user/release-keys'
04-02 13:24:50.701: I/DEBUG(3412): pid: 3526, tid: 3539 >>> com.more2create.cityisland <<<
04-02 13:24:50.701: I/DEBUG(3412): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0088d410
04-02 13:24:50.701: I/DEBUG(3412): r0 4b89de00 r1 0088d410 r2 00000000 r3 00000000
04-02 13:24:50.701: I/DEBUG(3412): r4 00000000 r5 00000000 r6 00000020 r7 00000001
04-02 13:24:50.701: I/DEBUG(3412): r8 45a98b68 r9 458dbde0 10 0034f598 fp 440b0000
04-02 13:24:50.701: I/DEBUG(3412): ip 806091c8 sp 45a989d0 lr 80602a0c pc afd0d200 cpsr 60000010
04-02 13:24:50.701: I/DEBUG(3412): d0 42a0000000000000 d1 0000000000000000
04-02 13:24:50.701: I/DEBUG(3412): d2 0000000042200000 d3 4220000042a00000
04-02 13:24:50.701: I/DEBUG(3412): d4 000000003df5c2a0 d5 0000000000000000
04-02 13:24:50.701: I/DEBUG(3412): d6 0000000000000101 d7 0000000000000000
04-02 13:24:50.701: I/DEBUG(3412): d8 3f8000003f800000 d9 8000000080000000
04-02 13:24:50.701: I/DEBUG(3412): d10 8000000080000000 d11 3ff0000080000000
04-02 13:24:50.701: I/DEBUG(3412): d12 3f8000003f800000 d13 0000000000000000
04-02 13:24:50.701: I/DEBUG(3412): d14 0000000000000000 d15 0000000000000000
04-02 13:24:50.701: I/DEBUG(3412): d16 000172c000000000 d17 7e37e43c8800759c
04-02 13:24:50.701: I/DEBUG(3412): d18 3fff8def8808b024 d19 465aa3f469f40e1c
04-02 13:24:50.701: I/DEBUG(3412): d20 4008000000000000 d21 3fd99a27ad32ddf5
04-02 13:24:50.701: I/DEBUG(3412): d22 3fd24998d6307188 d23 3fcc7288e957b53b
04-02 13:24:50.701: I/DEBUG(3412): d24 3fc74721cad6b0ed d25 3fc39a09d078c69f
04-02 13:24:50.701: I/DEBUG(3412): d26 0000000000000000 d27 0000000000000000
04-02 13:24:50.701: I/DEBUG(3412): d28 0000000000000000 d29 0000000000000000
04-02 13:24:50.701: I/DEBUG(3412): d30 0000000000000000 d31 0000000000000000
04-02 13:24:50.701: I/DEBUG(3412): scr 60000012
04-02 13:24:50.741: I/DEBUG(3412): #00 pc 0000d200 /system/lib/libc.so
04-02 13:24:50.741: I/DEBUG(3412): #01 pc 00002a08 /system/lib/libgsl.so
04-02 13:24:50.741: I/DEBUG(3412): #02 pc 00089e24 /system/lib/egl/libGLESv2_adreno200.so
04-02 13:24:50.741: I/DEBUG(3412): #03 pc 00091f14 /system/lib/egl/libGLESv2_adreno200.so
04-02 13:24:50.741: I/DEBUG(3412): #04 pc 0006087a /system/lib/egl/libGLESv2_adreno200.so
04-02 13:24:50.741: I/DEBUG(3412): #05 pc 00060942 /system/lib/egl/libGLESv2_adreno200.so
04-02 13:24:50.741: I/DEBUG(3412): #06 pc 00063210 /system/lib/egl/libGLESv2_adreno200.so
04-02 13:24:50.741: I/DEBUG(3412): #07 pc 000835e0 /system/lib/egl/libGLESv2_adreno200.so
04-02 13:24:50.741: I/DEBUG(3412): #08 pc 00014504 /system/lib/egl/libGLESv1_CM_adreno200.so
04-02 13:24:50.741: I/DEBUG(3412): #09 pc 0001d3c0 /system/lib/egl/libGLESv1_CM_adreno200.so
04-02 13:24:50.741: I/DEBUG(3412): #10 pc 0002be40 /system/lib/libandroid_runtime.so
04-02 13:24:50.741: I/DEBUG(3412): #11 pc 00018174 /system/lib/libdvm.so
04-02 13:24:50.741: I/DEBUG(3412): code around pc:
04-02 13:24:50.741: I/DEBUG(3412): afd0d1e0 f5d1f100 e2522040 f400022d f400422d
04-02 13:24:50.741: I/DEBUG(3412): afd0d1f0 2afffff8 e2822040 e2522020 3a000003
04-02 13:24:50.741: I/DEBUG(3412): afd0d200 f421020d e2522020 f400022d 2afffffb
04-02 13:24:50.741: I/DEBUG(3412): afd0d210 e2822020 e3120010 0a000001 f4210a0d
04-02 13:24:50.741: I/DEBUG(3412): afd0d220 f4000a2d e1b0ce82 3a000001 f421070d
04-02 13:24:50.741: I/DEBUG(3412): code around lr:
04-02 13:24:50.741: I/DEBUG(3412): 806029ec e5901008 e0836005 e1560001 8a000006
04-02 13:24:50.741: I/DEBUG(3412): 806029fc e5903000 e1a0100c e0830005 eb00099c
04-02 13:24:50.741: I/DEBUG(3412): 80602a0c e1a00004 e28dd008 e8bd8070 e59f004c
04-02 13:24:50.741: I/DEBUG(3412): 80602a1c e1a02005 e59fc048 e58d1000 e79e0000
04-02 13:24:50.741: I/DEBUG(3412): 80602a2c e08e100c e28000a8 ebfffef8 e3e00000
04-02 13:24:50.741: I/DEBUG(3412): stack:
04-02 13:24:50.741: I/DEBUG(3412): 45a98990 0000000a
04-02 13:24:50.741: I/DEBUG(3412): 45a98994 00000080
04-02 13:24:50.741: I/DEBUG(3412): 45a98998 00494e80
04-02 13:24:50.741: I/DEBUG(3412): 45a9899c 80886cd9 /system/lib/egl/libGLESv2_adreno200.so
04-02 13:24:50.741: I/DEBUG(3412): 45a989a0 00494e80
04-02 13:24:50.741: I/DEBUG(3412): 45a989a4 00000008
04-02 13:24:50.741: I/DEBUG(3412): 45a989a8 46b2a078
04-02 13:24:50.741: I/DEBUG(3412): 45a989ac 80898f25 /system/lib/egl/libGLESv2_adreno200.so
04-02 13:24:50.741: I/DEBUG(3412): 45a989b0 00368360
04-02 13:24:50.741: I/DEBUG(3412): 45a989b4 00000008
04-02 13:24:50.741: I/DEBUG(3412): 45a989b8 00000080
04-02 13:24:50.741: I/DEBUG(3412): 45a989bc 80899041 /system/lib/egl/libGLESv2_adreno200.so
04-02 13:24:50.751: I/DEBUG(3412): 45a989c0 00000008
04-02 13:24:50.751: I/DEBUG(3412): 45a989c4 00000000
04-02 13:24:50.751: I/DEBUG(3412): 45a989c8 df002777
04-02 13:24:50.751: I/DEBUG(3412): 45a989cc e3a070ad
04-02 13:24:50.751: I/DEBUG(3412): #00 45a989d0 4b89de00
04-02 13:24:50.751: I/DEBUG(3412): 45a989d4 80602a0c /system/lib/libgsl.so
04-02 13:24:50.751: I/DEBUG(3412): #01 45a989d8 00368360
04-02 13:24:50.751: I/DEBUG(3412): 45a989dc 00000020
04-02 13:24:50.751: I/DEBUG(3412): 45a989e0 004aa8e0
04-02 13:24:50.751: I/DEBUG(3412): 45a989e4 00371648
04-02 13:24:50.751: I/DEBUG(3412): 45a989e8 004aa8fc
04-02 13:24:50.751: I/DEBUG(3412): 45a989ec 80889e27 /system/lib/egl/libGLESv2_adreno200.so
04-02 13:24:51.132: I/BootReceiver(1361): Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE)
04-02 13:24:51.142: I/DEBUG(3412): debuggerd committing suicide to free the zombie!
04-02 13:24:51.182: I/DEBUG(3544): debuggerd: Nov 22 2011 21:11:52
04-02 13:24:51.222: D/dalvikvm(1361): GC_FOR_MALLOC freed 551K, 36% free 8894K/13703K, external 1258K/1770K, paused 78ms
04-02 13:24:51.222: V/DeviceStorageMonitorService(1361): freeMemory=1053483008
04-02 13:24:51.232: D/DeviceStorageMonitorService(1361): OoO SMS Memory available. SMS_AVAILABLE_THRESHOLD == 524288
04-02 13:24:51.232: I/DeviceStorageMonitorService(1361): Posting Message again
04-02 13:24:51.292: I/ActivityManager(1361): Process com.more2create.cityisland (pid 3526) has died.
Of course I googled this, and searched the internet for possible fixes, but found nothing really useful there.
People are talking about looking into the SO file (in this case libc.so) and find the line where the application crashes.
Now, the problem is that I am running Windows, and do not know how to dig into this matter any deeper. I am just stuck here...
So, my question is actually rather simple: Can anyone assist me here?
Is there some way to dig into this?
How can I find out what #00 pc 0000d200 /system/lib/libc.so
means?
回答1:
When Zygote throws a signal 11, that means some process attempted to access a forbidden memory zone. I suggest use android_print
to check the zone where the program tried to access and failed, using DDMS.
If you are using OpenGL remember it works in an independent thread, so initialize all variables used by OpenGL on constructors to avoid this kind of problem. Try to test rending a test, then use your game code.
回答2:
If you see SIGSEGV 11, code 1
with a call stack like libgles<blablabla...>
, the first thing you should do is check the OpenGL/EGL initialization. Different GPUs on Android may or may not support some features you request during OpenGL initialization. You should look into that and try to find the function that fails,
and add a code that will retry with working configuration parameters.
回答3:
I had a similar issue, and I solved just clicking on "Build -> Refresh Linked C++ Library".
Maybe can be useful for someone else.
来源:https://stackoverflow.com/questions/9975675/signal-11-sigsegv-code-1-segv-maperr