HarmonyOS 鸿蒙Next 使用Hot Reload时出现cppcrash
HarmonyOS 鸿蒙Next 使用Hot Reload时出现cppcrash
报错信息如下:
DevEco Studio 5.0.0 Release
Reason:Signal:SIGABRT(SI_TKILL)@0x01317b2b0000a257 from:41559:20020011
LastFatalMessage:[gc] AllocateBuffer:629 size must have a size bigger than 0
Fault thread info:
Tid:41559, Name:m.bjev.arcfoxhw
#00 pc 0000000000199168 /system/lib/ld-musl-aarch64.so.1(raise+228)(2869c16473050fa2addbe1ee1a3d23c3)
#01 pc 0000000000146464 /system/lib/ld-musl-aarch64.so.1(abort+20)(2869c16473050fa2addbe1ee1a3d23c3)
#02 pc 000000000012b6cc /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::HiLog<(LogLevel)7, (Component)1>::~HiLog()+120)(63c6ed6518fd7e93e66407f4d66095fc)
#03 pc 0000000000391f40 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::JSPandaFileManager::JSPandaFileAllocator::AllocateBuffer(unsigned long)+476)(63c6ed6518fd7e93e66407f4d66095fc)
#04 pc 0000000000389040 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::JSPandaFile::InitializeUnMergedPF()+904)(63c6ed6518fd7e93e66407f4d66095fc)
#05 pc 00000000003889b0 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::JSPandaFile::JSPandaFile(panda::panda_file::File const*, std::__h::basic_string<char, std::__h::char_traits<char>, panda::ecmascript::CAddressAllocator<char>> const&)+268)(63c6ed6518fd7e93e66407f4d66095fc)
#06 pc 000000000038edd4 /system/lib64/platformsdk/libark_jsruntime.so(63c6ed6518fd7e93e66407f4d66095fc)
#07 pc 000000000038fdf0 /system/lib64/platformsdk/libark_jsruntime.so(63c6ed6518fd7e93e66407f4d66095fc)
#08 pc 00000000005542ec /system/lib64/platformsdk/libark_jsruntime.so(63c6ed6518fd7e93e66407f4d66095fc)
#09 pc 0000000000503cc4 /system/lib64/platformsdk/libark_jsruntime.so(63c6ed6518fd7e93e66407f4d66095fc)
#10 pc 00000000000497dc /system/lib64/platformsdk/libruntime.z.so(OHOS::AbilityRuntime::JsRuntime::LoadRepairPatch(std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const&, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const&)+940)(d1bc5eb4607d7d58ebbae6973c537d8a)
#11 pc 00000000000d4b24 /system/lib64/platformsdk/libappkit_native.z.so(accce9344f8b0a58bd8e708a2fe79f34)
#12 pc 000000000001be78 /system/lib64/chipset-pub-sdk/libeventhandler.z.so(OHOS::AppExecFwk::EventHandler::DistributeEvent(std::_h::unique_ptr<OHOS::AppExecFwk::InnerEvent, void ()(OHOS::AppExecFwk::InnerEvent)> const&)+1164)(1328fc6abaee8b59e32ed95fc1b51c6d)
#13 pc 000000000002d614 /system/lib64/chipset-pub-sdk/libeventhandler.z.so(OHOS::AppExecFwk::(anonymous namespace)::EventRunnerImpl::ExecuteEventHandler(std::h::unique_ptr<OHOS::AppExecFwk::InnerEvent, void ()(OHOS::AppExecFwk::InnerEvent)>&)+348)(1328fc6abaee8b59e32ed95fc1b51c6d)
#14 pc 000000000002ceec /system/lib64/chipset-pub-sdk/libeventhandler.z.so(OHOS::AppExecFwk::(anonymous namespace)::EventRunnerImpl::Run()+880)(1328fc6abaee8b59e32ed95fc1b51c6d)
#15 pc 000000000003028c /system/lib64/chipset-pub-sdk/libeventhandler.z.so(OHOS::AppExecFwk::EventRunner::Run()+524)(1328fc6abaee8b59e32ed95fc1b51c6d)
#16 pc 00000000000add30 /system/lib64/platformsdk/libappkit_native.z.so(OHOS::AppExecFwk::MainThread::Start()+604)(accce9344f8b0a58bd8e708a2fe79f34)
#17 pc 0000000000004e28 /system/lib64/appspawn/appspawn/libappspawn_ace.z.so(RunChildProcessor(AppSpawnContent*, AppSpawnClient*)+568)(2574785ced76437bdd7ad3960625908a)
#18 pc 000000000000aab8 /system/bin/appspawn(AppSpawnChild+484)(50a3e524fff0c73ef783b62473473a04)
#19 pc 000000000000a7a8 /system/bin/appspawn(AppSpawnProcessMsg+692)(50a3e524fff0c73ef783b62473473a04)
#20 pc 000000000001294c /system/bin/appspawn(ProcessSpawnReqMsg+520)(50a3e524fff0c73ef783b62473473a04)
#21 pc 0000000000011e48 /system/bin/appspawn(OnReceiveRequest+172)(50a3e524fff0c73ef783b62473473a04)
#22 pc 00000000000162e8 /system/lib64/chipset-pub-sdk/libbegetutil.z.so(HandleRecvMsg+344)(1a9fe0284bb87ed3804b4fb720c5c819)
#23 pc 0000000000015db4 /system/lib64/chipset-pub-sdk/libbegetutil.z.so(HandleStreamEvent+172)(1a9fe0284bb87ed3804b4fb720c5c819)
#24 pc 000000000001348c /system/lib64/chipset-pub-sdk/libbegetutil.z.so(ProcessEvent+108)(1a9fe0284bb87ed3804b4fb720c5c819)
#25 pc 000000000001304c /system/lib64/chipset-pub-sdk/libbegetutil.z.so(RunLoop+356)(1a9fe0284bb87ed3804b4fb720c5c819)
#26 pc 000000000000fef8 /system/bin/appspawn(AppSpawnRun+136)(50a3e524fff0c73ef783b62473473a04)
#27 pc 000000000000d89c /system/bin/appspawn(main+764)(50a3e524fff0c73ef783b62473473a04)
#28 pc 00000000000a0c38 /system/lib/ld-musl-aarch64.so.1(libc_start_main_stage2+64)(2869c16473050fa2addbe1ee1a3d23c3)
针对HarmonyOS 鸿蒙Next 使用Hot Reload时出现cppcrash的问题,这通常指示应用程序的C++部分存在错误,可能是内存访问违规、空指针解引用、数组越界等问题。以下是一些解决步骤:
- 检查日志:利用HarmonyOS提供的日志系统(如HiLog)来捕获更多崩溃前的状态信息,定位崩溃的代码位置。
- 代码审查:确保所有对象在使用前已正确初始化,且在不再需要时适当释放。特别注意检查Hot Reload相关的代码部分。
- 使用工具:使用静态分析工具(如AddressSanitizer)和调试器(如GDB)来帮助定位问题。
- 更新系统:检查是否有可用的HarmonyOS更新,有时系统更新能解决已知的bug。
如果上述步骤无法解决问题,可能是更复杂的系统或应用兼容性问题。此时,建议联系鸿蒙系统的官方客服以获取更专业的支持。官网客服地址是:https://www.itying.com/category-93-b0.html 。