forked from qt-creator/qt-creator
Debugger: Replace virtuals by capability flags.
Change-Id: If09efd21dc44e356eb575bb6170356fdbd409b39 Reviewed-on: http://codereview.qt.nokia.com/2625 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -1074,7 +1074,7 @@ void CdbEngine::updateLocalVariable(const QByteArray &iname)
|
||||
unsigned CdbEngine::debuggerCapabilities() const
|
||||
{
|
||||
return DisassemblerCapability | RegisterCapability | ShowMemoryCapability
|
||||
|WatchpointByAddressCapability|JumpToLineCapability|AddWatcherCapability
|
||||
|WatchpointByAddressCapability|JumpToLineCapability|AddWatcherCapability|WatchWidgetsCapability
|
||||
|ReloadModuleCapability
|
||||
|BreakOnThrowAndCatchCapability // Sort-of: Can break on throw().
|
||||
|BreakConditionCapability|TracePointCapability
|
||||
@@ -1083,11 +1083,6 @@ unsigned CdbEngine::debuggerCapabilities() const
|
||||
|RunToLineCapability;
|
||||
}
|
||||
|
||||
bool CdbEngine::canWatchWidgets() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void CdbEngine::executeStep()
|
||||
{
|
||||
if (!m_operateByInstruction)
|
||||
|
||||
@@ -99,7 +99,6 @@ public:
|
||||
virtual void updateWatchData(const WatchData &data,
|
||||
const WatchUpdateFlags & flags = WatchUpdateFlags());
|
||||
virtual unsigned debuggerCapabilities() const;
|
||||
virtual bool canWatchWidgets() const;
|
||||
virtual void watchPoint(const QPoint &);
|
||||
virtual void setRegisterValue(int regnr, const QString &value);
|
||||
|
||||
|
||||
@@ -148,12 +148,14 @@ enum DebuggerCapabilities
|
||||
ReturnFromFunctionCapability = 0x2000,
|
||||
CreateFullBacktraceCapability = 0x4000,
|
||||
AddWatcherCapability = 0x8000,
|
||||
WatchpointByAddressCapability = 0x10000,
|
||||
WatchpointByExpressionCapability = 0x20000,
|
||||
ShowModuleSymbolsCapability = 0x40000,
|
||||
CatchCapability = 0x80000, //!< fork, vfork, syscall
|
||||
OperateByInstructionCapability = 0x100000,
|
||||
RunToLineCapability = 0x200000,
|
||||
AddWatcherWhileRunningCapability = 0x10000,
|
||||
WatchWidgetsCapability = 0x20000,
|
||||
WatchpointByAddressCapability = 0x40000,
|
||||
WatchpointByExpressionCapability = 0x80000,
|
||||
ShowModuleSymbolsCapability = 0x100000,
|
||||
CatchCapability = 0x200000, //!< fork, vfork, syscall
|
||||
OperateByInstructionCapability = 0x400000,
|
||||
RunToLineCapability = 0x800000,
|
||||
AllDebuggerCapabilities = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
|
||||
@@ -1298,16 +1298,6 @@ unsigned DebuggerEngine::debuggerCapabilities() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool DebuggerEngine::canWatchWidgets() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DebuggerEngine::acceptsWatchesWhileRunning() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DebuggerEngine::isSynchronous() const
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -193,8 +193,6 @@ public:
|
||||
virtual void setRegisterValue(int regnr, const QString &value);
|
||||
virtual void addOptionPages(QList<Core::IOptionsPage*> *) const;
|
||||
virtual unsigned debuggerCapabilities() const;
|
||||
virtual bool canWatchWidgets() const;
|
||||
virtual bool acceptsWatchesWhileRunning() const;
|
||||
|
||||
virtual bool isSynchronous() const;
|
||||
virtual QByteArray qtNamespace() const;
|
||||
|
||||
@@ -1999,6 +1999,7 @@ unsigned GdbEngine::debuggerCapabilities() const
|
||||
| WatchpointByAddressCapability
|
||||
| WatchpointByExpressionCapability
|
||||
| AddWatcherCapability
|
||||
| WatchWidgetsCapability
|
||||
| ShowModuleSymbolsCapability
|
||||
| CatchCapability
|
||||
| OperateByInstructionCapability
|
||||
@@ -2014,10 +2015,6 @@ unsigned GdbEngine::debuggerCapabilities() const
|
||||
return caps | SnapshotCapability;
|
||||
}
|
||||
|
||||
bool GdbEngine::canWatchWidgets() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void GdbEngine::continueInferiorInternal()
|
||||
{
|
||||
|
||||
@@ -238,7 +238,6 @@ private: ////////// General Interface //////////
|
||||
virtual void runEngine();
|
||||
|
||||
virtual unsigned debuggerCapabilities() const;
|
||||
virtual bool canWatchWidgets() const;
|
||||
virtual void detachDebugger();
|
||||
virtual void shutdownEngine();
|
||||
virtual void shutdownInferior();
|
||||
|
||||
@@ -252,17 +252,15 @@ void QmlCppEngine::setRegisterValue(int regnr, const QString &value)
|
||||
unsigned QmlCppEngine::debuggerCapabilities() const
|
||||
{
|
||||
// ### this could also be an OR of both engines' capabilities
|
||||
return d->m_cppEngine->debuggerCapabilities();
|
||||
unsigned result = d->m_cppEngine->debuggerCapabilities();
|
||||
if (d->m_activeEngine != d->m_cppEngine) {
|
||||
const unsigned qmlCapabilities = d->m_qmlEngine->debuggerCapabilities();
|
||||
if (qmlCapabilities & AddWatcherWhileRunningCapability)
|
||||
result |= AddWatcherWhileRunningCapability;
|
||||
if (!(qmlCapabilities & WatchWidgetsCapability))
|
||||
result &= ~WatchWidgetsCapability;
|
||||
}
|
||||
|
||||
bool QmlCppEngine::canWatchWidgets() const
|
||||
{
|
||||
return d->m_activeEngine->canWatchWidgets();
|
||||
}
|
||||
|
||||
bool QmlCppEngine::acceptsWatchesWhileRunning() const
|
||||
{
|
||||
return d->m_activeEngine->acceptsWatchesWhileRunning();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool QmlCppEngine::isSynchronous() const
|
||||
|
||||
@@ -74,8 +74,6 @@ public:
|
||||
|
||||
void setRegisterValue(int regnr, const QString &value);
|
||||
unsigned debuggerCapabilities() const;
|
||||
virtual bool canWatchWidgets() const;
|
||||
virtual bool acceptsWatchesWhileRunning() const;
|
||||
|
||||
bool isSynchronous() const;
|
||||
QByteArray qtNamespace() const;
|
||||
|
||||
@@ -321,11 +321,6 @@ void QmlEngine::showMessage(const QString &msg, int channel, int timeout) const
|
||||
DebuggerEngine::showMessage(msg, channel, timeout);
|
||||
}
|
||||
|
||||
bool QmlEngine::acceptsWatchesWhileRunning() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void QmlEngine::closeConnection()
|
||||
{
|
||||
disconnect(watchersModel(),SIGNAL(layoutChanged()),this,SLOT(synchronizeWatchers()));
|
||||
@@ -645,7 +640,7 @@ void QmlEngine::synchronizeWatchers()
|
||||
|
||||
unsigned QmlEngine::debuggerCapabilities() const
|
||||
{
|
||||
return AddWatcherCapability;
|
||||
return AddWatcherCapability|AddWatcherWhileRunningCapability;
|
||||
/*ReverseSteppingCapability | SnapshotCapability
|
||||
| AutoDerefPointersCapability | DisassemblerCapability
|
||||
| RegisterCapability | ShowMemoryCapability
|
||||
|
||||
@@ -66,7 +66,6 @@ public:
|
||||
void showMessage(const QString &msg, int channel = LogDebug,
|
||||
int timeout = -1) const;
|
||||
void filterApplicationMessage(const QString &msg, int channel);
|
||||
virtual bool acceptsWatchesWhileRunning() const;
|
||||
QString toFileInProject(const QUrl &fileUrl);
|
||||
void inferiorSpontaneousStop();
|
||||
|
||||
|
||||
@@ -892,7 +892,7 @@ Qt::ItemFlags WatchModel::flags(const QModelIndex &idx) const
|
||||
|
||||
// Disable editing if debuggee is positively running.
|
||||
const bool isRunning = engine() && engine()->state() == InferiorRunOk;
|
||||
if (isRunning && engine() && !engine()->acceptsWatchesWhileRunning())
|
||||
if (isRunning && engine() && !(engine()->debuggerCapabilities() & AddWatcherWhileRunningCapability))
|
||||
return notEditable;
|
||||
|
||||
const WatchData &data = *watchItem(idx);
|
||||
|
||||
@@ -716,7 +716,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
const DebuggerState state = engine->state();
|
||||
const bool canInsertWatches = state == InferiorStopOk
|
||||
|| state == InferiorUnrunnable
|
||||
|| (state == InferiorRunOk && engine->acceptsWatchesWhileRunning());
|
||||
|| (state == InferiorRunOk && (engineCapabilities & AddWatcherWhileRunningCapability));
|
||||
|
||||
QMenu breakpointMenu;
|
||||
breakpointMenu.setTitle(tr("Add Data Breakpoint..."));
|
||||
@@ -763,8 +763,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
QAction *actInsertNewWatchItem = menu.addAction(tr("Insert New Evaluated Expression"));
|
||||
actInsertNewWatchItem->setEnabled(canHandleWatches && canInsertWatches);
|
||||
QAction *actSelectWidgetToWatch = menu.addAction(tr("Select Widget to Watch"));
|
||||
actSelectWidgetToWatch->setEnabled(canHandleWatches && (engine->canWatchWidgets()));
|
||||
|
||||
actSelectWidgetToWatch->setEnabled(canHandleWatches
|
||||
&& (engine->debuggerCapabilities() & WatchWidgetsCapability));
|
||||
menu.addSeparator();
|
||||
|
||||
QAction *actWatchExpression = new QAction(addWatchActionText(exp), &menu);
|
||||
|
||||
Reference in New Issue
Block a user