2014-02-10 26 views
1

我試圖在終端分割故障時使用Apportable

ROOTED=yes MTP=no apportable debug 
使用以下命令上使用Android模擬器中運行iOS應用 Apportable

我編譯和運行應用程序的Android模擬器中運行iOS應用

仿真器是建立與這些設置:

Can you install an Android Device Simulator in xcode when using Apportable

它編譯罰款,但我得到一個SIGSEGV分段當應用程序在仿真器的啓動畫面上時發生故障。當我嘗試使用bt獲得跟蹤時,它不顯示任何內容。

我試着用谷歌搜索關於如何得到錯誤的跟蹤,但沒有運氣的解決方案。

下面是從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

缺乏回溯通常表明GL駕駛員失事。不確定在模擬器上。您也可以嘗試x/200a $ sp來查找調用樹中的一些可能的符號。 –

+0

我沒有在我的應用程序中使用GL。好的,我會嘗試這個命令 –

+0

我用保存的命令'x/200a $ sp' –

回答

0

我嘗試使用apportable移植最新的cocos2d遊戲從的iTerm到Android模擬器。我成功地在Android模擬器上加載並測試了我的遊戲。這對我來說是非常棒的成就,因爲我不會購買新設備來測試Android設備中的應用程序。所以,這裏是解決方案。

經過一番研究,我發現由於仿真器缺少OpenGLES驅動程序路徑而出現了段錯誤。當初始化從終端仿真器(通過AVD經理加入),如果沒有正確地找到了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調試」(帶標誌)不適合我。我認爲這是因爲只有設備纔會支持調試加載而不是仿真器。我添加了幾個模擬器,並嘗試了它們,結果很好。

注意:我使用Macbook Pro Retina,16 GB RAM。模擬器的加載速度可能會有點慢,因爲它需要大量的RAM和處理。

快樂移植和一切順利。

+0

我沒有使用OpenGL,但只有UIKit –