From 66e016c2846469fb4371e854c7506f49524c3411 Mon Sep 17 00:00:00 2001 From: yanzhiqi1 Date: Thu, 21 Aug 2025 17:35:01 +0800 Subject: [PATCH] fix bug in global value Issue: #ICU35K Signed-off-by: yanzhiqi1 Change-Id: I2de0283228e702bf9ecc5901e74d5454fda788ce --- tooling/dynamic/backend/debugger_executor.cpp | 14 ++++++++------ tooling/dynamic/backend/debugger_executor.h | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tooling/dynamic/backend/debugger_executor.cpp b/tooling/dynamic/backend/debugger_executor.cpp index 3c97db88..7f11f68a 100644 --- a/tooling/dynamic/backend/debugger_executor.cpp +++ b/tooling/dynamic/backend/debugger_executor.cpp @@ -109,7 +109,7 @@ Local DebuggerExecutor::GetValue(const EcmaVM *vm, const FrameHandle if (!value.IsEmpty()) { return value; } - value = GetGlobalValue(vm, name); + value = GetGlobalValue(vm, frameHandler, name); if (!value.IsEmpty()) { return value; } @@ -129,7 +129,7 @@ bool DebuggerExecutor::SetValue(const EcmaVM *vm, FrameHandler *frameHandler, if (SetModuleValue(vm, frameHandler, name, value)) { return true; } - if (SetGlobalValue(vm, name, value)) { + if (SetGlobalValue(vm, frameHandler, name, value)) { return true; } @@ -201,16 +201,18 @@ bool DebuggerExecutor::SetLexicalValue(const EcmaVM *vm, const FrameHandler *fra return true; } -Local DebuggerExecutor::GetGlobalValue(const EcmaVM *vm, Local name) +Local DebuggerExecutor::GetGlobalValue(const EcmaVM *vm, const FrameHandler *frameHandler, + Local name) { - return DebuggerApi::GetGlobalValue(vm, name); + return DebuggerApi::GetGlobalValue(vm, frameHandler, name); } -bool DebuggerExecutor::SetGlobalValue(const EcmaVM *vm, Local name, Local value) +bool DebuggerExecutor::SetGlobalValue(const EcmaVM *vm, const FrameHandler *frameHandler, + Local name, Local value) { std::string varName = name->ToString(vm); vm->GetJsDebuggerManager()->NotifyScopeUpdated(varName, value, Scope::Type::Global()); - return DebuggerApi::SetGlobalValue(vm, name, value); + return DebuggerApi::SetGlobalValue(vm, frameHandler, name, value); } Local DebuggerExecutor::GetModuleValue(const EcmaVM *vm, const FrameHandler *frameHandler, diff --git a/tooling/dynamic/backend/debugger_executor.h b/tooling/dynamic/backend/debugger_executor.h index 0ef319cc..e641d89c 100644 --- a/tooling/dynamic/backend/debugger_executor.h +++ b/tooling/dynamic/backend/debugger_executor.h @@ -48,7 +48,7 @@ private: static Local GetLexicalValue(const EcmaVM *vm, const FrameHandler *frameHandler, Local name); static Local GetModuleValue(const EcmaVM *vm, const FrameHandler *frameHandler, Local name); - static Local GetGlobalValue(const EcmaVM *vm, Local name); + static Local GetGlobalValue(const EcmaVM *vm, const FrameHandler *frameHandler, Local name); static bool SetLocalValue(const EcmaVM *vm, FrameHandler *frameHandler, Local name, Local value); @@ -56,7 +56,8 @@ private: Local name, Local value); static bool SetModuleValue(const EcmaVM *vm, const FrameHandler *frameHandler, Local name, Local value); - static bool SetGlobalValue(const EcmaVM *vm, Local name, Local value); + static bool SetGlobalValue(const EcmaVM *vm, const FrameHandler *frameHandler, + Local name, Local value); static constexpr uint32_t NUM_ARGS = 2; }; -- Gitee