cocos2dx 3.17.2 在安卓64位 cocos2d::StringUtils::format 闪退

信息如下:

    --------- beginning of crash
2019-07-22 22:16:29.978 17953-17596/? A/google-breakpad: Microdump skipped (uninteresting)
2019-07-22 22:16:30.001 17525-17596/? W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
2019-07-22 22:16:30.001 17525-17596/? W/google-breakpad: Chrome build fingerprint:
2019-07-22 22:16:30.001 17525-17596/? W/google-breakpad: 72.0.3626.121
2019-07-22 22:16:30.001 17525-17596/? W/google-breakpad: 362612150
2019-07-22 22:16:30.001 17525-17596/? W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
2019-07-22 22:16:30.005 17525-17596/? A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x313a3232203232 in tid 17596 (GLThread 19769), pid 17525 (gue.pocketgames)
2019-07-22 22:16:30.017 17525-17837/? V/AudioMixerController: Mix a frame waste: 7.866000ms
2019-07-22 22:16:30.022 700-17846/? D/audio_hw_primary: copl(0xeb17d800):out of compress_wait
2019-07-22 22:16:30.025 700-17850/? D/audio_hw_primary: No space available in compress driver, post msg to cb thread
2019-07-22 22:16:30.025 700-17846/? D/audio_hw_primary: copl(0xeb17d800):calling compress_wait
2019-07-22 22:16:30.110 17959-17959/? I/crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
2019-07-22 22:16:30.113 993-993/? I//system/bin/tombstoned: received crash request for pid 17596
2019-07-22 22:16:30.115 17959-17959/? I/crash_dump64: performing dump of process 17525 (target tid = 17596)
2019-07-22 22:16:30.130 17959-17959/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-07-22 22:16:30.130 17959-17959/? A/DEBUG: Build fingerprint: 'Xiaomi/sagit/sagit:9/PKQ1.190118.001/9.5.16:user/release-keys'
2019-07-22 22:16:30.130 17959-17959/? A/DEBUG: Revision: '0'
2019-07-22 22:16:30.130 17959-17959/? A/DEBUG: ABI: 'arm64'
2019-07-22 22:16:30.130 17959-17959/? A/DEBUG: pid: 17525, tid: 17596, name: GLThread 19769  >>> com.tennisleague.pocketgames <<<
2019-07-22 22:16:30.130 17959-17959/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x313a3232203232
2019-07-22 22:16:30.130 17959-17959/? A/DEBUG:     x0  36313a3232203232  x1  0000006fc30e8e40  x2  0000000000000009  x3  0000006fc3125212
2019-07-22 22:16:30.130 17959-17959/? A/DEBUG:     x4  0000000000000232  x5  0000000000000002  x6  0000000000000030  x7  0000006f1e3fa114
2019-07-22 22:16:30.131 17959-17959/? A/DEBUG:     x8  0101010101010101  x9  0000000000000008  x10 0000000000000000  x11 00000000ffffffff
2019-07-22 22:16:30.131 17959-17959/? A/DEBUG:     x12 0000006f1e3fa118  x13 0000000000000000  x14 0000006f1e3fa130  x15 0000000000000001
2019-07-22 22:16:30.131 17959-17959/? A/DEBUG:     x16 0000006fc31230e8  x17 0000006fc3032990  x18 0000006f1e3fa6a8  x19 0000006f1e3fa6c0
2019-07-22 22:16:30.131 17959-17959/? A/DEBUG:     x20 0000000000000045  x21 000000007fffffff  x22 0000006f20123c13  x23 0000000000000000
2019-07-22 22:16:30.131 17959-17959/? A/DEBUG:     x24 0000006f1e3fa584  x25 0000006f1e3fa130  x26 36313a3232203232  x27 0000006f1e3fa6a8
2019-07-22 22:16:30.131 17959-17959/? A/DEBUG:     x28 00000000ffffffff  x29 0000006f1e3fa680
2019-07-22 22:16:30.131 17959-17959/? A/DEBUG:     sp  0000006f1e3f9ef0  lr  0000006fc307da18  pc  0000006fc30329a0
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG: backtrace:
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #00 pc 000000000001e9a0  /system/lib64/libc.so (strlen+16)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #01 pc 0000000000069a14  /system/lib64/libc.so (__vfprintf+6056)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #02 pc 000000000008b2c0  /system/lib64/libc.so (vsnprintf+164)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #03 pc 0000000001501890  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (cocos2d::StringUtils::format(char const*, ...)+592)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #04 pc 00000000007675bc  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (AttributePanel::updateVisualValue(Attribute*)+2392)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #05 pc 0000000000a25878  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (PagePlayers::updateEquip(cocos2d::EquipType, int, bool)+1272)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #06 pc 0000000000a1f55c  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (PagePlayers::BackpackItemClick(cocos2d::Ref*)+1532)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #07 pc 0000000000a2c5a4  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (_ZNSt6__ndk128__invoke_void_return_wrapperIvE6__callIJRNS_6__bindIM11PagePlayersFvPN7cocos2d3RefEEJPS4_RKNS_12placeholders4__phILi1EEEEEES7_EEEvDpOT_+480)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #08 pc 0000000000a2c240  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (_ZNSt6__ndk110__function6__funcINS_6__bindIM11PagePlayersFvPN7cocos2d3RefEEJPS3_RKNS_12placeholders4__phILi1EEEEEENS_9allocatorISF_EEFvS6_EEclEOS6_+52)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #09 pc 00000000008b18bc  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (std::__ndk1::function<void (cocos2d::Ref*)>::operator()(cocos2d::Ref*) const+160)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #10 pc 0000000001070478  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (cocos2d::ui::Widget::releaseUpEvent()+288)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #11 pc 00000000010701d8  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (cocos2d::ui::Widget::onTouchEnded(cocos2d::Touch*, cocos2d::Event*)+164)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #12 pc 000000000107862c  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (_ZNSt6__ndk128__invoke_void_return_wrapperIvE6__callIJRNS_6__bindIMN7cocos2d2ui6WidgetEFvPNS4_5TouchEPNS4_5EventEEJPS6_RKNS_12placeholders4__phILi1EEERKNSF_ILi2EEEEEES8_SA_EEEvDpOT_+692)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #13 pc 00000000010781f4  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (_ZNSt6__ndk110__function6__funcINS_6__bindIMN7cocos2d2ui6WidgetEFvPNS3_5TouchEPNS3_5EventEEJPS5_RKNS_12placeholders4__phILi1EEERKNSE_ILi2EEEEEENS_9allocatorISL_EEFvS7_S9_EEclEOS7_OS9_+68)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #14 pc 00000000014ab694  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (std::__ndk1::function<void (cocos2d::Touch*, cocos2d::Event*)>::operator()(cocos2d::Touch*, cocos2d::Event*) const+176)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #15 pc 00000000014aa704  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #16 pc 00000000014aa1d4  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #17 pc 00000000014aa068  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #18 pc 0000000001491c00  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (std::__ndk1::function<bool (cocos2d::EventListener*)>::operator()(cocos2d::EventListener*) const+160)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #19 pc 0000000001492500  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (cocos2d::EventDispatcher::dispatchTouchEventToListeners(cocos2d::EventDispatcher::EventListenerVector*, std::__ndk1::function<bool (cocos2d::EventListener*)> const&)+2252)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #20 pc 0000000001493654  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (cocos2d::EventDispatcher::dispatchTouchEvent(cocos2d::EventTouch*)+1284)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #21 pc 00000000014928a4  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (cocos2d::EventDispatcher::dispatchEvent(cocos2d::Event*)+112)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #22 pc 000000000141a738  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (cocos2d::GLView::handleTouchesOfEndOrCancel(cocos2d::EventTouch::EventCode, int, long*, float*, float*)+1492)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #23 pc 000000000141a954  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (cocos2d::GLView::handleTouchesEnd(int, long*, float*, float*)+60)
2019-07-22 22:16:30.192 17959-17959/? A/DEBUG:     #24 pc 0000000000d73dec  /data/app/com.tennisleague.pocketgames-GQrJVqIVCbzwZGikvISL6Q==/lib/arm64/libMyGame.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd+84)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #25 pc 00000000005605e0  /system/lib64/libart.so (art_quick_generic_jni_trampoline+144)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #26 pc 000000000055784c  /system/lib64/libart.so (art_quick_invoke_static_stub+604)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #27 pc 00000000000cfd14  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #28 pc 0000000000280364  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #29 pc 000000000027a378  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #30 pc 0000000000527b58  /system/lib64/libart.so (MterpInvokeStatic+204)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #31 pc 0000000000549c94  /system/lib64/libart.so (ExecuteMterpImpl+14612)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #32 pc 000000000036eebc  <anonymous:0000006f22673000> (org.cocos2dx.lib.Cocos2dxRenderer.handleActionUp)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #33 pc 000000000025407c  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.503861493+488)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #34 pc 0000000000259b70  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #35 pc 000000000027a35c  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #36 pc 0000000000526654  /system/lib64/libart.so (MterpInvokeVirtual+588)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #37 pc 0000000000549b14  /system/lib64/libart.so (ExecuteMterpImpl+14228)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #38 pc 000000000036b21c  <anonymous:0000006f22673000> (org.cocos2dx.lib.Cocos2dxGLSurfaceView$10.run+24)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #39 pc 000000000025407c  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.503861493+488)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #40 pc 0000000000259b70  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #41 pc 000000000027a35c  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #42 pc 00000000005275d0  /system/lib64/libart.so (MterpInvokeInterface+1392)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #43 pc 0000000000549d14  /system/lib64/libart.so (ExecuteMterpImpl+14740)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #44 pc 0000000000b9949a  /system/framework/boot-framework.vdex (android.opengl.GLSurfaceView$GLThread.guardedRun+670)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #45 pc 000000000025407c  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.503861493+488)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #46 pc 0000000000259b70  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #47 pc 000000000027a35c  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #48 pc 0000000000527994  /system/lib64/libart.so (MterpInvokeDirect+296)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #49 pc 0000000000549c14  /system/lib64/libart.so (ExecuteMterpImpl+14484)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #50 pc 0000000000b99bcc  /system/framework/boot-framework.vdex (android.opengl.GLSurfaceView$GLThread.run+48)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #51 pc 000000000025407c  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.503861493+488)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #52 pc 0000000000516f08  /system/lib64/libart.so (artQuickToInterpreterBridge+1020)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #53 pc 00000000005606fc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #54 pc 0000000000557588  /system/lib64/libart.so (art_quick_invoke_stub+584)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #55 pc 00000000000cfcf4  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #56 pc 000000000045df08  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #57 pc 000000000045efc4  /system/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+424)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #58 pc 0000000000489eb4  /system/lib64/libart.so (art::Thread::CreateCallback(void*)+1120)
2019-07-22 22:16:30.193 17959-17959/? A/DEBUG:     #59 pc 00000000000901b0  /system/lib64/libc.so (__pthread_start(void*)+36)
2019-07-22 22:16:30.194 17959-17959/? A/DEBUG:     #60 pc 0000000000023930  /system/lib64/libc.so (__start_thread+68)

