diff --git a/tooling/agent/debugger_impl.cpp b/tooling/agent/debugger_impl.cpp index 26c4a25dda6c7a5ad460af84b108463a51dd3608..a628d7f6ded7c043be1894e2481a3dd69203acd8 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 60bf41360b3fb8d902278644f65e73f888a4e279..39c505954e6d28b5e88207365c9bd78c3cddb2b2 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 62dc4b2d771dfdafc404360c885fdb3ff8eb4958..36548f0457e141b10c47ec56b73b0bff06fcb180 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 1df842db7c0308597740e305873a184e52268b7c..34a4399fe20012acb9e59a4b57b9d3ee5c940767 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 d5a51cd27f11a872cc74a5643b866f8939763dfa..db2d9e77128f5544101f1d49bc441bdc51e143b7 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();