From 861d697eb3abfb258364bb20236a376c81f9b155 Mon Sep 17 00:00:00 2001 From: dengwenjun Date: Thu, 5 Jun 2025 17:00:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AC=A6=E5=8F=B7=E6=96=AD?= =?UTF-8?q?=E7=82=B9=E8=B0=83=E8=AF=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在MethodEntry中,去判断是否命中符号断点时,先去校验当前方法所处的脚本文件是否已被解析: 1.若未被解析,则判断为系统函数,不进行符号断点判断; 2.若已被解析,则侦正常进行后续符号断点命中校验; Issue:https://gitee.com/openharmony/arkcompiler_toolchain/issues/ICAWQ2 Signed-off-by: dengwenjun --- tooling/agent/debugger_impl.cpp | 1 + tooling/agent/debugger_impl.h | 6 ++++++ tooling/backend/js_pt_hooks.cpp | 5 +++++ tooling/backend/js_pt_hooks.h | 1 + tooling/test/utils/test_hooks.h | 6 ++++++ 5 files changed, 19 insertions(+) diff --git a/tooling/agent/debugger_impl.cpp b/tooling/agent/debugger_impl.cpp index 6862fabc..20c66fb0 100755 --- a/tooling/agent/debugger_impl.cpp +++ b/tooling/agent/debugger_impl.cpp @@ -151,6 +151,7 @@ void DebuggerImpl::SaveParsedScriptsAndUrl(const std::string &fileName, const st { // Save recordName to its corresponding url recordNames_[url].insert(recordName); + recordNameSet_.insert(recordName); // Save parsed fileName to its corresponding url urlFileNameMap_[url].insert(fileName); // Create and save script diff --git a/tooling/agent/debugger_impl.h b/tooling/agent/debugger_impl.h index 191b6040..0c92b986 100644 --- a/tooling/agent/debugger_impl.h +++ b/tooling/agent/debugger_impl.h @@ -297,6 +297,11 @@ private: return !breakOnStartEnable_; } + const std::unordered_set &GetAllRecordNames() const + { + return recordNameSet_; + } + class Frontend { public: explicit Frontend(ProtocolChannel *channel) : channel_(channel) {} @@ -326,6 +331,7 @@ private: JSDebugger *jsDebugger_ {nullptr}; std::unordered_map> recordNames_ {}; + std::unordered_set recordNameSet_ {}; std::unordered_map> urlFileNameMap_ {}; std::unordered_map> scripts_ {}; PauseOnExceptionsState pauseOnException_ {PauseOnExceptionsState::NONE}; diff --git a/tooling/backend/js_pt_hooks.cpp b/tooling/backend/js_pt_hooks.cpp index 6e64a87f..c84e885f 100644 --- a/tooling/backend/js_pt_hooks.cpp +++ b/tooling/backend/js_pt_hooks.cpp @@ -145,4 +145,9 @@ void JSPtHooks::HitSymbolicBreakpoint() debugger_->SetPauseOnNextByteCode(true); } + +const std::unordered_set &JSPtHooks::GetAllRecordNames() const +{ + return debugger_->GetAllRecordNames(); +} } // namespace panda::ecmascript::tooling diff --git a/tooling/backend/js_pt_hooks.h b/tooling/backend/js_pt_hooks.h index a8ea466f..f875c697 100644 --- a/tooling/backend/js_pt_hooks.h +++ b/tooling/backend/js_pt_hooks.h @@ -44,6 +44,7 @@ public: void DisableFirstTimeFlag() override; void GenerateAsyncFrames(std::shared_ptr asyncStack, bool skipTopFrame) override; void HitSymbolicBreakpoint() override; + const std::unordered_set &GetAllRecordNames() const override; private: NO_COPY_SEMANTIC(JSPtHooks); NO_MOVE_SEMANTIC(JSPtHooks); diff --git a/tooling/test/utils/test_hooks.h b/tooling/test/utils/test_hooks.h index 15ec0112..134c6ad5 100644 --- a/tooling/test/utils/test_hooks.h +++ b/tooling/test/utils/test_hooks.h @@ -125,6 +125,12 @@ public: void HitSymbolicBreakpoint() override {} + const std::unordered_set &GetAllRecordNames() const override + { + static const std::unordered_set recordName; + return recordName; + } + void TerminateTest() { debugInterface_->UnregisterHooks(); -- Gitee