HarmonyOS Next运行cpp崩溃该怎么排查?

HarmonyOS Next运行cpp崩溃该怎么排查?
看日志是崩溃在主线程,而且没有我自己动态库的堆栈信息:

Device info:emulator
Build info:emulator 4.1.0.56(DEVC00E56R4P1log)
Fingerprint:66ff87023e7acbc48b8d1aecf87e13967a10e3ed292c55f32a94cb73567e45b4
Module name:com.qing.sdk
Version:1.0.0
VersionCode:1000000
PreInstalled:No
Foreground:Yes
Timestamp:2024-04-09 14:12:13.698
Pid:26632
Uid:20020041
Process name:com.qing.sdk
Reason:Signal:SIGSEGV(SEGV_MAPERR)@0x46c2fd00450cc400 
Fault thread Info:
Tid:26632, Name:com.qing.sdk
#00 pc 00000000011a270c /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#01 pc 00000000011a289c /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#02 pc 00000000011a3338 /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#03 pc 00000000011a13b0 /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#04 pc 00000000011a0730 /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#05 pc 0000000000f639d8 /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#06 pc 0000000000f582d4 /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#07 pc 00000000009a8824 /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#08 pc 00000000009a8ea4 /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#09 pc 000000000098f5b0 /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#10 pc 000000000094c60c /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#11 pc 000000000094e190 /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#12 pc 0000000000893310 /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#13 pc 00000000008932b0 /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#14 pc 0000000000a37b24 /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#15 pc 0000000000a3793c /system/lib64/platformsdk/libace_compatible.z.so(1759b483c398af5e439827bf6ff2905f)
#16 pc 000000000009e8f0 /system/lib64/libwm.z.so(OHOS::Rosen::VsyncStation::VsyncCallbackInner(long)+344)(6927b2f8eef737780b3f671993606847)
#17 pc 000000000009e3ac /system/lib64/libwm.z.so(6927b2f8eef737780b3f671993606847)
#18 pc 00000000000174d4 /system/lib64/libvsync.z.so(OHOS::Rosen::VSyncCallBackListener::OnReadable(int)+904)(970d78b85ad978f913c6a3b1f3def305)
#19 pc 0000000000014b44 /system/lib64/chipset-pub-sdk/libeventhandler.z.so(1dcc3f24bc79124c5c40338fa4205761)
#20 pc 0000000000012938 /system/lib64/chipset-pub-sdk/libeventhandler.z.so(OHOS::AppExecFwk::EventHandler::DistributeEvent(std::__h::unique_ptr<OHOS::AppExecFwk::InnerEvent, void (*)(OHOS::AppExecFwk::InnerEvent*)> const&)+840)(1dcc3f24bc79124c5c40338fa4205761)
#21 pc 000000000001d7ec /system/lib64/chipset-pub-sdk/libeventhandler.z.so(1dcc3f24bc79124c5c40338fa4205761)
#22 pc 000000000001f65c /system/lib64/chipset-pub-sdk/libeventhandler.z.so(OHOS::AppExecFwk::EventRunner::Run()+100)(1dcc3f24bc79124c5c40338fa4205761)
#23 pc 0000000000070f48 /system/lib64/platformsdk/libappkit_native.z.so(OHOS::AppExecFwk::MainThread::Start()+708)(94330b8925a9e6b22a4ea57e84134b66)
#24 pc 0000000000011030 /system/bin/appspawn(f835d8ac8a017168127045263ddcca76)
#25 pc 00000000000336a8 /system/bin/appspawn(f835d8ac8a017168127045263ddcca76)
#26 pc 0000000000033518 /system/bin/appspawn(f835d8ac8a017168127045263ddcca76)
#27 pc 000000000003020c /system/bin/appspawn(f835d8ac8a017168127045263ddcca76)
#28 pc 0000000000017b8c /system/lib64/chipset-pub-sdk/libbegetutil.z.so(5b9333ae8da2ec55e281a1a2a6165325)
#29 pc 0000000000017830 /system/lib64/chipset-pub-sdk/libbegetutil.z.so(5b9333ae8da2ec55e281a1a2a6165325)
#30 pc 00000000000153ac /system/lib64/chipset-pub-sdk/libbegetutil.z.so(5b9333ae8da2ec55e281a1a2a6165325)
#31 pc 0000000000014fc4 /system/lib64/chipset-pub-sdk/libbegetutil.z.so(5b9333ae8da2ec55e281a1a2a6165325)
#32 pc 000000000002ec60 /system/bin/appspawn(f835d8ac8a017168127045263ddcca76)
#33 pc 000000000001f034 /system/bin/appspawn(f835d8ac8a017168127045263ddcca76)
#34 pc 00000000000876fc /system/lib/ld-musl-aarch64.so.1(f53778d3455c921f0e7b0f1426816b31)
#35 pc 00000000000104cc /system/bin/appspawn(f835d8ac8a017168127045263ddcca76)
Registers:
x0:0000007f30b75600 x1:0000007f31e797a8 x2:0000000000000001 x3:0000007ff5676dd8
x4:0000007ff5676aa3 x5:65764572656e6e49 x6:65764572656e6e49 x7:746e65764572656e
x8:0000000000000000 x9:0000007f30b75690 x10:0000000000000000 x11:46c2fd00450cc400
x12:0000007f30b75690 x13:000000558cebf354 x14:0000000000000000 x15:0000000000000000
x16:0000007fbd434830 x17:0000007fbec81ec0 x18:0000000000000000 x19:0000007f30b75600
x20:0000007fb7220510 x21:0000007f31950000 x22:0000000000000000 x23:0000000000000000
x24:0000000000000000 x25:0000007ff5677258 x26:0000007f30b75660 x27:0000007f30b75690
x28:0000007fb748ad90 x29:0000007ff5676df8
lr:0000007f329e2500 sp:0000007ff5676db0 pc:0000007f329e270c
Other thread info:
Tid:26633, Name:IPC_0_26633
阅读 1.3k
avatarAI BotBETA

