forked from qt-creator/qt-creator
DAP: Move acceptsBreakpoint to mime type
Change-Id: I3234e7981202c7d668b8c3c86c818ca47f7be589 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <debugger/debuggermainwindow.h>
|
#include <debugger/debuggermainwindow.h>
|
||||||
|
|
||||||
|
#include <utils/mimeutils.h>
|
||||||
#include <utils/temporarydirectory.h>
|
#include <utils/temporarydirectory.h>
|
||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
@@ -23,6 +24,11 @@
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
const char CMAKE_MIMETYPE[] = "text/x-cmake";
|
||||||
|
const char CMAKE_PROJECT_MIMETYPE[] = "text/x-cmake-project";
|
||||||
|
} // namespace
|
||||||
|
|
||||||
namespace Debugger::Internal {
|
namespace Debugger::Internal {
|
||||||
|
|
||||||
class LocalSocketDataProvider : public IDataProvider
|
class LocalSocketDataProvider : public IDataProvider
|
||||||
@@ -144,7 +150,8 @@ void CMakeDapEngine::setupEngine()
|
|||||||
|
|
||||||
bool CMakeDapEngine::acceptsBreakpoint(const BreakpointParameters &bp) const
|
bool CMakeDapEngine::acceptsBreakpoint(const BreakpointParameters &bp) const
|
||||||
{
|
{
|
||||||
return bp.fileName.endsWith(".txt") || bp.fileName.endsWith(".cmake");
|
const auto mimeType = Utils::mimeTypeForFile(bp.fileName);
|
||||||
|
return mimeType.matchesName(CMAKE_MIMETYPE) || mimeType.matchesName(CMAKE_PROJECT_MIMETYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeDapEngine::hasCapability(unsigned cap) const
|
bool CMakeDapEngine::hasCapability(unsigned cap) const
|
||||||
@@ -153,7 +160,7 @@ bool CMakeDapEngine::hasCapability(unsigned cap) const
|
|||||||
| BreakConditionCapability
|
| BreakConditionCapability
|
||||||
| ShowModuleSymbolsCapability
|
| ShowModuleSymbolsCapability
|
||||||
/*| AddWatcherCapability*/ // disable while the #25282 bug is not fixed
|
/*| AddWatcherCapability*/ // disable while the #25282 bug is not fixed
|
||||||
/*| RunToLineCapability*/); // disable while the #25176 bug is not fixed
|
| RunToLineCapability);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QLoggingCategory &CMakeDapEngine::logCategory()
|
const QLoggingCategory &CMakeDapEngine::logCategory()
|
||||||
|
@@ -734,6 +734,8 @@ void DapEngine::handleBreakpointResponse(const QJsonObject &response)
|
|||||||
parameters.pending = false;
|
parameters.pending = false;
|
||||||
bp->setParameters(parameters);
|
bp->setParameters(parameters);
|
||||||
notifyBreakpointInsertOk(bp);
|
notifyBreakpointInsertOk(bp);
|
||||||
|
if (parameters.oneShot)
|
||||||
|
continueInferior();
|
||||||
}
|
}
|
||||||
if (!bp.isNull())
|
if (!bp.isNull())
|
||||||
bp->setResponseId(QString::number(map.value(mapKey).value("id").toInt()));
|
bp->setResponseId(QString::number(map.value(mapKey).value("id").toInt()));
|
||||||
@@ -783,6 +785,8 @@ void DapEngine::handleBreakpointResponse(const QJsonObject &response)
|
|||||||
bp->setParameters(parameters);
|
bp->setParameters(parameters);
|
||||||
bp->setResponseId(QString::number(jsonBreakpoint.value("id").toInt()));
|
bp->setResponseId(QString::number(jsonBreakpoint.value("id").toInt()));
|
||||||
notifyBreakpointInsertOk(bp);
|
notifyBreakpointInsertOk(bp);
|
||||||
|
if (parameters.oneShot)
|
||||||
|
continueInferior();
|
||||||
map.remove(key);
|
map.remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -841,7 +845,7 @@ void DapEngine::handleStoppedEvent(const QJsonObject &event)
|
|||||||
const BreakpointParameters ¶ms = bp->requestedParameters();
|
const BreakpointParameters ¶ms = bp->requestedParameters();
|
||||||
gotoLocation(Location(params.fileName, params.textPosition));
|
gotoLocation(Location(params.fileName, params.textPosition));
|
||||||
if (params.oneShot)
|
if (params.oneShot)
|
||||||
removeBreakpoint(bp);
|
bp->globalBreakpoint()->deleteBreakpoint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <debugger/debuggermainwindow.h>
|
#include <debugger/debuggermainwindow.h>
|
||||||
|
|
||||||
|
#include <utils/mimeutils.h>
|
||||||
#include <utils/temporarydirectory.h>
|
#include <utils/temporarydirectory.h>
|
||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
@@ -22,6 +23,13 @@
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
const char C_HEADER_MIMETYPE[] = "text/x-chdr";
|
||||||
|
const char C_SOURCE_MIMETYPE[] = "text/x-csrc";
|
||||||
|
const char CPP_SOURCE_MIMETYPE[] = "text/x-c++src";
|
||||||
|
const char CPP_HEADER_MIMETYPE[] = "text/x-c++hdr";
|
||||||
|
} // namespace
|
||||||
|
|
||||||
namespace Debugger::Internal {
|
namespace Debugger::Internal {
|
||||||
|
|
||||||
class ProcessDataProvider : public IDataProvider
|
class ProcessDataProvider : public IDataProvider
|
||||||
@@ -163,7 +171,10 @@ void GdbDapEngine::setupEngine()
|
|||||||
|
|
||||||
bool GdbDapEngine::acceptsBreakpoint(const BreakpointParameters &bp) const
|
bool GdbDapEngine::acceptsBreakpoint(const BreakpointParameters &bp) const
|
||||||
{
|
{
|
||||||
return bp.fileName.endsWith(".cpp") || bp.fileName.endsWith(".h");
|
const auto mimeType = Utils::mimeTypeForFile(bp.fileName);
|
||||||
|
return mimeType.matchesName(C_HEADER_MIMETYPE) || mimeType.matchesName(C_SOURCE_MIMETYPE)
|
||||||
|
|| mimeType.matchesName(CPP_HEADER_MIMETYPE)
|
||||||
|
|| mimeType.matchesName(CPP_SOURCE_MIMETYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QLoggingCategory &GdbDapEngine::logCategory()
|
const QLoggingCategory &GdbDapEngine::logCategory()
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
#include <debugger/debuggertr.h>
|
#include <debugger/debuggertr.h>
|
||||||
|
|
||||||
#include <utils/infobar.h>
|
#include <utils/infobar.h>
|
||||||
|
#include <utils/mimeutils.h>
|
||||||
#include <utils/temporarydirectory.h>
|
#include <utils/temporarydirectory.h>
|
||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
@@ -26,6 +27,13 @@
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
const char C_PY_MIMETYPE[] = "text/x-python";
|
||||||
|
const char C_PY_GUI_MIMETYPE[] = "text/x-python-gui";
|
||||||
|
const char C_PY3_MIMETYPE[] = "text/x-python3";
|
||||||
|
const char C_PY_MIME_ICON[] = "text-x-python";
|
||||||
|
} // namespace
|
||||||
|
|
||||||
namespace Debugger::Internal {
|
namespace Debugger::Internal {
|
||||||
|
|
||||||
const char installDebugPyInfoBarId[] = "Python::InstallDebugPy";
|
const char installDebugPyInfoBarId[] = "Python::InstallDebugPy";
|
||||||
@@ -199,16 +207,6 @@ void PyDapEngine::quitDebugger()
|
|||||||
DebuggerEngine::quitDebugger();
|
DebuggerEngine::quitDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PyDapEngine::acceptsBreakpoint(const BreakpointParameters &bp) const
|
|
||||||
{
|
|
||||||
return bp.fileName.endsWith(".py");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PyDapEngine::isLocalAttachEngine() const
|
|
||||||
{
|
|
||||||
return runParameters().startMode == AttachToLocalProcess;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PyDapEngine::setupEngine()
|
void PyDapEngine::setupEngine()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
||||||
@@ -265,6 +263,18 @@ void PyDapEngine::setupEngine()
|
|||||||
m_dapClient->dataProvider()->start();
|
m_dapClient->dataProvider()->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PyDapEngine::acceptsBreakpoint(const BreakpointParameters &bp) const
|
||||||
|
{
|
||||||
|
const auto mimeType = Utils::mimeTypeForFile(bp.fileName);
|
||||||
|
return mimeType.matchesName(C_PY3_MIMETYPE) || mimeType.matchesName(C_PY_GUI_MIMETYPE)
|
||||||
|
|| mimeType.matchesName(C_PY_MIMETYPE) || mimeType.matchesName(C_PY_MIME_ICON);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PyDapEngine::isLocalAttachEngine() const
|
||||||
|
{
|
||||||
|
return runParameters().startMode == AttachToLocalProcess;
|
||||||
|
}
|
||||||
|
|
||||||
const QLoggingCategory &PyDapEngine::logCategory()
|
const QLoggingCategory &PyDapEngine::logCategory()
|
||||||
{
|
{
|
||||||
static const QLoggingCategory logCategory = QLoggingCategory("qtc.dbg.dapengine.python",
|
static const QLoggingCategory logCategory = QLoggingCategory("qtc.dbg.dapengine.python",
|
||||||
|
Reference in New Issue
Block a user