Commit d42b9b02 authored by hjk's avatar hjk

debugger: remove commandline options to disable debugger engines

This was mostly useful in cases where the guessing magic failed.
With the new Profiles, the debugger engines can be adjusted there.

Change-Id: I96622775588bb46c3e4e35af27e352593eb405d1
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent f2bf6c9a
......@@ -22,9 +22,6 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
<dependency name=\"CppEditor\" version=\"$$QTCREATOR_VERSION\" type=\"optional\"/>
</dependencyList>
<argumentList>
<argument name=\"-disable-cdb\">Disable Cdb debugger engine</argument>
<argument name=\"-disable-gdb\">Disable Gdb debugger engine</argument>
<argument name=\"-disable-sdb\">Disable Qt Script debugger engine</argument>
<argument name=\"-debug\" parameter=\"pid\">Attach to local process</argument>
<argument name=\"-debug\" parameter=\"executable\">Start and debug executable</argument>
<argument name=\"-debug [executable,]core=&lt;corefile&gt;[,sysroot=&lt;sysroot&gt;]\">
......@@ -34,6 +31,5 @@ Alternatively, this plugin may be used under the terms of the GNU Lesser General
<argument name=\"-wincrashevent\"
parameter=\"eventhandle:pid\">
Event handle used for attaching to crashed processes</argument>
<argument name=\"-disable-tcf\">Disable Tcf debugger engine</argument>
</argumentList>
</plugin>
......@@ -101,7 +101,6 @@ public:
virtual void runControlFinished(DebuggerEngine *engine) = 0;
virtual void displayDebugger(DebuggerEngine *engine, bool updateEngine) = 0;
virtual DebuggerLanguages activeLanguages() const = 0;
virtual unsigned enabledEngines() const = 0;
virtual void synchronizeBreakpoints() = 0;
virtual bool initialize(const QStringList &arguments, QString *errorMessage) = 0;
......
......@@ -804,7 +804,6 @@ public slots:
void runControlStarted(DebuggerEngine *engine);
void runControlFinished(DebuggerEngine *engine);
DebuggerLanguages activeLanguages() const;
unsigned enabledEngines() const { return m_cmdLineEnabledEngines; }
// QString debuggerForAbi(const Abi &abi, DebuggerEngineType et = NoEngineType) const;
void remoteCommand(const QStringList &options, const QStringList &);
......@@ -1088,10 +1087,8 @@ public slots:
void showModuleSymbols(const QString &moduleName, const Symbols &symbols);
bool parseArgument(QStringList::const_iterator &it,
const QStringList::const_iterator &cend,
unsigned *enabledEngines, QString *errorMessage);
bool parseArguments(const QStringList &args,
unsigned *enabledEngines, QString *errorMessage);
const QStringList::const_iterator &cend, QString *errorMessage);
bool parseArguments(const QStringList &args, QString *errorMessage);
DebuggerToolTipManager *toolTipManager() const { return m_toolTipManager; }
QSharedPointer<GlobalDebuggerOptions> globalDebuggerOptions() const { return m_globalDebuggerOptions; }
......@@ -1179,8 +1176,6 @@ public:
DebuggerEngine *m_currentEngine;
DebuggerSettings *m_debuggerSettings;
QSettings *m_coreSettings;
bool m_gdbBinariesChanged;
uint m_cmdLineEnabledEngines;
QStringList m_arguments;
DebuggerToolTipManager *m_toolTipManager;
CommonOptionsPage *m_commonOptionsPage;
......@@ -1229,9 +1224,6 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) :
m_currentEngine = 0;
m_debuggerSettings = 0;
m_gdbBinariesChanged = true;
m_cmdLineEnabledEngines = AllEngineTypes;
m_reverseToolButton = 0;
m_startAction = 0;
m_debugWithoutDeployAction = 0;
......@@ -1299,8 +1291,7 @@ void DebuggerPluginPrivate::maybeEnrichParameters(DebuggerStartParameters *sp)
}
bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
const QStringList::const_iterator &cend,
unsigned *enabledEngines, QString *errorMessage)
const QStringList::const_iterator &cend, QString *errorMessage)
{
const QString &option = *it;
// '-debug <pid>'
......@@ -1387,42 +1378,18 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
m_scheduledStarts.append(sp);
return true;
}
// Engine disabling.
if (option == _("-disable-cdb")) {
*enabledEngines &= ~CdbEngineType;
return true;
}
if (option == _("-disable-gdb")) {
*enabledEngines &= ~GdbEngineType;
return true;
}
if (option == _("-disable-qmldb")) {
*enabledEngines &= ~QmlEngineType;
return true;
}
if (option == _("-disable-sdb")) {
*enabledEngines &= ~ScriptEngineType;
return true;
}
if (option == _("-disable-lldb")) {
*enabledEngines &= ~LldbEngineType;
return true;
}
*errorMessage = DebuggerPlugin::tr("Invalid debugger option: %1").arg(option);
return false;
}
bool DebuggerPluginPrivate::parseArguments(const QStringList &args,
unsigned *enabledEngines, QString *errorMessage)
QString *errorMessage)
{
const QStringList::const_iterator cend = args.constEnd();
for (QStringList::const_iterator it = args.constBegin(); it != cend; ++it)
if (!parseArgument(it, cend, enabledEngines, errorMessage))
if (!parseArgument(it, cend, errorMessage))
return false;
if (Constants::Internal::debug)
qDebug().nospace() << args << "engines=0x"
<< QString::number(*enabledEngines, 16) << '\n';
return true;
}
......@@ -2653,10 +2620,9 @@ void DebuggerPluginPrivate::remoteCommand(const QStringList &options,
if (options.isEmpty())
return;
unsigned enabledEngines = 0;
QString errorMessage;
if (!parseArguments(options, &enabledEngines, &errorMessage)) {
if (!parseArguments(options, &errorMessage)) {
qWarning("%s", qPrintable(errorMessage));
return;
}
......@@ -2885,7 +2851,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
// Do not fail to load the whole plugin if something goes wrong here.
QString errorMessage;
if (!parseArguments(m_arguments, &m_cmdLineEnabledEngines, &errorMessage)) {
if (!parseArguments(m_arguments, &errorMessage)) {
errorMessage = tr("Error evaluating command line arguments: %1")
.arg(errorMessage);
qWarning("%s\n", qPrintable(errorMessage));
......@@ -3148,18 +3114,14 @@ void DebuggerPluginPrivate::extensionsInitialized()
}
QList<IOptionsPage *> engineOptionPages;
if (m_cmdLineEnabledEngines & GdbEngineType)
addGdbOptionPages(&engineOptionPages);
addCdbOptionPages(&engineOptionPages);
addGdbOptionPages(&engineOptionPages);
addCdbOptionPages(&engineOptionPages);
#ifdef WITH_LLDB
if (m_cmdLineEnabledEngines & LldbEngineType)
addLldbOptionPages(&engineOptionPages);
addLldbOptionPages(&engineOptionPages);
#endif
//if (m_cmdLineEnabledEngines & ScriptEngineType)
// addScriptOptionPages(&engineOptionPages);
//if (m_cmdLineEnabledEngines & TcfEngineType)
// addTcfOptionPages(&engineOptionPages);
// addScriptOptionPages(&engineOptionPages);
// addTcfOptionPages(&engineOptionPages);
foreach (IOptionsPage *op, engineOptionPages)
m_plugin->addAutoReleasedObject(op);
......
......@@ -701,18 +701,10 @@ QString ConfigurationCheck::errorDetailsString() const
// Convenience helper to check whether an engine is enabled and configured
// correctly.
static inline bool canUseEngine(DebuggerEngineType et,
static bool canUseEngine(DebuggerEngineType et,
const DebuggerStartParameters &sp,
unsigned cmdLineEnabledEngines,
ConfigurationCheck *result)
{
// Enabled?
if ((et & cmdLineEnabledEngines) == 0) {
result->errorDetails.push_back(DebuggerPlugin::tr("The debugger engine '%1' is disabled.").
arg(QLatin1String(engineTypeName(et))));
return false;
}
// Configured.
switch (et) {
case CdbEngineType:
return checkCdbConfiguration(sp, result);
......@@ -749,19 +741,11 @@ DEBUGGER_EXPORT ConfigurationCheck checkDebugConfiguration(const DebuggerStartPa
}
if (debug)
qDebug() << " Required: " << engineTypeNames(requiredTypes);
// Filter out disabled types, command line + current settings.
unsigned cmdLineEnabledEngines = debuggerCore()->enabledEngines();
#ifdef WITH_LLDB
if (!Core::ICore::settings()->value(QLatin1String("LLDB/enabled")).toBool())
cmdLineEnabledEngines &= ~LldbEngineType;
#else
cmdLineEnabledEngines &= ~LldbEngineType;
#endif
DebuggerEngineType usableType = NoEngineType;
QList<DebuggerEngineType> unavailableTypes;
foreach (DebuggerEngineType et, requiredTypes) {
if (canUseEngine(et, sp, cmdLineEnabledEngines, &result)) {
if (canUseEngine(et, sp, &result)) {
result.errorDetails.clear();
usableType = et;
break;
......
......@@ -56,7 +56,8 @@ public:
};
DebuggerStartParameters()
: isSnapshot(false),
: engineType(NoEngineType),
isSnapshot(false),
attachPID(-1),
useTerminal(false),
breakOnMain(false),
......@@ -78,6 +79,7 @@ public:
//Core::Id profileId;
DebuggerEngineType engineType;
QString sysRoot;
QString debuggerCommand;
ProjectExplorer::Abi toolChainAbi;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment