forked from qt-creator/qt-creator
DAP: Remove redundant source field in breakpoint structure
Change-Id: I30c952971353ab316791cd68cf91f192bd398b84 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user