diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 4b7ac701bf73b8077d60dc9e2717201de9f0d54f..cf2066c7909ac6d7a320e771dbc6a4e976218b18 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -278,7 +278,7 @@ void DebuggerManager::init() connect(m_watchHandler, SIGNAL(setSessionValueRequested(QString,QVariant)), this, SIGNAL(setSessionValueRequested(QString,QVariant))); connect(theDebuggerAction(AssignValue), SIGNAL(triggered()), - this, SLOT(assignValueInDebugger())); + this, SLOT(assignValueInDebugger()), Qt::QueuedConnection); // Tooltip QTreeView *tooltipView = qobject_cast<QTreeView *>(m_tooltipWindow); diff --git a/src/plugins/debugger/scriptengine.cpp b/src/plugins/debugger/scriptengine.cpp index 75513042ee44fda93ff46a939e0617f282ac3b3f..413270bb67353f6f81b4b01dd898837572559d8c 100644 --- a/src/plugins/debugger/scriptengine.cpp +++ b/src/plugins/debugger/scriptengine.cpp @@ -69,6 +69,7 @@ using namespace Debugger::Constants; #else # define SDEBUG(s) #endif +# define XSDEBUG(s) qDebug() << s /////////////////////////////////////////////////////////////////////// // @@ -194,7 +195,7 @@ ScriptEngine::~ScriptEngine() void ScriptEngine::executeDebuggerCommand(const QString &command) { Q_UNUSED(command); - SDEBUG("FIXME: ScriptEngine::executeDebuggerCommand()"); + XSDEBUG("FIXME: ScriptEngine::executeDebuggerCommand()"); } void ScriptEngine::shutdown() @@ -247,40 +248,40 @@ void ScriptEngine::interruptInferior() { m_stopped = false; m_stopOnNextLine = true; - SDEBUG("FIXME: ScriptEngine::interruptInferior()"); + XSDEBUG("ScriptEngine::interruptInferior()"); } void ScriptEngine::stepExec() { - //SDEBUG("FIXME: ScriptEngine::stepExec()"); + //SDEBUG("ScriptEngine::stepExec()"); m_stopped = false; m_stopOnNextLine = true; } void ScriptEngine::stepIExec() { - //SDEBUG("FIXME: ScriptEngine::stepIExec()"); + //SDEBUG("ScriptEngine::stepIExec()"); m_stopped = false; m_stopOnNextLine = true; } void ScriptEngine::stepOutExec() { - //SDEBUG("FIXME: ScriptEngine::stepOutExec()"); + //SDEBUG("ScriptEngine::stepOutExec()"); m_stopped = false; m_stopOnNextLine = true; } void ScriptEngine::nextExec() { - //SDEBUG("FIXME: ScriptEngine::nextExec()"); + //SDEBUG("ScriptEngine::nextExec()"); m_stopped = false; m_stopOnNextLine = true; } void ScriptEngine::nextIExec() { - //SDEBUG("FIXME: ScriptEngine::nextIExec()"); + //SDEBUG("ScriptEngine::nextIExec()"); m_stopped = false; m_stopOnNextLine = true; } @@ -295,14 +296,14 @@ void ScriptEngine::runToLineExec(const QString &fileName, int lineNumber) void ScriptEngine::runToFunctionExec(const QString &functionName) { Q_UNUSED(functionName); - SDEBUG("FIXME: ScriptEngine::runToFunctionExec()"); + XSDEBUG("FIXME: ScriptEngine::runToFunctionExec()"); } void ScriptEngine::jumpToLineExec(const QString &fileName, int lineNumber) { Q_UNUSED(fileName); Q_UNUSED(lineNumber); - SDEBUG("FIXME: ScriptEngine::jumpToLineExec()"); + XSDEBUG("FIXME: ScriptEngine::jumpToLineExec()"); } void ScriptEngine::activateFrame(int index) @@ -468,8 +469,9 @@ void ScriptEngine::setToolTipExpression(const QPoint &pos, const QString &exp0) void ScriptEngine::assignValueInDebugger(const QString &expression, const QString &value) { - Q_UNUSED(expression); - Q_UNUSED(value); + XSDEBUG("ASSIGNING: " << expression + '=' + value); + m_scriptEngine->evaluate(expression + '=' + value); + updateLocals(); } void ScriptEngine::maybeBreakNow(bool byFunction) @@ -521,7 +523,12 @@ void ScriptEngine::maybeBreakNow(bool byFunction) qq->notifyInferiorStopped(); q->gotoLocation(fileName, lineNumber, true); + updateLocals(); +} +void ScriptEngine::updateLocals() +{ + QScriptContext *context = m_scriptEngine->currentContext(); qq->watchHandler()->reinitializeWatchers(); //SDEBUG("UPDATE LOCALS"); @@ -647,6 +654,7 @@ void ScriptEngine::updateSubItem(const WatchData &data0) it.next(); WatchData data1; data1.iname = data.iname + "." + it.name(); + data1.exp = it.name(); data1.name = it.name(); data1.scriptValue = it.value(); if (qq->watchHandler()->isExpandedIName(data1.iname)) diff --git a/src/plugins/debugger/scriptengine.h b/src/plugins/debugger/scriptengine.h index 33e102e750f7dbe1049a82a58f77ee24b9da270b..5e009327da7f63054ac4a551177cc59157385560 100644 --- a/src/plugins/debugger/scriptengine.h +++ b/src/plugins/debugger/scriptengine.h @@ -110,6 +110,7 @@ private: bool supportsThreads() const { return true; } void maybeBreakNow(bool byFunction); void updateWatchModel(); + void updateLocals(); void updateSubItem(const WatchData &data0); private: diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 76d27768e19acad7f750ae8f60095593e2f0fcc8..b618b98c55df4d6437addae36b7fb9433c30d7ae 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -493,6 +493,14 @@ QVariant WatchHandler::data(const QModelIndex &idx, int role) const return QVariant(); } +bool WatchHandler::setData(const QModelIndex &index, const QVariant &value, int role) +{ + Q_UNUSED(role); + Q_UNUSED(value); + emit dataChanged(index, index); + return true; +} + Qt::ItemFlags WatchHandler::flags(const QModelIndex &idx) const { using namespace Qt; diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index ba6bb64dd1b646c32d1b618331d622523ea16bd7..3f773ac1df37923c8ea6f525654d88d98b9fb4c9 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -149,6 +149,7 @@ public: // QAbstractItemModel // QVariant data(const QModelIndex &index, int role) const; + bool setData(const QModelIndex &index, const QVariant &value, int role); QModelIndex index(int, int, const QModelIndex &idx) const; QModelIndex parent(const QModelIndex &idx) const; int rowCount(const QModelIndex &idx) const; diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index 77f09f792080420df0283325c47a25ce5a6282f4..a4d65d6280b207539e5c9cd02a5a982c3e2a6263 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -64,6 +64,7 @@ public: QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const { + qDebug() << "CREATE EDITOR"; return new QLineEdit(parent); } @@ -77,13 +78,15 @@ public: lineEdit->setText(index.model()->data(index, ExpressionRole).toString()); } - void setModelData(QWidget *editor, QAbstractItemModel *, + void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { + //qDebug() << "SET MODEL DATA"; QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor); QTC_ASSERT(lineEdit, return); QString value = lineEdit->text(); - QString exp = index.model()->data(index, ExpressionRole).toString(); + QString exp = model->data(index, ExpressionRole).toString(); + model->setData(index, value, Qt::EditRole); if (index.column() == 1) { // the value column theDebuggerAction(AssignValue)->trigger(exp + '=' + value); @@ -147,7 +150,9 @@ void WatchWindow::keyPressEvent(QKeyEvent *ev) QModelIndex idx1 = idx.sibling(idx.row(), 0); QString exp = model()->data(idx1).toString(); theDebuggerAction(RemoveWatchExpression)->trigger(exp); - } else if (ev->key() == Qt::Key_Return && m_type == LocalsType) { + } else if (ev->key() == Qt::Key_Return + && ev->modifiers() == Qt::ControlModifier + && m_type == LocalsType) { QModelIndex idx = currentIndex(); QModelIndex idx1 = idx.sibling(idx.row(), 0); QString exp = model()->data(idx1).toString(); @@ -264,4 +269,3 @@ void WatchWindow::resetHelper(const QModelIndex &idx) collapse(idx); } } - diff --git a/tests/manual/gdbdebugger/script/math.js b/tests/manual/gdbdebugger/script/math.js index 65adac96c68324de4df5981c0a644595f8a30ecf..240a0f078d502c399852a23ce35e360ab5ef687b 100644 --- a/tests/manual/gdbdebugger/script/math.js +++ b/tests/manual/gdbdebugger/script/math.js @@ -29,7 +29,8 @@ function cube(a) { - return a * a * a; + var x = a * a * a; + return x; } var a = cube(3);