forked from qt-creator/qt-creator
QmlDebugger: user input on watches
Reviewed-by: hjk
This commit is contained in:
@@ -1311,6 +1311,16 @@ unsigned DebuggerEngine::debuggerCapabilities() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DebuggerEngine::canWatchWidgets() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DebuggerEngine::acceptsWatchesWhileRunning() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool DebuggerEngine::isSynchronous() const
|
bool DebuggerEngine::isSynchronous() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@@ -180,6 +180,8 @@ 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 unsigned debuggerCapabilities() const;
|
||||||
|
virtual bool canWatchWidgets() const;
|
||||||
|
virtual bool acceptsWatchesWhileRunning() const;
|
||||||
|
|
||||||
virtual bool isSynchronous() const;
|
virtual bool isSynchronous() const;
|
||||||
virtual QByteArray qtNamespace() const;
|
virtual QByteArray qtNamespace() const;
|
||||||
|
@@ -482,7 +482,7 @@ public:
|
|||||||
void runEngine() {}
|
void runEngine() {}
|
||||||
void shutdownEngine() {}
|
void shutdownEngine() {}
|
||||||
void shutdownInferior() {}
|
void shutdownInferior() {}
|
||||||
unsigned debuggerCapabilities() const { return 0; }
|
unsigned debuggerCapabilities() const { return AddWatcherCapability; }
|
||||||
bool acceptsBreakpoint(BreakpointId) const { return false; }
|
bool acceptsBreakpoint(BreakpointId) const { return false; }
|
||||||
bool acceptsDebuggerCommands() const { return false; }
|
bool acceptsDebuggerCommands() const { return false; }
|
||||||
};
|
};
|
||||||
|
@@ -1895,6 +1895,11 @@ unsigned GdbEngine::debuggerCapabilities() const
|
|||||||
return caps | SnapshotCapability;
|
return caps | SnapshotCapability;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GdbEngine::canWatchWidgets() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void GdbEngine::continueInferiorInternal()
|
void GdbEngine::continueInferiorInternal()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
||||||
|
@@ -110,6 +110,7 @@ private: ////////// General Interface //////////
|
|||||||
virtual void runEngine();
|
virtual void runEngine();
|
||||||
|
|
||||||
virtual unsigned debuggerCapabilities() const;
|
virtual unsigned debuggerCapabilities() const;
|
||||||
|
virtual bool canWatchWidgets() const;
|
||||||
virtual void detachDebugger();
|
virtual void detachDebugger();
|
||||||
virtual void shutdownEngine();
|
virtual void shutdownEngine();
|
||||||
virtual void shutdownInferior();
|
virtual void shutdownInferior();
|
||||||
|
@@ -248,6 +248,16 @@ unsigned QmlCppEngine::debuggerCapabilities() const
|
|||||||
return d->m_cppEngine->debuggerCapabilities();
|
return d->m_cppEngine->debuggerCapabilities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QmlCppEngine::canWatchWidgets() const
|
||||||
|
{
|
||||||
|
return d->m_activeEngine->canWatchWidgets();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QmlCppEngine::acceptsWatchesWhileRunning() const
|
||||||
|
{
|
||||||
|
return d->m_activeEngine->acceptsWatchesWhileRunning();
|
||||||
|
}
|
||||||
|
|
||||||
bool QmlCppEngine::isSynchronous() const
|
bool QmlCppEngine::isSynchronous() const
|
||||||
{
|
{
|
||||||
return d->m_activeEngine->isSynchronous();
|
return d->m_activeEngine->isSynchronous();
|
||||||
|
@@ -75,6 +75,8 @@ public:
|
|||||||
|
|
||||||
void setRegisterValue(int regnr, const QString &value);
|
void setRegisterValue(int regnr, const QString &value);
|
||||||
unsigned debuggerCapabilities() const;
|
unsigned debuggerCapabilities() const;
|
||||||
|
virtual bool canWatchWidgets() const;
|
||||||
|
virtual bool acceptsWatchesWhileRunning() const;
|
||||||
|
|
||||||
bool isSynchronous() const;
|
bool isSynchronous() const;
|
||||||
QByteArray qtNamespace() const;
|
QByteArray qtNamespace() const;
|
||||||
|
@@ -353,6 +353,11 @@ void QmlEngine::showMessage(const QString &msg, int channel, int timeout) const
|
|||||||
DebuggerEngine::showMessage(msg, channel, timeout);
|
DebuggerEngine::showMessage(msg, channel, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QmlEngine::acceptsWatchesWhileRunning() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void QmlEngine::closeConnection()
|
void QmlEngine::closeConnection()
|
||||||
{
|
{
|
||||||
disconnect(&d->m_adapter, SIGNAL(connectionStartupFailed()),
|
disconnect(&d->m_adapter, SIGNAL(connectionStartupFailed()),
|
||||||
|
@@ -63,6 +63,7 @@ public:
|
|||||||
void showMessage(const QString &msg, int channel = LogDebug,
|
void showMessage(const QString &msg, int channel = LogDebug,
|
||||||
int timeout = -1) const;
|
int timeout = -1) const;
|
||||||
void filterApplicationMessage(const QString &msg, int channel);
|
void filterApplicationMessage(const QString &msg, int channel);
|
||||||
|
virtual bool acceptsWatchesWhileRunning() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void messageReceived(const QByteArray &message);
|
void messageReceived(const QByteArray &message);
|
||||||
|
@@ -811,7 +811,7 @@ Qt::ItemFlags WatchModel::flags(const QModelIndex &idx) const
|
|||||||
|
|
||||||
// Disable editing if debuggee is positively running.
|
// Disable editing if debuggee is positively running.
|
||||||
const bool isRunning = engine() && engine()->state() == InferiorRunOk;
|
const bool isRunning = engine() && engine()->state() == InferiorRunOk;
|
||||||
if (isRunning)
|
if (isRunning && engine() && !engine()->acceptsWatchesWhileRunning())
|
||||||
return notEditable;
|
return notEditable;
|
||||||
|
|
||||||
const WatchData &data = *watchItem(idx);
|
const WatchData &data = *watchItem(idx);
|
||||||
@@ -1186,6 +1186,10 @@ void WatchHandler::insertData(const WatchData &data)
|
|||||||
if (data.isSomethingNeeded() && data.iname.contains('.')) {
|
if (data.isSomethingNeeded() && data.iname.contains('.')) {
|
||||||
MODEL_DEBUG("SOMETHING NEEDED: " << data.toString());
|
MODEL_DEBUG("SOMETHING NEEDED: " << data.toString());
|
||||||
if (!m_engine->isSynchronous()) {
|
if (!m_engine->isSynchronous()) {
|
||||||
|
WatchModel *model = modelForIName(data.iname);
|
||||||
|
QTC_ASSERT(model, return);
|
||||||
|
model->insertData(data);
|
||||||
|
|
||||||
m_engine->updateWatchData(data);
|
m_engine->updateWatchData(data);
|
||||||
} else {
|
} else {
|
||||||
m_engine->showMessage(QLatin1String("ENDLESS LOOP: SOMETHING NEEDED: ")
|
m_engine->showMessage(QLatin1String("ENDLESS LOOP: SOMETHING NEEDED: ")
|
||||||
|
@@ -59,6 +59,7 @@
|
|||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
#include <QtGui/QResizeEvent>
|
#include <QtGui/QResizeEvent>
|
||||||
|
#include <QtGui/QInputDialog>
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -361,15 +362,15 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
|
|
||||||
const bool actionsEnabled = engine->debuggerActionsEnabled();
|
const bool actionsEnabled = engine->debuggerActionsEnabled();
|
||||||
const unsigned engineCapabilities = engine->debuggerCapabilities();
|
const unsigned engineCapabilities = engine->debuggerCapabilities();
|
||||||
const bool canHandleWatches =
|
const bool canHandleWatches = engineCapabilities & AddWatcherCapability;
|
||||||
actionsEnabled && (engineCapabilities & AddWatcherCapability);
|
|
||||||
const DebuggerState state = engine->state();
|
const DebuggerState state = engine->state();
|
||||||
|
const bool canInsertWatches = (state==InferiorStopOk) || ((state==InferiorRunOk) && engine->acceptsWatchesWhileRunning());
|
||||||
|
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QAction *actInsertNewWatchItem = menu.addAction(tr("Insert New Watch Item"));
|
QAction *actInsertNewWatchItem = menu.addAction(tr("Insert New Watch Item"));
|
||||||
actInsertNewWatchItem->setEnabled(canHandleWatches);
|
actInsertNewWatchItem->setEnabled(canHandleWatches && canInsertWatches);
|
||||||
QAction *actSelectWidgetToWatch = menu.addAction(tr("Select Widget to Watch"));
|
QAction *actSelectWidgetToWatch = menu.addAction(tr("Select Widget to Watch"));
|
||||||
actSelectWidgetToWatch->setEnabled(canHandleWatches);
|
actSelectWidgetToWatch->setEnabled(canHandleWatches && (engine->canWatchWidgets()));
|
||||||
|
|
||||||
// Offer to open address pointed to or variable address.
|
// Offer to open address pointed to or variable address.
|
||||||
const bool createPointerActions = pointerValue && pointerValue != address;
|
const bool createPointerActions = pointerValue && pointerValue != address;
|
||||||
@@ -497,7 +498,13 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
if (act == actAdjustColumnWidths) {
|
if (act == actAdjustColumnWidths) {
|
||||||
resizeColumnsToContents();
|
resizeColumnsToContents();
|
||||||
} else if (act == actInsertNewWatchItem) {
|
} else if (act == actInsertNewWatchItem) {
|
||||||
watchExpression(QString());
|
bool ok;
|
||||||
|
QString newExp = QInputDialog::getText(this, tr("Enter watch expression"),
|
||||||
|
tr("Expression:"), QLineEdit::Normal,
|
||||||
|
QString(), &ok);
|
||||||
|
if (ok && !newExp.isEmpty()) {
|
||||||
|
watchExpression(newExp);
|
||||||
|
}
|
||||||
} else if (act == actOpenMemoryEditAtVariableAddress) {
|
} else if (act == actOpenMemoryEditAtVariableAddress) {
|
||||||
currentEngine()->openMemoryView(address);
|
currentEngine()->openMemoryView(address);
|
||||||
} else if (act == actOpenMemoryEditAtPointerValue) {
|
} else if (act == actOpenMemoryEditAtPointerValue) {
|
||||||
|
Reference in New Issue
Block a user