HarmonyOS Next运行cpp崩溃排查通常涉及以下几个步骤:

  1. 查看崩溃日志:首先,你需要仔细查看崩溃日志,确定崩溃发生的位置。从提供的日志中,我们可以看到崩溃发生在libace_compatible.z.so这个共享库中,具体的位置是pc 00000000011a270c
  2. 检查堆栈信息:堆栈信息通常可以告诉我们崩溃时的函数调用序列。在你的日志中,我们可以看到一系列的函数调用,从libace_compatible.z.so开始,一直到appspawn。这可以帮助你定位问题发生的具体位置。
  3. 调试和代码审查:使用调试工具(如GDB)在你的开发环境中重现崩溃,并检查崩溃发生时的代码。你需要审查崩溃点附近的代码,查看是否有任何可能导致崩溃的操作,如空指针解引用、数组越界等。
  4. 检查动态库:由于你的日志中没有显示你自己的动态库的堆栈信息,你需要确保你的动态库被正确加载,并且相关的符号信息可用。这样,当崩溃发生时,你才能看到完整的函数调用堆栈,包括你自己的代码。
  5. 多线程问题:由于日志中提到了多个线程(如Tid:26633, Name:IPC_0_26633),你还需要检查是否存在多线程相关的问题,如数据竞争、死锁等。
  6. 外部库和依赖:如果你使用了外部库或依赖,确保它们是兼容的,并且没有已知的与HarmonyOS Next相关的问题。
  7. 内存和资源管理:检查是否存在内存泄漏、资源未释放等问题。这些问题可能导致系统资源耗尽,从而引发崩溃。

综上所述,你需要结合日志、调试工具、代码审查等多种手段来排查HarmonyOS Next中的cpp崩溃问题。这可能是一个复杂的过程,需要耐心和细心。

1 个回答

这个我之前遇到过,不是so库的问题,是刷新列表控件时用的方法不对,不知道你是不是这种情况

logo
HarmonyOS
子站问答
访问
宣传栏