diff --git a/src/plugins/debugger/dap/cmakedapengine.cpp b/src/plugins/debugger/dap/cmakedapengine.cpp index d43646f408a..0775b05004f 100644 --- a/src/plugins/debugger/dap/cmakedapengine.cpp +++ b/src/plugins/debugger/dap/cmakedapengine.cpp @@ -115,4 +115,12 @@ void CMakeDapEngine::setupEngine() notifyEngineSetupOk(); } +bool CMakeDapEngine::hasCapability(unsigned cap) const +{ + return cap & (ReloadModuleCapability + | BreakConditionCapability + | ShowModuleSymbolsCapability + /*| RunToLineCapability*/); // disable while the #25176 bug is not fixed +} + } // namespace Debugger::Internal diff --git a/src/plugins/debugger/dap/cmakedapengine.h b/src/plugins/debugger/dap/cmakedapengine.h index 59a536fee0c..00b0ac7044d 100644 --- a/src/plugins/debugger/dap/cmakedapengine.h +++ b/src/plugins/debugger/dap/cmakedapengine.h @@ -15,6 +15,8 @@ public: private: void handleDapStarted() override; void setupEngine() override; + + bool hasCapability(unsigned cap) const override; }; } // Debugger::Internal diff --git a/src/plugins/debugger/dap/dapengine.cpp b/src/plugins/debugger/dap/dapengine.cpp index a18c1d431b4..075eb908c36 100644 --- a/src/plugins/debugger/dap/dapengine.cpp +++ b/src/plugins/debugger/dap/dapengine.cpp @@ -305,8 +305,19 @@ void DapEngine::continueInferior() void DapEngine::executeRunToLine(const ContextData &data) { - Q_UNUSED(data) - QTC_CHECK("FIXME: DapEngine::runToLineExec()" && false); + // Add one-shot breakpoint + BreakpointParameters bp; + bp.oneShot = true; + if (data.address) { + bp.type = BreakpointByAddress; + bp.address = data.address; + } else { + bp.type = BreakpointByFileAndLine; + bp.fileName = data.fileName; + bp.textPosition = data.textPosition; + } + + BreakpointManager::createBreakpointForEngine(bp, this); } void DapEngine::executeRunToFunction(const QString &functionName) @@ -836,6 +847,8 @@ void DapEngine::handleStoppedEvent(const QJsonObject &event) if (bp) { const BreakpointParameters ¶ms = bp->requestedParameters(); gotoLocation(Location(params.fileName, params.textPosition)); + if (params.oneShot) + removeBreakpoint(bp); } } @@ -860,6 +873,9 @@ void DapEngine::handleBreakpointEvent(const QJsonObject &event) if (body.value("reason").toString() == "new") { if (breakpoint.value("verified").toBool()) { notifyBreakpointInsertOk(bp); + const BreakpointParameters ¶ms = bp->requestedParameters(); + if (params.oneShot) + continueInferior(); qCDebug(dapEngineLog) << "breakpoint inserted"; } else { notifyBreakpointInsertFailed(bp); @@ -958,7 +974,8 @@ bool DapEngine::hasCapability(unsigned cap) const { return cap & (ReloadModuleCapability | BreakConditionCapability - | ShowModuleSymbolsCapability); + | ShowModuleSymbolsCapability + | RunToLineCapability); } void DapEngine::claimInitialBreakpoints()