我正在尝试使用Apportable
我在终端
中使用以下命令编译并运行应用程序ROOTED=yes MTP=no apportable debug
使用以下设置设置模拟器:
Can you install an Android Device Simulator in xcode when using Apportable
它编译得很好,但是当应用程序在模拟器的启动画面上时,我得到SIGSEGV
分段错误。当我尝试使用bt
进行跟踪时,它没有显示任何内容。
我已经尝试使用Google搜索解决方案,了解如何查找错误,但没有运气。
以下是Terminal
的输出:
Debugging...
1871 KB/s (26836917 bytes in 14.005s)
pkg: /data/local/tmp/Chaser-debug.apk
Success
Starting: Intent { cmp=Cromian.CHASER/com.apportable.activity.VerdeActivity (has extras) }
Failed to load one the Breakpoints files:
/Users/Anders/Documents/Xcode/iOS_code/Cromian/Chaser/chaser_app/Chaser.xcodeproj/xcuserdata/Anders.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
/Users/Anders/Documents/Xcode/iOS_code/Cromian/Chaser/chaser_app/Chaser.xcodeproj/xcuserdata/Anders.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
Attaching to pid 1149
Attached; pid = 1149
Listening on port 5039
657 KB/s (9592 bytes in 0.014s)
GNU gdb (GDB) 7.5-https://github.com/apportable/gdb Jan 3 2014 13:47:56
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin12.4.0 --target=arm-elf-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Remote debugging from host 127.0.0.1
warning: Could not load shared library symbols for gralloc.goldfish.so.
Do you need "set solib-search-path" or "set sysroot"?
libthread_db:td_ta_new: Probing system for platform bug.
libthread_db:td_ta_new: Running as root, nothing to do.
0x40037ebc in epoll_wait ()
from /Users/Anders/.apportable/cache/devices/emulator-5554/libs/libc.so
$1 = 1
$2 = 0
Breakpoint 1 at 0x5cadf2c8: file /Users/Anders/Documents/Xcode/iOS_code/Cromian/Chaser/chaser_app/Chaser/main.m, line 13.
Breakpoint 2 at 0x5a1d8ed0
[New Thread 1169]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1169]
0x40005a1e in ?? ()
(gdb) bt
#0 0x40005a1e in ?? ()
#1 0x400044d2 in ?? ()
#2 0x400044d2 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
如何找到分段错误的原因?
编辑: 通过使用命令x / 200a $ sp,我可以在分段错误后得到以下跟踪:
(gdb) x/200a $sp
0x57b7fac0: 0x0 0x0 0x57b7fbe0 0xcb18276c
0x57b7fad0: 0x0 0x0 0x40015964 0x40015a88
0x57b7fae0: 0x40015bac 0x40015cd0 0x40010bd4 0x40011064
0x57b7faf0: 0x40011188 0x400100ac 0x40010cf8 0x40010e1c
0x57b7fb00: 0x40010f40 0x0 0x28 0x0
0x57b7fb10: 0xcb18276c 0xcb18276c 0xcb18276c 0x3f000000
0x57b7fb20: 0x0 0xffffffd1 0x2d0 0x0
0x57b7fb30: 0x4045adcc 0x2a19da10 0x2a187260 0x4045fcb0
0x57b7fb40: 0x404584b8 0x1 0x57b80c6c 0x4003ecbb <snprintf+79>
0x57b7fb50: 0x0 0x0 0x400174c4 0x580ce000
0x57b7fb60: 0x580ce034 0x40003ff9 0x400175c0 0x57b7fc07
0x57b7fb70: 0x0 0xfdc 0xffff0208 0x57b7fbe4
0x57b7fb80: 0xfff 0x26 0x57b7fba8 0x400174c4
0x57b7fb90: 0x0 0x57b7fbe4 0x2a187260 0x4045fcb0
0x57b7fba0: 0x404584b8 0x40003f4b 0x57b7fbe4 0x4000
0x57b7fbb0: 0x3c14001 0x3c10000 0x57b7fbe4 0x4045adcc
0x57b7fbc0: 0x2a19da10 0x400050bf 0x0 0x4044758f
0x57b7fbd0: 0x2a187260 0x5a8ff01c <__CFStrAllocateMutableContents+80> 0x584d1040 0x4006b228 <__stack_chk_guard>
0x57b7fbe0: 0x30025 0x7379732f 0x2f6d6574 0x2f62696c
0x57b7fbf0: 0x2f6c6765 0x4562696c 0x655f4c47 0x616c756d
0x57b7fc00: 0x6e6f6974 0x6f732e 0x0 0x0
0x57b7fc10: 0x0 0x0 0x0 0x0
0x57b7fc20: 0x0 0x20 0x5a86695c <__CFAllocatorSystemAllocate> 0x0
0x57b7fc30: 0x57b7fd08 0x1 0x0 0x5844f640 <arena_malloc+1020>
0x57b7fc40: 0x5b04ae00 0x0 0x1728 0x12
0x57b7fc50: 0x0 0x10 0x20 0x1
0x57b7fc60: 0x57b7fc80 0x58449d48 <__wrap_malloc+240> 0x57b7fc78 0x20
0x57b7fc70: 0x600 0x5d1b9461 0x1 0x5d1b9440
0x57b7fc80: 0x5d1b9460 0x0 0x5d1b9460 0x0
0x57b7fc90: 0x0 0x14 0xcb18276c 0x20
0x57b7fca0: 0x12 0x2 0x57b7fd80 0x1
0x57b7fcb0: 0xa 0x0 0x5a9d2270 <_MergedGlobals+112> 0x7
0x57b7fcc0: 0x0 0x5d1b9581 0xcb18276c 0x5d1b9560
---Type <return> to continue, or q <return> to quit---
0x57b7fcd0: 0x5d1b9580 0x0 0x5d1b9580 0x0
0x57b7fce0: 0x0 0x3 0x0 0x20
0x57b7fcf0: 0x2 0x1 0x57b7fdd0 0x1
0x57b7fd00: 0xa 0x0 0x5a9d2270 <_MergedGlobals+112> 0x57b7fe08
0x57b7fd10: 0x2c78 0x0 0x0 0x57b7fd20
0x57b7fd20: 0x200078c 0x5a1b6860 <OSAtomicCompareAndSwap32+76> 0x5a86695c <__CFAllocatorSystemAllocate> 0x6325
0x57b7fd30: 0x584d11a8 0x7fffffff 0xa 0x4004471b <strtol+163>
0x57b7fd40: 0x5d1b9584 0x57b7fd94 0xa 0x5d1b9583
0x57b7fd50: 0x5d1b9584 0x1 0x5d1a67e0 0x1
0x57b7fd60: 0x584d10d0 0x88 0x5d1a67e0 0x5844f65c <arena_malloc+1048>
0x57b7fd70: 0x584d11a8 0x1 0x584d1040 0x1728
0x57b7fd80: 0x5d1b95e0 0x0 0x584d1358 0x584d1040
0x57b7fd90: 0x0 0x5844f640 <arena_malloc+1020> 0x5d1b3cc4 0x0
0x57b7fda0: 0x1728 0x7c 0x584d1040 0x5a2e64dc <_atomic_lock>
0x57b7fdb0: 0x20348 0x5b00f660 0x584d1040 0x80860000
0x57b7fdc0: 0x20348 0x5b00f660 0x80860000 0x5a1b6860 <OSAtomicCompareAndSwap32+76>
0x57b7fdd0: 0x5cc3a164 <OBJC_CLASS_$_VerdeActivity> 0x5b04ae00 0x5cc3a164 <OBJC_CLASS_$_VerdeActivity> 0x1e
答案 0 :(得分:0)
我尝试使用apportable将最新的cocos2d游戏从iTerm移植到android模拟器。我在android模拟器上成功加载并测试了我的游戏。这对我来说是一项伟大的成就,因为我不会购买新的设备来测试我在Android设备上的应用程序。所以,这是解决方案。
经过一番研究,我发现由于仿真器缺少OpenGLES驱动程序路径而发生了分段错误。在从终端初始化仿真器(通过AVD Manager添加)时,如果未正确找到OpenGL路径,终端将在控制台中显示错误,如下所示:
emulator: ERROR: Could not load OpenGLES emulation library: dlopen(libOpenglRender.dylib, 1): image not found
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
因此,如果您不解决此问题,肯定会发生分段错误。要解决此问题,您需要导出android sdk工具的lib路径。查看here了解详情。
修复openGLES驱动程序路径后。您可以使用“apportable load”命令将游戏加载到Android模拟器。请注意,“apportable debug”(带有标志)对我没有用。我认为这是因为只有设备支持调试加载而不是模拟器。我添加了几个模拟器并尝试了它们,结果很好。
注意:我使用的Macbook pro Retina配有16 GB内存。由于需要大量的RAM和处理,因此加载仿真器可能会有点慢。
快乐的移植和一切顺利。