diff --git a/tooling/agent/debugger_impl.cpp b/tooling/agent/debugger_impl.cpp index 6862fabc5e64a5fc79904712e12d5fda74db4d50..0a37fe9f1f7577c775358341882b0835fddc8467 100755 --- a/tooling/agent/debugger_impl.cpp +++ b/tooling/agent/debugger_impl.cpp @@ -1422,7 +1422,8 @@ DispatchResponse DebuggerImpl::SetBreakpointByUrl(const SetBreakpointByUrlParams } return DebuggerApi::SetBreakpoint(jsDebugger_, location, condFuncRef, isSmartBreakpoint); }; - if (!extractor->MatchWithLocation(callbackFunc, lineNumber, columnNumber, url, GetRecordName(url))) { + if (!extractor->MatchWithLocation(callbackFunc, lineNumber, columnNumber, url, GetRecordName(url), + isSmartBreakpoint, params.GetMethodName())) { LOG_DEBUGGER(ERROR) << "failed to set breakpoint location number: " << lineNumber << ":" << columnNumber; return DispatchResponse::Fail("Breakpoint not found."); diff --git a/tooling/base/pt_params.cpp b/tooling/base/pt_params.cpp index 78c2acfdaebd7e1c3c034c72eb4a1243d0361068..a9139880f97e1dfd15896c03ea1ab1e002e3118c 100644 --- a/tooling/base/pt_params.cpp +++ b/tooling/base/pt_params.cpp @@ -398,6 +398,13 @@ std::unique_ptr SetBreakpointByUrlParams::Create(const } else if (ret == Result::TYPE_ERROR) { error += "Wrong type of 'condition';"; } + std::string methodName; + ret = params.GetString("methodName", &methodName); + if (ret == Result::SUCCESS) { + paramsObject->methodName_ = std::move(methodName); + } else if (ret == Result::TYPE_ERROR) { + error += "Wrong type of 'methodName';"; + } if (!error.empty()) { LOG_DEBUGGER(ERROR) << "SetBreakpointByUrlParams::Create " << error; return nullptr; @@ -574,6 +581,9 @@ void SmartStepIntoParams::AddRequireParams(PtJson ¶ms) if (!params.Contains("condition")) { params.Add("condition", ""); } + if (!params.Contains("methodName")) { + params.Add("methodName", ""); + } } std::unique_ptr StepOverParams::Create(const PtJson ¶ms) diff --git a/tooling/base/pt_params.h b/tooling/base/pt_params.h index 880addf9f3acb1c0ef4627229ac7fde453d8faf6..fcee1d45ff325d02702815f1ae762568d04d42e1 100644 --- a/tooling/base/pt_params.h +++ b/tooling/base/pt_params.h @@ -357,6 +357,17 @@ public: return condition_.has_value(); } + bool HasMethodName() const + { + return methodName_.has_value(); + } + + const std::string &GetMethodName() const + { + ASSERT(HasMethodName()); + return methodName_.value(); + } + private: NO_COPY_SEMANTIC(SetBreakpointByUrlParams); NO_MOVE_SEMANTIC(SetBreakpointByUrlParams); @@ -367,6 +378,7 @@ private: std::optional scriptHash_ {}; std::optional columnNumber_ {0}; std::optional condition_ {}; + std::optional methodName_ {}; };