Commit 496e9faf authored by hjk's avatar hjk Committed by hjk

debugger: replace static capability check by something potentially dynamic

This does not yet use the potential.

Change-Id: I087311fb7d59b46e49f65a84c4420c72a1227ebb
Reviewed-by: default avatarAurindam Jana <aurindam.jana@nokia.com>
parent 1c1b3840
...@@ -683,12 +683,6 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const ...@@ -683,12 +683,6 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
if (debuggerCore()->boolSetting(UseToolTipsInBreakpointsView)) if (debuggerCore()->boolSetting(UseToolTipsInBreakpointsView))
return QVariant(it->toToolTip()); return QVariant(it->toToolTip());
break; break;
case EngineCapabilitiesRole: {
const unsigned caps = it.value().engine ?
it.value().engine->debuggerCapabilities() :
unsigned(AllDebuggerCapabilities);
return QVariant(caps);
}
} }
return QVariant(); return QVariant();
} }
......
...@@ -70,7 +70,7 @@ class BreakpointDialog : public QDialog ...@@ -70,7 +70,7 @@ class BreakpointDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit BreakpointDialog(unsigned engineCapabilities, QWidget *parent = 0); explicit BreakpointDialog(BreakpointModelId id, QWidget *parent = 0);
bool showDialog(BreakpointParameters *data, BreakpointParts *parts); bool showDialog(BreakpointParameters *data, BreakpointParts *parts);
void setParameters(const BreakpointParameters &data); void setParameters(const BreakpointParameters &data);
...@@ -95,18 +95,20 @@ private: ...@@ -95,18 +95,20 @@ private:
bool m_firstTypeChange; bool m_firstTypeChange;
}; };
BreakpointDialog::BreakpointDialog(unsigned engineCapabilities, QWidget *parent) BreakpointDialog::BreakpointDialog(BreakpointModelId id, QWidget *parent)
: QDialog(parent), m_enabledParts(-1), m_previousType(UnknownType), : QDialog(parent), m_enabledParts(-1), m_previousType(UnknownType),
m_firstTypeChange(true) m_firstTypeChange(true)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
m_ui.comboBoxType->setMaxVisibleItems(20); m_ui.comboBoxType->setMaxVisibleItems(20);
if (!(engineCapabilities & BreakConditionCapability)) if (DebuggerEngine *engine = breakHandler()->engine(id)) {
m_enabledParts &= ~ConditionPart; if (!engine->hasCapability(BreakConditionCapability))
if (!(engineCapabilities & BreakModuleCapability)) m_enabledParts &= ~ConditionPart;
m_enabledParts &= ~ModulePart; if (!engine->hasCapability(BreakModuleCapability))
if (!(engineCapabilities & TracePointCapability)) m_enabledParts &= ~ModulePart;
m_enabledParts &= ~TracePointPart; if (!engine->hasCapability(TracePointCapability))
m_enabledParts &= ~TracePointPart;
}
// Match BreakpointType (omitting unknown type). // Match BreakpointType (omitting unknown type).
QStringList types; QStringList types;
types << tr("File name and line number") types << tr("File name and line number")
...@@ -123,7 +125,7 @@ BreakpointDialog::BreakpointDialog(unsigned engineCapabilities, QWidget *parent) ...@@ -123,7 +125,7 @@ BreakpointDialog::BreakpointDialog(unsigned engineCapabilities, QWidget *parent)
<< tr("Break on QML signal handler") << tr("Break on QML signal handler")
<< tr("Break when JavaScript exception is thrown"); << tr("Break when JavaScript exception is thrown");
QTC_ASSERT(types.size() == BreakpointAtJavaScriptThrow, return; ) QTC_ASSERT(types.size() == BreakpointAtJavaScriptThrow, return);
m_ui.comboBoxType->addItems(types); m_ui.comboBoxType->addItems(types);
m_ui.pathChooserFileName->setExpectedKind(Utils::PathChooser::File); m_ui.pathChooserFileName->setExpectedKind(Utils::PathChooser::File);
connect(m_ui.comboBoxType, SIGNAL(activated(int)), SLOT(typeChanged(int))); connect(m_ui.comboBoxType, SIGNAL(activated(int)), SLOT(typeChanged(int)));
...@@ -448,7 +450,7 @@ class MultiBreakPointsDialog : public QDialog ...@@ -448,7 +450,7 @@ class MultiBreakPointsDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
MultiBreakPointsDialog(unsigned engineCapabilities, QWidget *parent = 0); MultiBreakPointsDialog(QWidget *parent = 0);
QString condition() const { return m_ui.lineEditCondition->text(); } QString condition() const { return m_ui.lineEditCondition->text(); }
int ignoreCount() const { return m_ui.spinBoxIgnoreCount->value(); } int ignoreCount() const { return m_ui.spinBoxIgnoreCount->value(); }
...@@ -464,7 +466,7 @@ private: ...@@ -464,7 +466,7 @@ private:
Ui::BreakCondition m_ui; Ui::BreakCondition m_ui;
}; };
MultiBreakPointsDialog::MultiBreakPointsDialog(unsigned engineCapabilities, QWidget *parent) : MultiBreakPointsDialog::MultiBreakPointsDialog(QWidget *parent) :
QDialog(parent) QDialog(parent)
{ {
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
...@@ -472,7 +474,7 @@ MultiBreakPointsDialog::MultiBreakPointsDialog(unsigned engineCapabilities, QWid ...@@ -472,7 +474,7 @@ MultiBreakPointsDialog::MultiBreakPointsDialog(unsigned engineCapabilities, QWid
setWindowTitle(tr("Edit Breakpoint Properties")); setWindowTitle(tr("Edit Breakpoint Properties"));
m_ui.spinBoxIgnoreCount->setMinimum(0); m_ui.spinBoxIgnoreCount->setMinimum(0);
m_ui.spinBoxIgnoreCount->setMaximum(2147483647); m_ui.spinBoxIgnoreCount->setMaximum(2147483647);
if (!(engineCapabilities & BreakConditionCapability)) { if (!debuggerCore()->currentEngine()->hasCapability(BreakConditionCapability)) {
m_ui.labelCondition->setEnabled(false); m_ui.labelCondition->setEnabled(false);
m_ui.lineEditCondition->setEnabled(false); m_ui.lineEditCondition->setEnabled(false);
} }
...@@ -624,7 +626,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev) ...@@ -624,7 +626,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(synchronizeAction); menu.addAction(synchronizeAction);
menu.addSeparator(); menu.addSeparator();
menu.addAction(debuggerCore()->action(UseToolTipsInBreakpointsView)); menu.addAction(debuggerCore()->action(UseToolTipsInBreakpointsView));
if (debuggerCore()->currentEngine()->debuggerCapabilities() & MemoryAddressCapability) if (debuggerCore()->currentEngine()->hasCapability(MemoryAddressCapability))
menu.addAction(debuggerCore()->action(UseAddressInBreakpointsView)); menu.addAction(debuggerCore()->action(UseAddressInBreakpointsView));
addBaseContextActions(&menu); addBaseContextActions(&menu);
...@@ -669,11 +671,8 @@ void BreakWindow::deleteBreakpoints(const BreakpointModelIds &ids) ...@@ -669,11 +671,8 @@ void BreakWindow::deleteBreakpoints(const BreakpointModelIds &ids)
void BreakWindow::editBreakpoint(BreakpointModelId id, QWidget *parent) void BreakWindow::editBreakpoint(BreakpointModelId id, QWidget *parent)
{ {
BreakpointParameters data = breakHandler()->breakpointData(id); BreakpointParameters data = breakHandler()->breakpointData(id);
unsigned engineCapabilities = AllDebuggerCapabilities;
if (const DebuggerEngine *engine = breakHandler()->engine(id))
engineCapabilities = engine->debuggerCapabilities();
BreakpointParts parts = NoParts; BreakpointParts parts = NoParts;
BreakpointDialog dialog(engineCapabilities, parent); BreakpointDialog dialog(id, parent);
if (dialog.showDialog(&data, &parts)) if (dialog.showDialog(&data, &parts))
breakHandler()->changeBreakpointData(id, data, parts); breakHandler()->changeBreakpointData(id, data, parts);
} }
...@@ -682,7 +681,7 @@ void BreakWindow::addBreakpoint() ...@@ -682,7 +681,7 @@ void BreakWindow::addBreakpoint()
{ {
BreakpointParameters data(BreakpointByFileAndLine); BreakpointParameters data(BreakpointByFileAndLine);
BreakpointParts parts = NoParts; BreakpointParts parts = NoParts;
BreakpointDialog dialog(AllDebuggerCapabilities, this); BreakpointDialog dialog(BreakpointModelId(), this);
dialog.setWindowTitle(tr("Add Breakpoint")); dialog.setWindowTitle(tr("Add Breakpoint"));
if (dialog.showDialog(&data, &parts)) if (dialog.showDialog(&data, &parts))
breakHandler()->appendBreakpoint(data); breakHandler()->appendBreakpoint(data);
...@@ -701,10 +700,7 @@ void BreakWindow::editBreakpoints(const BreakpointModelIds &ids) ...@@ -701,10 +700,7 @@ void BreakWindow::editBreakpoints(const BreakpointModelIds &ids)
// This allows to change properties of multiple breakpoints at a time. // This allows to change properties of multiple breakpoints at a time.
BreakHandler *handler = breakHandler(); BreakHandler *handler = breakHandler();
unsigned engineCapabilities = AllDebuggerCapabilities; MultiBreakPointsDialog dialog;
if (const DebuggerEngine *engine = breakHandler()->engine(id))
engineCapabilities = engine->debuggerCapabilities();
MultiBreakPointsDialog dialog(engineCapabilities);
const QString oldCondition = QString::fromLatin1(handler->condition(id)); const QString oldCondition = QString::fromLatin1(handler->condition(id));
dialog.setCondition(oldCondition); dialog.setCondition(oldCondition);
const int oldIgnoreCount = handler->ignoreCount(id); const int oldIgnoreCount = handler->ignoreCount(id);
......
...@@ -161,8 +161,7 @@ enum DebuggerCapabilities ...@@ -161,8 +161,7 @@ enum DebuggerCapabilities
CatchCapability = 0x200000, //!< fork, vfork, syscall CatchCapability = 0x200000, //!< fork, vfork, syscall
OperateByInstructionCapability = 0x400000, OperateByInstructionCapability = 0x400000,
RunToLineCapability = 0x800000, RunToLineCapability = 0x800000,
MemoryAddressCapability = 0x1000000, MemoryAddressCapability = 0x1000000
AllDebuggerCapabilities = 0xFFFFFFFF
}; };
enum LogChannel enum LogChannel
......
...@@ -547,9 +547,8 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) ...@@ -547,9 +547,8 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
if (!d->m_startParameters.environment.size()) if (!d->m_startParameters.environment.size())
d->m_startParameters.environment = Utils::Environment(); d->m_startParameters.environment = Utils::Environment();
const unsigned engineCapabilities = debuggerCapabilities();
debuggerCore()->action(OperateByInstruction) debuggerCore()->action(OperateByInstruction)
->setEnabled(engineCapabilities & DisassemblerCapability); ->setEnabled(hasCapability(DisassemblerCapability));
QTC_ASSERT(state() == DebuggerNotReady || state() == DebuggerFinished, QTC_ASSERT(state() == DebuggerNotReady || state() == DebuggerFinished,
qDebug() << state()); qDebug() << state());
...@@ -1346,11 +1345,6 @@ void DebuggerEngine::addOptionPages(QList<Core::IOptionsPage*> *) const ...@@ -1346,11 +1345,6 @@ void DebuggerEngine::addOptionPages(QList<Core::IOptionsPage*> *) const
{ {
} }
unsigned DebuggerEngine::debuggerCapabilities() const
{
return 0;
}
bool DebuggerEngine::isSynchronous() const bool DebuggerEngine::isSynchronous() const
{ {
return false; return false;
......
...@@ -193,7 +193,7 @@ public: ...@@ -193,7 +193,7 @@ public:
virtual void setRegisterValue(int regnr, const QString &value); virtual void setRegisterValue(int regnr, const QString &value);
virtual void addOptionPages(QList<Core::IOptionsPage*> *) const; virtual void addOptionPages(QList<Core::IOptionsPage*> *) const;
virtual unsigned debuggerCapabilities() const; virtual bool hasCapability(unsigned cap) const = 0;
virtual bool isSynchronous() const; virtual bool isSynchronous() const;
virtual QByteArray qtNamespace() const; virtual QByteArray qtNamespace() const;
......
...@@ -67,7 +67,6 @@ enum ModelRoles ...@@ -67,7 +67,6 @@ enum ModelRoles
DisplaySourceRole = 32, // Qt::UserRole DisplaySourceRole = 32, // Qt::UserRole
EngineStateRole, EngineStateRole,
EngineCapabilitiesRole,
EngineActionsEnabledRole, EngineActionsEnabledRole,
RequestActivationRole, RequestActivationRole,
RequestContextMenuRole, RequestContextMenuRole,
......
...@@ -483,12 +483,12 @@ public: ...@@ -483,12 +483,12 @@ public:
void runEngine() {} void runEngine() {}
void shutdownEngine() {} void shutdownEngine() {}
void shutdownInferior() {} void shutdownInferior() {}
unsigned debuggerCapabilities() const; bool hasCapability(unsigned cap) const;
bool acceptsBreakpoint(BreakpointModelId) const { return false; } bool acceptsBreakpoint(BreakpointModelId) const { return false; }
bool acceptsDebuggerCommands() const { return false; } bool acceptsDebuggerCommands() const { return false; }
}; };
unsigned DummyEngine::debuggerCapabilities() const bool DummyEngine::hasCapability(unsigned cap) const
{ {
// This can only be a first approximation of what to expect when running. // This can only be a first approximation of what to expect when running.
Project *project = ProjectExplorerPlugin::instance()->currentProject(); Project *project = ProjectExplorerPlugin::instance()->currentProject();
...@@ -501,13 +501,13 @@ unsigned DummyEngine::debuggerCapabilities() const ...@@ -501,13 +501,13 @@ unsigned DummyEngine::debuggerCapabilities() const
// This is a non-started Cdb or Gdb engine: // This is a non-started Cdb or Gdb engine:
if (activeRc->useCppDebugger()) if (activeRc->useCppDebugger())
return WatchpointByAddressCapability return cap & (WatchpointByAddressCapability
| BreakConditionCapability | BreakConditionCapability
| TracePointCapability | TracePointCapability
| OperateByInstructionCapability; | OperateByInstructionCapability);
// This is a Qml or unknown engine. // This is a Qml or unknown engine.
return AddWatcherCapability; return cap & AddWatcherCapability;
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
...@@ -1955,7 +1955,7 @@ void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor, ...@@ -1955,7 +1955,7 @@ void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor,
// Run to, jump to line below in stopped state. // Run to, jump to line below in stopped state.
if (currentEngine()->state() == InferiorStopOk && contextUsable) { if (currentEngine()->state() == InferiorStopOk && contextUsable) {
menu->addSeparator(); menu->addSeparator();
if (currentEngine()->debuggerCapabilities() & RunToLineCapability) { if (currentEngine()->hasCapability(RunToLineCapability)) {
const QString runText = args.address const QString runText = args.address
? DebuggerEngine::tr("Run to Address 0x%1").arg(args.address, 0, 16) ? DebuggerEngine::tr("Run to Address 0x%1").arg(args.address, 0, 16)
: DebuggerEngine::tr("Run to Line %1").arg(args.lineNumber); : DebuggerEngine::tr("Run to Line %1").arg(args.lineNumber);
...@@ -1964,7 +1964,7 @@ void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor, ...@@ -1964,7 +1964,7 @@ void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor,
connect(runToLineAction, SIGNAL(triggered()), SLOT(slotRunToLine())); connect(runToLineAction, SIGNAL(triggered()), SLOT(slotRunToLine()));
menu->addAction(runToLineAction); menu->addAction(runToLineAction);
} }
if (currentEngine()->debuggerCapabilities() & JumpToLineCapability) { if (currentEngine()->hasCapability(JumpToLineCapability)) {
const QString jumpText = args.address const QString jumpText = args.address
? DebuggerEngine::tr("Jump to Address 0x%1").arg(args.address, 0, 16) ? DebuggerEngine::tr("Jump to Address 0x%1").arg(args.address, 0, 16)
: DebuggerEngine::tr("Jump to Line %1").arg(args.lineNumber); : DebuggerEngine::tr("Jump to Line %1").arg(args.lineNumber);
...@@ -2326,8 +2326,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) ...@@ -2326,8 +2326,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
if (stopped) if (stopped)
QApplication::alert(mainWindow(), 3000); QApplication::alert(mainWindow(), 3000);
const uint caps = engine->debuggerCapabilities(); const bool canReverse = engine->hasCapability(ReverseSteppingCapability)
const bool canReverse = (caps & ReverseSteppingCapability)
&& boolSetting(EnableReverseDebugging); && boolSetting(EnableReverseDebugging);
m_reverseDirectionAction->setEnabled(canReverse); m_reverseDirectionAction->setEnabled(canReverse);
...@@ -2335,7 +2334,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) ...@@ -2335,7 +2334,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_watchAction2->setEnabled(true); m_watchAction2->setEnabled(true);
m_breakAction->setEnabled(true); m_breakAction->setEnabled(true);
const bool canOperateByInstruction = (caps & OperateByInstructionCapability) const bool canOperateByInstruction = engine->hasCapability(OperateByInstructionCapability)
&& (stopped || isCore); && (stopped || isCore);
action(OperateByInstruction)->setEnabled(canOperateByInstruction); action(OperateByInstruction)->setEnabled(canOperateByInstruction);
...@@ -2348,15 +2347,15 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) ...@@ -2348,15 +2347,15 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_nextAction->setToolTip(QString()); m_nextAction->setToolTip(QString());
m_stepOutAction->setEnabled(stopped); m_stepOutAction->setEnabled(stopped);
m_runToLineAction->setEnabled(stopped && (caps & RunToLineCapability)); m_runToLineAction->setEnabled(stopped && engine->hasCapability(RunToLineCapability));
m_runToSelectedFunctionAction->setEnabled(stopped); m_runToSelectedFunctionAction->setEnabled(stopped);
m_returnFromFunctionAction-> m_returnFromFunctionAction->
setEnabled(stopped && (caps & ReturnFromFunctionCapability)); setEnabled(stopped && engine->hasCapability(ReturnFromFunctionCapability));
const bool canJump = stopped && (caps & JumpToLineCapability); const bool canJump = stopped && engine->hasCapability(JumpToLineCapability);
m_jumpToLineAction->setEnabled(canJump); m_jumpToLineAction->setEnabled(canJump);
const bool canDeref = actionsEnabled && (caps & AutoDerefPointersCapability); const bool canDeref = actionsEnabled && engine->hasCapability(AutoDerefPointersCapability);
action(AutoDerefPointers)->setEnabled(canDeref); action(AutoDerefPointers)->setEnabled(canDeref);
action(AutoDerefPointers)->setEnabled(true); action(AutoDerefPointers)->setEnabled(true);
action(ExpandStack)->setEnabled(actionsEnabled); action(ExpandStack)->setEnabled(actionsEnabled);
......
...@@ -1969,9 +1969,9 @@ void GdbEngine::setupEngine() ...@@ -1969,9 +1969,9 @@ void GdbEngine::setupEngine()
m_gdbAdapter->startAdapter(); m_gdbAdapter->startAdapter();
} }
unsigned GdbEngine::debuggerCapabilities() const bool GdbEngine::hasCapability(unsigned cap) const
{ {
unsigned caps = ReverseSteppingCapability if (cap & (ReverseSteppingCapability
| AutoDerefPointersCapability | AutoDerefPointersCapability
| DisassemblerCapability | DisassemblerCapability
| RegisterCapability | RegisterCapability
...@@ -1992,16 +1992,17 @@ unsigned GdbEngine::debuggerCapabilities() const ...@@ -1992,16 +1992,17 @@ unsigned GdbEngine::debuggerCapabilities() const
| CatchCapability | CatchCapability
| OperateByInstructionCapability | OperateByInstructionCapability
| RunToLineCapability | RunToLineCapability
| MemoryAddressCapability; | MemoryAddressCapability))
return true;
if (startParameters().startMode == AttachCore) if (startParameters().startMode == AttachCore)
return caps; return false;
// FIXME: Remove in case we have gdb 7.x on Mac. // FIXME: Remove in case we have gdb 7.x on Mac.
if (startParameters().toolChainAbi.os() == Abi::MacOS) if (startParameters().toolChainAbi.os() == Abi::MacOS)
return caps; return false;
return caps | SnapshotCapability; return cap == SnapshotCapability;
} }
......
...@@ -238,7 +238,7 @@ private: ////////// General Interface ////////// ...@@ -238,7 +238,7 @@ private: ////////// General Interface //////////
virtual void setupInferior(); virtual void setupInferior();
virtual void runEngine(); virtual void runEngine();
virtual unsigned debuggerCapabilities() const; virtual bool hasCapability(unsigned) const;
virtual void detachDebugger(); virtual void detachDebugger();
virtual void shutdownEngine(); virtual void shutdownEngine();
virtual void shutdownInferior(); virtual void shutdownInferior();
......
...@@ -116,6 +116,7 @@ public: ...@@ -116,6 +116,7 @@ public:
void updateWatchData(const WatchData &data, void updateWatchData(const WatchData &data,
const WatchUpdateFlags &flags = WatchUpdateFlags()); const WatchUpdateFlags &flags = WatchUpdateFlags());
void fetchFrameSource(qint64 id); void fetchFrameSource(qint64 id);
bool hasCapability(unsigned) const { return false; }
void rpcCall(Function f, QByteArray payload = QByteArray()); void rpcCall(Function f, QByteArray payload = QByteArray());
protected: protected:
......
...@@ -90,29 +90,26 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev) ...@@ -90,29 +90,26 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
DebuggerEngine *engine = debuggerCore()->currentEngine(); DebuggerEngine *engine = debuggerCore()->currentEngine();
QTC_ASSERT(engine, return); QTC_ASSERT(engine, return);
const bool enabled = engine->debuggerActionsEnabled(); const bool enabled = engine->debuggerActionsEnabled();
const unsigned capabilities = engine->debuggerCapabilities(); const bool canReload = engine->hasCapability(ReloadModuleCapability);
const bool canLoadSymbols = engine->hasCapability(ReloadModuleSymbolsCapability);
QMenu menu; QMenu menu;
QAction *actUpdateModuleList QAction *actUpdateModuleList
= new QAction(tr("Update Module List"), &menu); = new QAction(tr("Update Module List"), &menu);
actUpdateModuleList actUpdateModuleList->setEnabled(enabled && canReload);
->setEnabled(enabled && (capabilities & ReloadModuleCapability));
QAction *actShowModuleSources QAction *actShowModuleSources
= new QAction(tr("Show Source Files for Module \"%1\"").arg(name), &menu); = new QAction(tr("Show Source Files for Module \"%1\"").arg(name), &menu);
actShowModuleSources actShowModuleSources->setEnabled(enabled && canReload);
->setEnabled(enabled && (capabilities & ReloadModuleCapability));
QAction *actLoadSymbolsForAllModules QAction *actLoadSymbolsForAllModules
= new QAction(tr("Load Symbols for All Modules"), &menu); = new QAction(tr("Load Symbols for All Modules"), &menu);
actLoadSymbolsForAllModules actLoadSymbolsForAllModules->setEnabled(enabled && canLoadSymbols);
-> setEnabled(enabled && (capabilities & ReloadModuleSymbolsCapability));
QAction *actExamineAllModules QAction *actExamineAllModules
= new QAction(tr("Examine All Modules"), &menu); = new QAction(tr("Examine All Modules"), &menu);
actExamineAllModules actExamineAllModules->setEnabled(enabled && canLoadSymbols);
-> setEnabled(enabled && (capabilities & ReloadModuleSymbolsCapability));
QAction *actLoadSymbolsForModule = 0; QAction *actLoadSymbolsForModule = 0;
QAction *actEditFile = 0; QAction *actEditFile = 0;
...@@ -130,14 +127,12 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev) ...@@ -130,14 +127,12 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
} else { } else {
actLoadSymbolsForModule actLoadSymbolsForModule
= new QAction(tr("Load Symbols for Module \"%1\"").arg(name), &menu); = new QAction(tr("Load Symbols for Module \"%1\"").arg(name), &menu);
actLoadSymbolsForModule actLoadSymbolsForModule->setEnabled(canLoadSymbols);
->setEnabled(capabilities & ReloadModuleSymbolsCapability);
actEditFile actEditFile
= new QAction(tr("Edit File \"%1\"").arg(name), &menu); = new QAction(tr("Edit File \"%1\"").arg(name), &menu);
actShowModuleSymbols actShowModuleSymbols
= new QAction(tr("Show Symbols in File \"%1\"").arg(name), &menu); = new QAction(tr("Show Symbols in File \"%1\"").arg(name), &menu);
actShowModuleSymbols actShowModuleSymbols->setEnabled(engine->hasCapability(ShowModuleSymbolsCapability));
->setEnabled(capabilities & ShowModuleSymbolsCapability);
actShowDependencies = new QAction(tr("Show Dependencies of \"%1\"").arg(name), &menu); actShowDependencies = new QAction(tr("Show Dependencies of \"%1\"").arg(name), &menu);
actShowDependencies->setEnabled(!fileName.isEmpty()); actShowDependencies->setEnabled(!fileName.isEmpty());
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
......
...@@ -828,9 +828,9 @@ void PdbEngine::handleListLocals(const PdbResponse &response) ...@@ -828,9 +828,9 @@ void PdbEngine::handleListLocals(const PdbResponse &response)
handler->insertBulkData(list); handler->insertBulkData(list);
} }
unsigned PdbEngine::debuggerCapabilities() const bool PdbEngine::hasCapability(unsigned cap) const
{ {
return ReloadModuleCapability|BreakConditionCapability; return cap & (ReloadModuleCapability|BreakConditionCapability);
} }
DebuggerEngine *createPdbEngine(const DebuggerStartParameters &startParameters) DebuggerEngine *createPdbEngine(const DebuggerStartParameters &startParameters)
......
...@@ -116,7 +116,7 @@ signals: ...@@ -116,7 +116,7 @@ signals:
private: private:
QString errorMessage(QProcess::ProcessError error) const; QString errorMessage(QProcess::ProcessError error) const;
unsigned debuggerCapabilities() const; bool hasCapability(unsigned cap) const;
Q_SLOT void handlePdbFinished(int, QProcess::ExitStatus status); Q_SLOT void handlePdbFinished(int, QProcess::ExitStatus status);
Q_SLOT void handlePdbError(QProcess::ProcessError error); Q_SLOT void handlePdbError(QProcess::ProcessError error);
......
...@@ -250,18 +250,18 @@ void QmlCppEngine::setRegisterValue(int regnr, const QString &value) ...@@ -250,18 +250,18 @@ void QmlCppEngine::setRegisterValue(int regnr, const QString &value)
d->m_cppEngine->setRegisterValue(regnr, value); d->m_cppEngine->setRegisterValue(regnr, value);
} }
unsigned QmlCppEngine::debuggerCapabilities() const
bool QmlCppEngine::hasCapability(unsigned cap) const
{ {
// ### this could also be an OR of both engines' capabilities // ### this could also be an OR of both engines' capabilities
unsigned result = d->m_cppEngine->debuggerCapabilities(); bool hasCap = d->m_cppEngine->hasCapability(cap);
if (d->m_activeEngine != d->m_cppEngine) { if (d->m_activeEngine != d->m_cppEngine) {
const unsigned qmlCapabilities = d->m_qmlEngine->debuggerCapabilities(); if (cap == AddWatcherWhileRunningCapability)
if (qmlCapabilities & AddWatcherWhileRunningCapability) hasCap = hasCap || d->m_qmlEngine->hasCapability(cap);
result |= AddWatcherWhileRunningCapability; if (cap == WatchWidgetsCapability)
if (!(qmlCapabilities & WatchWidgetsCapability)) hasCap = hasCap && d->m_qmlEngine->hasCapability(cap);
result &= ~WatchWidgetsCapability;
} }
return result; return hasCap;
} }