From f731bf11c55eb83ecb356f4a39a976cf9bdae87f Mon Sep 17 00:00:00 2001 From: cs1111 Date: Mon, 25 Aug 2025 20:48:19 +0800 Subject: [PATCH] fix:SetIsJitCrashFlag Signed-off-by: cs1111 Change-Id: I7347fec9fee5f99e26c6f2e516fac679d96907a2 --- test/unittest/process_dump/thread_dump_info_test.cpp | 12 ++++++------ tools/process_dump/decorative_dump_info.h | 6 +++--- tools/process_dump/dump_info.h | 2 +- tools/process_dump/key_thread_dump_info.cpp | 4 ++-- tools/process_dump/key_thread_dump_info.h | 2 +- tools/process_dump/other_thread_dump_info.cpp | 4 ++-- tools/process_dump/process_dumper.cpp | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/unittest/process_dump/thread_dump_info_test.cpp b/test/unittest/process_dump/thread_dump_info_test.cpp index a5e09de61..3aba65807 100644 --- a/test/unittest/process_dump/thread_dump_info_test.cpp +++ b/test/unittest/process_dump/thread_dump_info_test.cpp @@ -110,7 +110,7 @@ HWTEST_F(ThreadDumpInfoTest, ThreadDumpInfoTest001, TestSize.Level2) Unwinder unwinder(pid, nsPid, request.type == ProcessDumpType::DUMP_TYPE_CPP_CRASH); unwinder.EnableFillFrames(false); KeyThreadDumpInfo dumpInfo; - EXPECT_GT(dumpInfo.UnwindStack(process, unwinder), 0); + EXPECT_GT(dumpInfo.UnwindStack(process, request, unwinder), 0); dumpInfo.Symbolize(process, unwinder); dumpInfo.Print(process, request, unwinder); std::vector keyWords = { @@ -167,7 +167,7 @@ HWTEST_F(ThreadDumpInfoTest, ThreadDumpInfoTest002, TestSize.Level2) Unwinder unwinder(pid, nsPid, request.type == ProcessDumpType::DUMP_TYPE_CPP_CRASH); unwinder.EnableFillFrames(false); KeyThreadDumpInfo dumpInfo; - EXPECT_GT(dumpInfo.UnwindStack(process, unwinder), 0); + EXPECT_GT(dumpInfo.UnwindStack(process, request, unwinder), 0); dumpInfo.Symbolize(process, unwinder); dumpInfo.Print(process, request, unwinder); std::vector keyWords = { @@ -215,7 +215,7 @@ HWTEST_F(ThreadDumpInfoTest, ThreadDumpInfoTest003, TestSize.Level2) Unwinder unwinder(pid, nsPid, request.type == ProcessDumpType::DUMP_TYPE_CPP_CRASH); unwinder.EnableFillFrames(false); KeyThreadDumpInfo dumpInfo; - EXPECT_GT(dumpInfo.UnwindStack(process, unwinder), 0); + EXPECT_GT(dumpInfo.UnwindStack(process, request, unwinder), 0); dumpInfo.Symbolize(process, unwinder); dumpInfo.Print(process, request, unwinder); std::vector keyWords = { @@ -257,7 +257,7 @@ HWTEST_F(ThreadDumpInfoTest, ThreadDumpInfoTest004, TestSize.Level2) Unwinder unwinder(pid, nsPid, request.type == ProcessDumpType::DUMP_TYPE_CPP_CRASH); unwinder.EnableFillFrames(false); OtherThreadDumpInfo dumpInfo; - EXPECT_GT(dumpInfo.UnwindStack(process, unwinder), 0); + EXPECT_GT(dumpInfo.UnwindStack(process, request, unwinder), 0); dumpInfo.Symbolize(process, unwinder); dumpInfo.Print(process, request, unwinder); std::vector keyWords = { @@ -300,7 +300,7 @@ HWTEST_F(ThreadDumpInfoTest, ThreadDumpInfoTest005, TestSize.Level2) Unwinder unwinder(pid, nsPid, request.type == ProcessDumpType::DUMP_TYPE_CPP_CRASH); unwinder.EnableFillFrames(false); OtherThreadDumpInfo dumpInfo; - EXPECT_GT(dumpInfo.UnwindStack(process, unwinder), 0); + EXPECT_GT(dumpInfo.UnwindStack(process, request, unwinder), 0); dumpInfo.Symbolize(process, unwinder); dumpInfo.Print(process, request, unwinder); std::vector keyWords = { @@ -345,7 +345,7 @@ HWTEST_F(ThreadDumpInfoTest, ThreadDumpInfoTest006, TestSize.Level2) std::shared_ptr keyThreadDumpInfo = std::make_shared(); OtherThreadDumpInfo dumpInfo; dumpInfo.SetDumpInfo(keyThreadDumpInfo); - EXPECT_GT(dumpInfo.UnwindStack(process, unwinder), threadCount); + EXPECT_GT(dumpInfo.UnwindStack(process, request, unwinder), threadCount); dumpInfo.Symbolize(process, unwinder); dumpInfo.Print(process, request, unwinder); std::vector keyWords = { diff --git a/tools/process_dump/decorative_dump_info.h b/tools/process_dump/decorative_dump_info.h index 769832086..fd7737acc 100644 --- a/tools/process_dump/decorative_dump_info.h +++ b/tools/process_dump/decorative_dump_info.h @@ -50,10 +50,10 @@ public: } } - int UnwindStack(DfxProcess& process, Unwinder& unwinder) override + int UnwindStack(DfxProcess& process, const ProcessDumpRequest& request, Unwinder& unwinder) override { if (dumpInfo_ != nullptr) { - return dumpInfo_->UnwindStack(process, unwinder); + return dumpInfo_->UnwindStack(process, request, unwinder); } return 0; } @@ -113,7 +113,7 @@ private: class OtherThreadDumpInfo : public DecorativeDumpInfo { public: - int UnwindStack(DfxProcess& process, Unwinder& unwinder) override; + int UnwindStack(DfxProcess& process, const ProcessDumpRequest& request, Unwinder& unwinder) override; void Print(DfxProcess& process, const ProcessDumpRequest& request, Unwinder& unwinder) override; void Symbolize(DfxProcess& process, Unwinder& unwinder) override; static std::shared_ptr CreateInstance() { return std::make_shared(); } diff --git a/tools/process_dump/dump_info.h b/tools/process_dump/dump_info.h index cee0b044f..28935c9c1 100644 --- a/tools/process_dump/dump_info.h +++ b/tools/process_dump/dump_info.h @@ -31,7 +31,7 @@ public: virtual ~DumpInfo() {} virtual void SetDumpInfo(const std::shared_ptr& dumpInfo) {} virtual void Print(DfxProcess& process, const ProcessDumpRequest& request, Unwinder& unwinder) = 0; - virtual int UnwindStack(DfxProcess& process, Unwinder& unwinder) = 0; + virtual int UnwindStack(DfxProcess& process, const ProcessDumpRequest& request, Unwinder& unwinder) = 0; virtual void Symbolize(DfxProcess& process, Unwinder& unwinder) = 0; virtual void GetMemoryValues(std::set& memoryValues) {}; }; diff --git a/tools/process_dump/key_thread_dump_info.cpp b/tools/process_dump/key_thread_dump_info.cpp index 82b5df759..a76a339a4 100644 --- a/tools/process_dump/key_thread_dump_info.cpp +++ b/tools/process_dump/key_thread_dump_info.cpp @@ -107,7 +107,7 @@ void KeyThreadDumpInfo::Print(DfxProcess& process, const ProcessDumpRequest& req DfxBufferWriter::GetInstance().AppendBriefDumpInfo(dumpInfo); } -int KeyThreadDumpInfo::UnwindStack(DfxProcess& process, Unwinder& unwinder) +int KeyThreadDumpInfo::UnwindStack(DfxProcess& process, const ProcessDumpRequest& request, Unwinder& unwinder) { DFXLOGI("unwind key thread dump start"); int result = 0; @@ -119,7 +119,7 @@ int KeyThreadDumpInfo::UnwindStack(DfxProcess& process, Unwinder& unwinder) DFXLOGW("vm pid is null, can not unwind key thread!"); return result; } - + unwinder.SetIsJitCrashFlag(request.type == ProcessDumpType::DUMP_TYPE_CPP_CRASH); if (process.GetKeyThread()->GetThreadRegs() != nullptr) { result = GetKeyThreadStack(process, unwinder) ? 1 : 0; } else { diff --git a/tools/process_dump/key_thread_dump_info.h b/tools/process_dump/key_thread_dump_info.h index 4dd716a1c..f2ef6f9c9 100644 --- a/tools/process_dump/key_thread_dump_info.h +++ b/tools/process_dump/key_thread_dump_info.h @@ -28,7 +28,7 @@ namespace HiviewDFX { class KeyThreadDumpInfo : public DumpInfo { public: void Print(DfxProcess& process, const ProcessDumpRequest& request, Unwinder& unwinder) override; - int UnwindStack(DfxProcess& process, Unwinder& unwinder) override; + int UnwindStack(DfxProcess& process, const ProcessDumpRequest& request, Unwinder& unwinder) override; void Symbolize(DfxProcess& process, Unwinder& unwinder) override; static std::shared_ptr CreateInstance() { return std::make_shared(); } private: diff --git a/tools/process_dump/other_thread_dump_info.cpp b/tools/process_dump/other_thread_dump_info.cpp index 1bb180229..1acd9396a 100644 --- a/tools/process_dump/other_thread_dump_info.cpp +++ b/tools/process_dump/other_thread_dump_info.cpp @@ -23,9 +23,9 @@ namespace OHOS { namespace HiviewDFX { REGISTER_DUMP_INFO_CLASS(OtherThreadDumpInfo); -int OtherThreadDumpInfo::UnwindStack(DfxProcess& process, Unwinder& unwinder) +int OtherThreadDumpInfo::UnwindStack(DfxProcess& process, const ProcessDumpRequest& request, Unwinder& unwinder) { - int unwindSuccessCnt = DecorativeDumpInfo::UnwindStack(process, unwinder); + int unwindSuccessCnt = DecorativeDumpInfo::UnwindStack(process, request, unwinder); DFXLOGI("unwind other thread dump start"); auto pid = process.GetVmPid(); if (pid == 0) { diff --git a/tools/process_dump/process_dumper.cpp b/tools/process_dump/process_dumper.cpp index f22eb02cb..ab6fdaea1 100644 --- a/tools/process_dump/process_dumper.cpp +++ b/tools/process_dump/process_dumper.cpp @@ -437,7 +437,7 @@ void ProcessDumper::PrintDumpInfo(int& dumpRes) prevDumpInfo = dumpInfo; } if (threadDumpInfo != nullptr) { - int unwindSuccessCnt = threadDumpInfo->UnwindStack(*process_, *unwinder_); + int unwindSuccessCnt = threadDumpInfo->UnwindStack(*process_, request_, *unwinder_); DFXLOGI("unwind success thread count(%{public}d)", unwindSuccessCnt); if (unwindSuccessCnt > 0) { dumpRes = ParseSymbols(threadDumpInfo); -- Gitee