From 7e941bfd4c9e1a41262bb3499c04f8ce63e98ee1 Mon Sep 17 00:00:00 2001 From: yang-19970325 Date: Sat, 28 Oct 2023 11:22:50 +0800 Subject: [PATCH] Fix router and startability Inconsistent jump behavior Issue:#I87P2Y Signed-off-by: yang-19970325 Change-Id: I0e23f3b892db5658f4d0717a14deae921aac8217 --- tooling/agent/debugger_impl.cpp | 8 +++++++- tooling/agent/debugger_impl.h | 1 + tooling/backend/js_pt_hooks.cpp | 9 +++++++++ tooling/backend/js_pt_hooks.h | 1 + tooling/test/utils/test_hooks.h | 2 ++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/tooling/agent/debugger_impl.cpp b/tooling/agent/debugger_impl.cpp index 26c4a25d..a628d7f6 100644 --- a/tooling/agent/debugger_impl.cpp +++ b/tooling/agent/debugger_impl.cpp @@ -285,6 +285,12 @@ void DebuggerImpl::NotifyNativeCalling(const void *nativeAddress) } } +void DebuggerImpl::NotifyLoadModule() +{ + // if load module and jump to a new page, it need to check whether clear singleStepper_ + ClearSingleStepper(); +} + // only use for test case void DebuggerImpl::SetDebuggerState(DebuggerState debuggerState) { @@ -1542,7 +1548,7 @@ void DebuggerImpl::UpdateScopeObject(const FrameHandler *frameHandler, void DebuggerImpl::ClearSingleStepper() { - // ClearSingleStepper is originally called from Function::Call, if current depth is 0, then it is safe to reset + // if current depth is 0, then it is safe to reset if (singleStepper_ != nullptr && DebuggerApi::GetStackDepth(vm_) == 0) { singleStepper_.reset(); } diff --git a/tooling/agent/debugger_impl.h b/tooling/agent/debugger_impl.h index 60bf4136..39c50595 100644 --- a/tooling/agent/debugger_impl.h +++ b/tooling/agent/debugger_impl.h @@ -44,6 +44,7 @@ public: void NotifyPaused(std::optional location, PauseReason reason); void NotifyHandleProtocolCommand(); void NotifyNativeCalling(const void *nativeAddress); + void NotifyLoadModule(); void SetDebuggerState(DebuggerState debuggerState); DispatchResponse ContinueToLocation(const ContinueToLocationParams ¶ms); diff --git a/tooling/backend/js_pt_hooks.cpp b/tooling/backend/js_pt_hooks.cpp index 62dc4b2d..36548f04 100644 --- a/tooling/backend/js_pt_hooks.cpp +++ b/tooling/backend/js_pt_hooks.cpp @@ -86,4 +86,13 @@ void JSPtHooks::NativeCalling(const void *nativeAddress) debugger_->NotifyNativeCalling(nativeAddress); } + +void JSPtHooks::NotifyLoadModule() +{ + LOG_DEBUGGER(VERBOSE) << "JSPtHooks: NotifyLoadModule"; + + [[maybe_unused]] LocalScope scope(debugger_->vm_); + + debugger_->NotifyLoadModule(); +} } // namespace panda::ecmascript::tooling diff --git a/tooling/backend/js_pt_hooks.h b/tooling/backend/js_pt_hooks.h index 1df842db..34a4399f 100644 --- a/tooling/backend/js_pt_hooks.h +++ b/tooling/backend/js_pt_hooks.h @@ -36,6 +36,7 @@ public: void Exception(const JSPtLocation &location) override; bool SingleStep(const JSPtLocation &location) override; void NativeCalling(const void *nativeAddress) override; + void NotifyLoadModule() override; void VmStart() override {} void VmDeath() override {} diff --git a/tooling/test/utils/test_hooks.h b/tooling/test/utils/test_hooks.h index d5a51cd2..db2d9e77 100644 --- a/tooling/test/utils/test_hooks.h +++ b/tooling/test/utils/test_hooks.h @@ -105,6 +105,8 @@ public: void NativeCalling([[maybe_unused]] const void *nativeAddress) override {} + void NotifyLoadModule() override {} + void TerminateTest() { debugInterface_->UnregisterHooks(); -- Gitee