From 19aeb45abd415a52821bc0521bfd3980b0770d0c Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Tue, 5 Sep 2023 10:29:22 +0200 Subject: [PATCH] DAP: Remove redundant source field in breakpoint structure Change-Id: I30c952971353ab316791cd68cf91f192bd398b84 Reviewed-by: Reviewed-by: hjk --- src/plugins/debugger/dap/dapengine.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/plugins/debugger/dap/dapengine.cpp b/src/plugins/debugger/dap/dapengine.cpp index b80c58765be..0f0b31772d4 100644 --- a/src/plugins/debugger/dap/dapengine.cpp +++ b/src/plugins/debugger/dap/dapengine.cpp @@ -232,21 +232,16 @@ bool DapEngine::acceptsBreakpoint(const BreakpointParameters &) const return true; // FIXME: Too bold. } -static QJsonObject createBreakpoint(const Breakpoint &breakpoint) +static QJsonObject createBreakpoint(const BreakpointParameters ¶ms) { - const BreakpointParameters ¶ms = breakpoint->requestedParameters(); - if (params.fileName.isEmpty()) return QJsonObject(); QJsonObject bp; bp["line"] = params.textPosition.line; - bp["source"] = QJsonObject{{"name", params.fileName.fileName()}, - {"path", params.fileName.path()}}; return bp; } - void DapEngine::insertBreakpoint(const Breakpoint &bp) { QTC_ASSERT(bp, return); @@ -263,9 +258,9 @@ void DapEngine::dapInsertBreakpoint(const Breakpoint &bp) QJsonArray breakpoints; for (const auto &breakpoint : breakHandler()->breakpoints()) { - QJsonObject jsonBp = createBreakpoint(breakpoint); - if (!jsonBp.isEmpty() - && params.fileName.path() == jsonBp["source"].toObject()["path"].toString()) { + const BreakpointParameters &bpParams = breakpoint->requestedParameters(); + QJsonObject jsonBp = createBreakpoint(bpParams); + if (!jsonBp.isEmpty() && params.fileName.path() == bpParams.fileName.path()) { breakpoints.append(jsonBp); } } @@ -304,9 +299,9 @@ void DapEngine::dapRemoveBreakpoint(const Breakpoint &bp) QJsonArray breakpoints; for (const auto &breakpoint : breakHandler()->breakpoints()) { - if (breakpoint->responseId() != bp->responseId() - && params.fileName == breakpoint->requestedParameters().fileName) { - QJsonObject jsonBp = createBreakpoint(breakpoint); + const BreakpointParameters &bpParams = breakpoint->requestedParameters(); + if (breakpoint->responseId() != bp->responseId() && params.fileName == bpParams.fileName) { + QJsonObject jsonBp = createBreakpoint(bpParams); breakpoints.append(jsonBp); } }