From 99a61c6b2d283b2168529d3f0a8853efa210dad8 Mon Sep 17 00:00:00 2001 From: oh_ci Date: Tue, 19 Aug 2025 13:12:55 +0000 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!1205=20?= =?UTF-8?q?:=20Fix=20breakpoint=20removal=20failure=20bug'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tooling/dynamic/agent/debugger_impl.cpp | 4 --- .../dynamic/client/domain/debugger_client.cpp | 27 ------------------- .../dynamic/client/domain/debugger_client.h | 4 +-- tooling/dynamic/client/utils/cli_command.cpp | 25 ----------------- tooling/dynamic/client/utils/cli_command.h | 1 - .../testcases/js_accelerate_launch_test.h | 6 ----- 6 files changed, 1 insertion(+), 66 deletions(-) diff --git a/tooling/dynamic/agent/debugger_impl.cpp b/tooling/dynamic/agent/debugger_impl.cpp index 8e7df7a7..b6f10efe 100755 --- a/tooling/dynamic/agent/debugger_impl.cpp +++ b/tooling/dynamic/agent/debugger_impl.cpp @@ -1392,10 +1392,6 @@ DispatchResponse DebuggerImpl::RemoveBreakpointsByUrl(const RemoveBreakpointsByU return true; }; if (!MatchScripts(scriptMatchCallback, url, ScriptMatchType::URL)) { - if (IsLaunchAccelerateMode() && breakpointPendingMap_.erase(url)) { - LOG_DEBUGGER(INFO) << "All breakpoints on " << url << " are removed"; - return DispatchResponse::Ok(); - } LOG_DEBUGGER(ERROR) << "RemoveBreakpointByUrl: Unknown url: " << url; return DispatchResponse::Fail("Unknown url"); } diff --git a/tooling/dynamic/client/domain/debugger_client.cpp b/tooling/dynamic/client/domain/debugger_client.cpp index d8355aa7..91fce473 100644 --- a/tooling/dynamic/client/domain/debugger_client.cpp +++ b/tooling/dynamic/client/domain/debugger_client.cpp @@ -49,7 +49,6 @@ bool DebuggerClient::DispatcherCmd(const std::string &cmd) { "step-out", std::bind(&DebuggerClient::StepOutCommand, this)}, { "step-over", std::bind(&DebuggerClient::StepOverCommand, this)}, { "enable-launch-accelerate", std::bind(&DebuggerClient::EnableLaunchAccelerateCommand, this)}, - { "removeBreakpointsByUrl", std::bind(&DebuggerClient::RemoveBreakpointsByUrlCommand, this)}, { "saveAllPossibleBreakpoints", std::bind(&DebuggerClient::SaveAllPossibleBreakpointsCommand, this)}, { "setSymbolicBreakpoints", std::bind(&DebuggerClient::SetSymbolicBreakpointsCommand, this)}, { "removeSymbolicBreakpoints", std::bind(&DebuggerClient::RemoveSymbolicBreakpointsCommand, this)}, @@ -340,11 +339,6 @@ void DebuggerClient::AddSymbolicBreakpointInfo(const std::string& functionName) symbolicBreakpointInfoList_.emplace_back(symbolicBreakpointInfo); } -void DebuggerClient::AddUrl(const std::string& url) -{ - urlList_.push_back(url); -} - void DebuggerClient::RecvReply(std::unique_ptr json) { if (json == nullptr) { @@ -551,27 +545,6 @@ int DebuggerClient::RemoveSymbolicBreakpointsCommand() return 0; } -int DebuggerClient::RemoveBreakpointsByUrlCommand() -{ - Session *session = SessionManager::getInstance().GetSessionById(sessionId_); - uint32_t id = session->GetMessageId(); - - std::unique_ptr request = PtJson::CreateObject(); - request->Add("id", id); - request->Add("method", "Debugger.removeBreakpointsByUrl"); - - std::unique_ptr params = PtJson::CreateObject(); - params->Add("url", urlList_.back().c_str()); - request->Add("params", params); - - std::string message = request->Stringify(); - if (session->ClientSendReq(message)) { - session->GetDomainManager().SetDomainById(id, "Debugger"); - } - - return 0; -} - int DebuggerClient::EnableLaunchAccelerateCommand() { Session *session = SessionManager::getInstance().GetSessionById(sessionId_); diff --git a/tooling/dynamic/client/domain/debugger_client.h b/tooling/dynamic/client/domain/debugger_client.h index bd6eb0b8..1ebe7bdc 100644 --- a/tooling/dynamic/client/domain/debugger_client.h +++ b/tooling/dynamic/client/domain/debugger_client.h @@ -69,16 +69,14 @@ public: int AsyncStackDepthCommand(); int SetSymbolicBreakpointsCommand(); int RemoveSymbolicBreakpointsCommand(); - int RemoveBreakpointsByUrlCommand(); + void AddBreakPointInfo(const std::string& url, const int& lineNumber, const int& columnNumber = 0); void AddSymbolicBreakpointInfo(const std::string& functionName); - void AddUrl(const std::string& url); void RecvReply(std::unique_ptr json); void PausedReply(const std::unique_ptr json); void handleResponse(std::unique_ptr json); private: - std::vector urlList_ {}; std::vector breakPointInfoList_ {}; std::vector symbolicBreakpointInfoList_ {}; int32_t sessionId_; diff --git a/tooling/dynamic/client/utils/cli_command.cpp b/tooling/dynamic/client/utils/cli_command.cpp index 42367a63..e6b88abd 100644 --- a/tooling/dynamic/client/utils/cli_command.cpp +++ b/tooling/dynamic/client/utils/cli_command.cpp @@ -37,7 +37,6 @@ const std::string HELP_MSG = "usage: \n" " break(b) break with options\n" " setSymbolicBreakpoints setSymbolicBreakpoints\n" " removeSymbolicBreakpoints removeSymbolicBreakpoints\n" - " removeBreakpointsByUrl removeBreakpointsByUrl\n" " backtrack(bt) backtrace\n" " continue(c) continue\n" " delete(d) delete with options\n" @@ -96,7 +95,6 @@ const std::vector cmdList = { "break", "setSymbolicBreakpoints", "removeSymbolicBreakpoints", - "removeBreakpointsByUrl", "backtrack", "continue", "delete", @@ -186,8 +184,6 @@ void CliCommand::CreateCommandMap() std::bind(&CliCommand::SetSymbolicBreakpointsCommand, this, "setSymbolicBreakpoints")}, {std::make_pair("removeSymbolicBreakpoints", "removeSymbolicBreakpoints"), std::bind(&CliCommand::RemoveSymbolicBreakpointsCommand, this, "removeSymbolicBreakpoints")}, - {std::make_pair("removeBreakpointsByUrl", "removeBreakpointsByUrl"), - std::bind(&CliCommand::RemoveBreakpointsByUrlCommand, this, "removeBreakpointsByUrl")}, }; CreateOtherCommandMap(); } @@ -425,27 +421,6 @@ ErrCode CliCommand::RemoveSymbolicBreakpointsCommand(const std::string &cmd) return result ? ErrCode::ERR_OK : ErrCode::ERR_FAIL; } -ErrCode CliCommand::RemoveBreakpointsByUrlCommand(const std::string &cmd) -{ - bool result = false; - Session *session = SessionManager::getInstance().GetSessionById(sessionId_); - DebuggerClient &debuggerCli = session->GetDomainManager().GetDebuggerClient(); - if (GetArgList().size() == 1) { //1: one arguments - if (Utils::IsNumber(GetArgList()[0])) { - OutputCommand(cmd, false); - return ErrCode::ERR_FAIL; - } - debuggerCli.AddUrl(GetArgList()[0]); - } else { - OutputCommand(cmd, false); - return ErrCode::ERR_FAIL; - } - - result = debuggerCli.DispatcherCmd(cmd); - OutputCommand(cmd, true); - return result ? ErrCode::ERR_OK : ErrCode::ERR_FAIL; -} - ErrCode CliCommand::DeleteCommand(const std::string &cmd) { bool result = false; diff --git a/tooling/dynamic/client/utils/cli_command.h b/tooling/dynamic/client/utils/cli_command.h index 84758ce9..0b0e7f46 100644 --- a/tooling/dynamic/client/utils/cli_command.h +++ b/tooling/dynamic/client/utils/cli_command.h @@ -75,7 +75,6 @@ public: ErrCode SaveAllPossibleBreakpointsCommand(const std::string &cmd); ErrCode SetSymbolicBreakpointsCommand(const std::string &cmd); ErrCode RemoveSymbolicBreakpointsCommand(const std::string &cmd); - ErrCode RemoveBreakpointsByUrlCommand(const std::string &cmd); void OutputCommand(const std::string &cmd, bool flag); VecStr GetArgList() diff --git a/tooling/dynamic/test/testcases/js_accelerate_launch_test.h b/tooling/dynamic/test/testcases/js_accelerate_launch_test.h index a7e467f0..2bb890c7 100644 --- a/tooling/dynamic/test/testcases/js_accelerate_launch_test.h +++ b/tooling/dynamic/test/testcases/js_accelerate_launch_test.h @@ -32,12 +32,6 @@ public: // Debugger.saveAllPossibleBreakpoints {SocketAction::SEND, "b-new " DEBUGGER_JS_DIR "sample.js 22"}, {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, - {SocketAction::SEND, "b-new " "test.js 22"}, - {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, - {SocketAction::SEND, "removeBreakpointsByUrl " "test.js"}, - {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, - {SocketAction::SEND, "removeBreakpointsByUrl " "test1.js"}, - {SocketAction::RECV, "Unknown url", ActionRule::STRING_CONTAIN}, {SocketAction::SEND, "run"}, {SocketAction::RECV, "", ActionRule::CUSTOM_RULE, MatchRule::replySuccess}, // load sample.js -- Gitee