From 0ea82295b06ed39ebce74d9a8c58bbb9c89ca35a Mon Sep 17 00:00:00 2001 From: huangtianzhi Date: Thu, 17 Aug 2023 14:59:17 +0800 Subject: [PATCH 1/2] Fix debugger stmt implementation incorrectly passes "Location" param causing adding extra breakpoint Signed-off-by: huangtianzhi --- tooling/backend/js_pt_hooks.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tooling/backend/js_pt_hooks.cpp b/tooling/backend/js_pt_hooks.cpp index 833676b9..b7afbd0e 100644 --- a/tooling/backend/js_pt_hooks.cpp +++ b/tooling/backend/js_pt_hooks.cpp @@ -18,12 +18,11 @@ #include "agent/debugger_impl.h" namespace panda::ecmascript::tooling { -void JSPtHooks::DebuggerStmt(const JSPtLocation &location) +void JSPtHooks::DebuggerStmt([[maybe_unused]] const JSPtLocation &location) { - LOG_DEBUGGER(INFO) << "JSPHooks: Debugger => " << location.GetMethodId() << ": " - << location.GetBytecodeOffset(); + LOG_DEBUGGER(VERBOSE) << "JSPHooks: Debugger Statement"; [[maybe_unused]] LocalScope scope(debugger_->vm_); - debugger_->NotifyPaused(location, OTHER); + debugger_->NotifyPaused({}, OTHER); } void JSPtHooks::Breakpoint(const JSPtLocation &location) -- Gitee From 26934a190ff50725018a92ab1131f6ce2ae805cd Mon Sep 17 00:00:00 2001 From: huangtianzhi Date: Thu, 17 Aug 2023 16:35:02 +0800 Subject: [PATCH 2/2] repalce jshandle with jsmutablehandle in GetClosureVariables Signed-off-by: huangtianzhi --- tooling/agent/debugger_impl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tooling/agent/debugger_impl.cpp b/tooling/agent/debugger_impl.cpp index a771ca70..1cfcd518 100644 --- a/tooling/agent/debugger_impl.cpp +++ b/tooling/agent/debugger_impl.cpp @@ -1378,6 +1378,7 @@ void DebuggerImpl::GetClosureVariables(const FrameHandler *frameHandler, LocalGetJSThread(); JSHandle envHandle = JSHandle(thread, DebuggerApi::GetEnv(frameHandler)); + JSMutableHandle valueHandle = JSMutableHandle(thread, JSTaggedValue::Hole()); JSTaggedValue env = envHandle.GetTaggedValue(); if (env.IsTaggedArray() && DebuggerApi::GetBytecodeOffset(frameHandler) != 0) { LexicalEnv *lexEnv = LexicalEnv::Cast(env.GetTaggedObject()); @@ -1394,8 +1395,8 @@ void DebuggerImpl::GetClosureVariables(const FrameHandler *frameHandler, LocalGetLength() - LexicalEnv::RESERVED_ENV_LENGTH); - Local value = JSNApiHelper::ToLocal( - JSHandle(thread, lexEnv->GetProperties(slot))); + valueHandle.Update(lexEnv->GetProperties(slot)); + Local value = JSNApiHelper::ToLocal(valueHandle); if (varName == "this") { if (thisVal->IsHole()) { LOG_DEBUGGER(INFO) << "find 'this' in current lexical env"; -- Gitee