diff --git a/interfaces/innerkits/dump_catcher/dfx_dump_catcher.cpp b/interfaces/innerkits/dump_catcher/dfx_dump_catcher.cpp index 84aad6aaa3e155d012ae91902796904f25b80ada..cca253162e102e40175adb726c8fa24b2110e6c1 100644 --- a/interfaces/innerkits/dump_catcher/dfx_dump_catcher.cpp +++ b/interfaces/innerkits/dump_catcher/dfx_dump_catcher.cpp @@ -282,6 +282,11 @@ bool DfxDumpCatcher::DoDumpCatchRemote(int pid, int tid, std::string& msg, bool default: break; } + + if (!ret && isJson && msg != "") { + DFXLOG_INFO("%s :: %s json msg not empty!", DFXDUMPCATCHER_TAG.c_str(), __func__); + ret = true; + } DFXLOG_INFO("%s :: %s :: pid(%d) ret: %d", DFXDUMPCATCHER_TAG.c_str(), __func__, pid, ret); return ret; } @@ -420,7 +425,6 @@ bool DfxDumpCatcher::DoReadRes(int fd, bool &ret, std::string& msg) DFXLOG_WARN("%s :: %s :: read error", DFXDUMPCATCHER_TAG.c_str(), __func__); return false; } - if (res == DumpErrorCode::DUMP_ESUCCESS) { ret = true; } diff --git a/test/moduletest/faultloggerd_module_test.cpp b/test/moduletest/faultloggerd_module_test.cpp index c8b1cd0eb9fa048397d0b1f10cb8461eac806353..b2d9443ccf3c2a97fe389fae3b4efc4392a94f73 100644 --- a/test/moduletest/faultloggerd_module_test.cpp +++ b/test/moduletest/faultloggerd_module_test.cpp @@ -150,6 +150,7 @@ HWTEST_F(FaultloggerdModuleTest, FaultloggerdClientFdRquestTest004, TestSize.Lev */ HWTEST_F(FaultloggerdModuleTest, FaultloggerdClientPipeFdRquestTest001, TestSize.Level0) { + sleep(8); // Wait for the last request to complete. RequestSdkDump(getpid(), getpid()); int32_t pipeFd = RequestPipeFd(getpid(), FaultLoggerPipeType::PIPE_FD_READ_BUF); ASSERT_NE(pipeFd, -1); diff --git a/test/unittest/unwind/unwinder_test.cpp b/test/unittest/unwind/unwinder_test.cpp index 8e93c2ae38fb7318fd4b385a0b8f6a0373d517f0..5c68570bad03d899a02e97684735423a493a19bb 100644 --- a/test/unittest/unwind/unwinder_test.cpp +++ b/test/unittest/unwind/unwinder_test.cpp @@ -909,6 +909,31 @@ HWTEST_F(UnwinderTest, GetSymbolByPcTest001, TestSize.Level2) ASSERT_FALSE(unwinder->GetSymbolByPc(pc0, maps, funcName, funcOffset)); // Get elf is null GTEST_LOG_(INFO) << "GetSymbolByPcTest001: end."; } + +/** + * @tc.name: AccessMemTest001 + * @tc.desc: test unwinder AccessMem interface + * @tc.type: FUNC + */ +HWTEST_F(UnwinderTest, AccessMemTest001, TestSize.Level2) +{ + GTEST_LOG_(INFO) << "AccessMemTest001: start."; + auto unwinder = std::make_shared(); + auto acc = std::make_shared(); + auto memory = std::make_shared(acc); + uintptr_t val; + EXPECT_FALSE(memory->ReadReg(0, &val)); + uintptr_t regs[] = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa}; + UnwindContext ctx; + ctx.regs = DfxRegs::CreateFromRegs(UnwindMode::DWARF_UNWIND, regs, sizeof(regs) / sizeof(regs[0])); + memory->SetCtx(&ctx); + EXPECT_FALSE(memory->ReadReg(-1, &val)); + + uint8_t values[] = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8}; + uintptr_t addr = (uintptr_t)(&values[0]); + EXPECT_FALSE(unwinder->AccessMem(&memory, addr, nullptr)); + GTEST_LOG_(INFO) << "AccessMemTest001: end."; +} } // namespace HiviewDFX } // namepsace OHOS