有大佬遇到过着个问题吗?
或者这个应该怎么解决呢?

有大佬帮看看这个问题吗~~

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR),
数据读写哪里有问题?

额。。我不是太清楚这个东西。。该怎么调啊

有没有大佬给看看的啊~~~~:6:

用C++开发项目?

对 3.17.2的 cocos2dx

求围观啊~~

有重现的例子吗?

从代码上看,用的是 cocos studio?

啊~~
解决了~
有一行 CCLOG 拆开写就没事了。不知道为啥

是不是日志太长,把那条触发闪退的日志写到文件里发出来看看

需要修改框架的一个宏定义,编译一次时间太久,就不折腾了。后面有时间再做测试

具体是修改哪里呢?能否分享一下?

我框架自定义了一下 LOG 的一个宏为了显示文件名和行号,方便定位输出位置

#elif COCOS2D_DEBUG == 1
#define DELOG(file,line,s, ...) {\
	std::string info = StringUtils::format("%s,line:%d", StringUtil::getFileName(file).c_str(), line); \
	cocos2d::log("%s -> %s", info.c_str(), cocos2d::StringUtils::format(s, ##__VA_ARGS__).c_str()); \
}

然后后面用的时候有一行输出

DELOG(__FILE__, __LINE__, "befor: %d,%d,%d,after:%d,%d,%d  --> %s", aaa, bbb, ccc, ddd, eee, fff,DateUtils::getCurrentFormatTime("%Y-%m-%d %H:%M:%S").c_str());

到这一句就挂掉了,注释掉就没事了
但是在安卓非64位上就没事,或者拆开写,在安卓64位上也没事

怀疑Android 64 __LINE__默认是个64位整数,导致奔溃

你打印一下

 const char* typeName = typeid(__LINE__).name();
 cocos2d::log("The type of '__LINE__' macro is: %s", typeName);

我这边Visual Studio 2019看是long类型,long在android 64位下是8字节,所以不能用%d