信号11(SIGSEGV),代码1(SEGV_MAPERR)

11
我正在使用OpenGL在Android上创建2D游戏。 目前,我正在多台设备上测试和调试游戏。 我面临的问题是可怕的“signal 11”错误。
当我在我的三星Galaxy Nexus上玩耍时,一切都很顺利,我可以连续几个小时玩它而不会出现任何错误。我的Nexus运行Android 4.0冰淇淋三明治
现在,当我在其他设备上运行它时,我遇到了这个signal 11错误。 这些是抛出错误的设备:
  • HTC Desire HD(姜饼)
  • HTC Desire Z(姜饼)
  • HTC Wildfire(姜饼)
  • Advent Vega平板电脑(Vegacomb)
  • Asus EE Pad Transformer(冰淇淋三明治)
我无法在我的Advent Vega上使用USB调试,但是另外3个弹出错误的设备是可调试的。 看起来我需要root我的设备以获取有关signal 11错误的更多信息。 我已经成功root我的Galaxy Nexus和Desire HD。

由于错误似乎总是在游戏刚完成加载纹理时出现,所以我想我只需要一个已经root的设备来找出问题的原因,然后修复它,并在另一个设备上测试新版本。

一开始我认为这可能与内存管理有关(没有释放我的对象,因此执行了大量GC请求)。 所以经过几个小时的分析、优化、测试等,我发现这不是问题所在。

然后我假设这可能与线程安全有关(一个线程试图从内存中获取某个东西,而另一个线程刚刚销毁了该引用)。 但这似乎也不是情况。

好的,现在我已经将我的已root的Desire HD连接到了我的笔记本电脑上,并打开了我的Eclipse项目和DDMS运行。

那么,当游戏/应用程序崩溃时,logcat告诉我什么?

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.

当然,我谷歌了一下,并在互联网上搜索了可能的解决方法,但是没有找到真正有用的东西。
人们正在讨论查看SO文件(在此情况下为libc.so)并找到应用程序崩溃的行。
现在,问题是我正在运行Windows,不知道如何深入研究这个问题。我就卡在这里了...
所以,我的问题实际上相当简单:有人可以在这里帮助我吗? 有什么方法可以深入了解这个问题吗? 我怎样才能弄清楚“#00 pc 0000d200 / system / lib / libc.so”是什么意思?

尝试启用调试构建;这通常允许调试器将原始内存地址映射到符号,并指出您可能需要在代码中进行更改的位置。请参见https://dev59.com/sGkv5IYBdhLWcg3wiRMJ#10539883。 - Peter Tran
3个回答

7
当Zygote抛出信号11时,这意味着某个进程试图访问一个被禁止的内存区域。建议使用android_print检查程序尝试访问但失败的区域,使用DDMS进行调试。
如果您正在使用OpenGL,请记住它在独立的线程中运行,因此在构造函数中初始化所有由OpenGL使用的变量以避免此类问题。尝试测试渲染一个测试,然后再使用游戏代码。

“android_print”是什么意思?您是指我应该使用Log.d(或Log.v,无论哪种)来打印内容并找出上次打印的内容吗?它只在我的游戏代码中停顿,并且每次启动应用程序时都不会抛出错误。 - Edwin Morren
是的,我想说Log.d。问题是,如果你正在使用OpenGL,它在另一个线程中运行(独立的),所以有时候可能会工作,如果游戏线程在OpenGL线程尝试渲染之前完成工作。可能出现的问题有很多。 - vgonisanz

1
如果你看到类似 SIGSEGV 11, code 1 并且调用堆栈显示 libgles<blablabla...>,首先需要检查OpenGL/EGL初始化。安卓上的不同GPU可能会或者不会支持你在OpenGL初始化过程中所请求的一些特性。你应该去了解这些信息,并且尝试找到失败的函数,然后加入一个代码,使用可行的配置参数进行重试。

0

我曾经遇到过类似的问题,后来我只需点击“构建 -> 刷新链接的 C++ 库”就解决了。

也许对其他人有用。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接