diff --git a/test/unittest/process_dump/thread_dump_info_test.cpp b/test/unittest/process_dump/thread_dump_info_test.cpp index a5e09de61efa1dfabf8acdc7aeef161a11f806a3..3aba65807ca2bbb3d99110b88a025fd493db5612 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 7698320864dc994136e0334d509f5b6da1fb4fe5..fd7737acc65577317af9a8ddc1f93fe473a8ba58 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 cee0b044f03aad2454c2a5f04832d694934d9bb0..28935c9c14cd80e393fe06b349fc6c6d168c66a3 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 82b5df759a0669146679f204c63bc950b3727bc4..a76a339a4a1c89f72fa28e762fc0888ad0779b88 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 4dd716a1cb2e433d5b4df0a46893f5ef98adf3ec..f2ef6f9c988eab4ca1f03e19aecee4494596519d 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 1bb1802290e5d7fa458505f742d2a008829fb655..1acd9396a3164a63ba6d87abfca536269839de35 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 f22eb02cbd3d60492bd8c54246c5b295a53ec392..ab6fdaea172eaccc2eeec62b731935bcaa25b506 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);