[Android] Debugging a crash

Hi,

i run into a crash with a debug.apk. usually in the debug version i see where the crash happens, but not here. Used nostrip in .hxcpp_config.xml without luck. The crash happens after a while, without doing anything. It works fine in js, neko and windows target. What can i do to get more information here?

0libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x5b65ff in tid 1878 (SDLThread), pid 1761 (SDLActivity)
0DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
0DEBUG   : Build fingerprint: 'motorola/nash/nash:9/PPX29.159-24/e78f1:user/release-keys'
0DEBUG   : Revision: 'pvt'
0DEBUG   : ABI: 'arm64'
0DEBUG   : pid: 1761, tid: 1878, name: SDLThread  >>> com.plutoniumbytes.zoo <<<
0DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x5b65ff
0DEBUG   :     x0  00000000005b65ff  x1  00000072c5e67ae8  x2  0000000000000008  x3  00000072af6a9a00
0DEBUG   :     x4  0000000000000000  x5  0000000000000004  x6  0000000c00000008  x7  b3a135680001000c
0DEBUG   :     x8  00000072b1fff738  x9  0000000000000001  x10 0000000000000001  x11 b375ce8400000072
0DEBUG   :     x12 b1ffdc1800000072  x13 c5eece0000000072  x14 0000000000000000  x15 00000072b1ffda78
0DEBUG   :     x16 00000072b3daaf58  x17 00000073528a0ff0  x18 0000000000000001  x19 0000000000000004
0DEBUG   :     x20 00000072af9eff6c  x21 00000072b1a5da54  x22 00000072b1ffebc0  x23 00000072b5635dd2
0DEBUG   :     x24 000000000000000c  x25 00000072b1fff588  x26 00000072c44b30a0  x27 0000000000000003
0DEBUG   :     x28 0000000000000001  x29 00000072b1ffe840
0DEBUG   :     sp  00000072b1ffd8e0  lr  00000072b36f365c  pc  00000072b2a74a34
0DEBUG   :
0DEBUG   : backtrace:
0DEBUG   :     #00 pc 000000000022ca34  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #01 pc 0000000000eab658  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #02 pc 0000000000eab4a0  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #03 pc 0000000000eabaec  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #04 pc 0000000000ef1648  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #05 pc 0000000000ef5430  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #06 pc 0000000000ef56f0  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #07 pc 0000000000ef49fc  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #08 pc 0000000000ef742c  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #09 pc 0000000000ef7ca4  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #10 pc 0000000000f14e80  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #11 pc 0000000000f1a424  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #12 pc 0000000000da99dc  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #13 pc 00000000007603fc  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #14 pc 000000000066b48c  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #15 pc 0000000000884dcc  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #16 pc 000000000075441c  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #17 pc 0000000000cfaea0  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #18 pc 00000000006337a0  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #19 pc 0000000000ebb68c  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #20 pc 000000000022edd0  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #21 pc 00000000002852f4  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #22 pc 0000000000cd2e94  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #23 pc 0000000000cd3244  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #24 pc 0000000000ebb078  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #25 pc 0000000000eb04d4  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #26 pc 00000000000d7390  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/liblime.so
0DEBUG   :     #27 pc 00000000000f1df8  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/liblime.so
0DEBUG   :     #28 pc 000000000015d468  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/liblime.so
0DEBUG   :     #29 pc 000000000015ea94  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/liblime.so
0DEBUG   :     #30 pc 000000000015d228  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/liblime.so
0DEBUG   :     #31 pc 0000000000101908  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/liblime.so
0DEBUG   :     #32 pc 0000000000cd1770  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #33 pc 0000000000630e80  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #34 pc 0000000000df7a7c  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #35 pc 0000000000df798c  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #36 pc 0000000000df688c  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #37 pc 0000000000e8bb90  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so
0DEBUG   :     #38 pc 0000000000e8ba58  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/libApplicationMain.so (hxcpp_main+36)
0DEBUG   :     #39 pc 00000000008e2790  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/lib/arm64/liblime.so (Java_org_libsdl_app_SDLActivity_nativeRunMain+784)
0DEBUG   :     #40 pc 0000000000010034  /data/app/com.bar.fu-0fk_PmnwKx5o7edcEfp9lw==/oat/arm64/base.odex (offset 0xf000) (org.libsdl.app.SDLActivity.nativeRunMain+228)
0DEBUG   :     #41 pc 0000000000556c4c  /system/lib64/libart.so (art_quick_invoke_static_stub+604)
0DEBUG   :     #42 pc 00000000000cf8e8  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
0DEBUG   :     #43 pc 000000000028058c  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
0DEBUG   :     #44 pc 000000000027a594  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968)
0DEBUG   :     #45 pc 0000000000527b4c  /system/lib64/libart.so (MterpInvokeStatic+204)
0DEBUG   :     #46 pc 0000000000549194  /system/lib64/libart.so (ExecuteMterpImpl+14612)
0DEBUG   :     #47 pc 000000000018e7b4  /data/app/com.plutoniumbytes.zoo-0fk_PmnwKx5o7edcEfp9lw==/oat/arm64/base.vdex (org.libsdl.app.SDLMain.run+156)
0DEBUG   :     #48 pc 0000000000254298  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.3255411284+488)
0DEBUG   :     #49 pc 0000000000516edc  /system/lib64/libart.so (artQuickToInterpreterBridge+1020)
0DEBUG   :     #50 pc 000000000055fafc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
0DEBUG   :     #51 pc 000000000025cfc8  /system/framework/arm64/boot-core-oj.oat (offset 0x114000) (java.lang.Thread.run+72)
0DEBUG   :     #52 pc 0000000000556988  /system/lib64/libart.so (art_quick_invoke_stub+584)
0DEBUG   :     #53 pc 00000000000cf8c8  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
0DEBUG   :     #54 pc 000000000045e778  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
0DEBUG   :     #55 pc 000000000045f834  /system/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+424)
0DEBUG   :     #56 pc 000000000048a6d0  /system/lib64/libart.so (art::Thread::CreateCallback(void*)+1120)
0DEBUG   :     #57 pc 00000000000819b8  /system/lib64/libc.so (__pthread_start(void*)+36)
0DEBUG   :     #58 pc 0000000000023440  /system/lib64/libc.so (__start_thread+68)

I’m still facing random crashes ( gc / thread, no idea ), but i ran into this, too:
I/gclog: Memory exhausted.
I/gclog: try HXCPP_GC_BIG_BLOCKS.

With HXCPP_GC_BIG_BLOCKS it starts ( for a while ) but i had a bigger project which had no need to use it. This is for bigger blocks than 2gb? How can this happen, i do not use that big blocks in any way? Assets maybe? I’m using 1.8k files which are together 85mb. A test with 1k files less didn’t help.

You can use ndk-stack to map those memory addresses in the backtrace to the associated lines in cpp. This will probably help you pinpoint where the app is crashing.

I had a dynamic object defined with 1000+ entries. Moved all values to big arrays and no problems anymore :grimacing: