forked from qt-creator/qt-creator
debugger: only update variables that are operated on
This commit is contained in:
@@ -1047,6 +1047,7 @@ class Dumper:
|
||||
self.useFancy = "fancy" in options
|
||||
self.passExceptions = "pe" in options
|
||||
self.autoDerefPointers = "autoderef" in options
|
||||
self.partialUpdate = "partial" in options
|
||||
#self.ns = qqNs
|
||||
self.ns = qtNamespace()
|
||||
|
||||
@@ -1059,6 +1060,26 @@ class Dumper:
|
||||
#
|
||||
# Locals
|
||||
#
|
||||
fullUpdateNeeded = True
|
||||
if self.partialUpdate and len(varList) == 1:
|
||||
#warn("PARTIAL: %s" % varList)
|
||||
parts = varList[0].split('.')
|
||||
#warn("PARTIAL PARTS: %s" % parts)
|
||||
name = parts[1]
|
||||
#warn("PARTIAL VAR: %s" % name)
|
||||
#fullUpdateNeeded = False
|
||||
try:
|
||||
frame = gdb.selected_frame()
|
||||
item = Item(0, "local", name, name)
|
||||
item.value = frame.read_var(name)
|
||||
locals = [item]
|
||||
#warn("PARTIAL LOCALS: %s" % locals)
|
||||
fullUpdateNeeded = False
|
||||
except:
|
||||
pass
|
||||
varList = []
|
||||
|
||||
if fullUpdateNeeded:
|
||||
locals = listOfLocals(varList)
|
||||
if "nolocals" in options:
|
||||
locals = []
|
||||
|
||||
@@ -691,7 +691,7 @@ void CdbEngine::evaluateWatcher(WatchData *wd)
|
||||
wd->setHasChildren(false);
|
||||
}
|
||||
|
||||
void CdbEngine::updateWatchData(const WatchData &incomplete)
|
||||
void CdbEngine::updateWatchData(const WatchData &incomplete, const WatchUpdateFlags &flags)
|
||||
{
|
||||
// Watch item was edited while running
|
||||
if (m_d->isDebuggeeRunning())
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
virtual void shutdownInferior();
|
||||
virtual void shutdownEngine();
|
||||
virtual void detachDebugger();
|
||||
virtual void updateWatchData(const WatchData &data);
|
||||
virtual void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
|
||||
virtual unsigned debuggerCapabilities() const;
|
||||
|
||||
virtual void executeStep();
|
||||
|
||||
@@ -130,6 +130,12 @@ class WatchHandler;
|
||||
|
||||
class DebuggerEnginePrivate;
|
||||
|
||||
struct WatchUpdateFlags
|
||||
{
|
||||
WatchUpdateFlags() : tryIncremental(false) {}
|
||||
bool tryIncremental;
|
||||
};
|
||||
|
||||
// FIXME: DEBUGGER_EXPORT?
|
||||
class DEBUGGER_EXPORT DebuggerEngine : public QObject
|
||||
{
|
||||
@@ -143,7 +149,8 @@ public:
|
||||
TextEditor::ITextEditor * /* editor */, int /* cursorPos */) {}
|
||||
void initializeFromTemplate(DebuggerEngine *other);
|
||||
|
||||
virtual void updateWatchData(const WatchData & /* data */) { }
|
||||
virtual void updateWatchData(const WatchData & /* data */,
|
||||
const WatchUpdateFlags & /* flags */ = WatchUpdateFlags()) {}
|
||||
void startDebugger(DebuggerRunControl *runControl);
|
||||
virtual bool isSessionEngine() const { return false; }
|
||||
|
||||
|
||||
@@ -3328,7 +3328,7 @@ bool GdbEngine::hasDebuggingHelperForType(const QByteArray &type) const
|
||||
}
|
||||
|
||||
|
||||
void GdbEngine::updateWatchData(const WatchData &data)
|
||||
void GdbEngine::updateWatchData(const WatchData &data, const WatchUpdateFlags &flags)
|
||||
{
|
||||
if (isSynchronous()) {
|
||||
// This should only be called for fresh expanded items, not for
|
||||
@@ -3358,6 +3358,21 @@ void GdbEngine::updateWatchData(const WatchData &data)
|
||||
}
|
||||
m_processedNames.insert(processedName);
|
||||
|
||||
// FIXME: Is this sufficient when "external" changes are
|
||||
// triggered e.g. by manually entered command in the gdb console?
|
||||
//qDebug() << "TRY PARTIAL: " << flags.tryIncremental
|
||||
// << hasPython()
|
||||
// << (m_pendingWatchRequests == 0)
|
||||
// << (m_pendingBreakpointRequests == 0);
|
||||
|
||||
bool tryPartial = flags.tryIncremental
|
||||
&& hasPython()
|
||||
&& m_pendingWatchRequests == 0
|
||||
&& m_pendingBreakpointRequests == 0;
|
||||
|
||||
if (tryPartial)
|
||||
updateLocalsPython(true, data.iname);
|
||||
else
|
||||
updateLocals();
|
||||
#endif
|
||||
} else {
|
||||
@@ -3491,7 +3506,7 @@ void GdbEngine::updateLocals(const QVariant &cookie)
|
||||
m_pendingWatchRequests = 0;
|
||||
m_pendingBreakpointRequests = 0;
|
||||
if (hasPython())
|
||||
updateLocalsPython(QByteArray());
|
||||
updateLocalsPython(false, QByteArray());
|
||||
else
|
||||
updateLocalsClassic(cookie);
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ private: ////////// View & Data Stuff //////////
|
||||
// FIXME: BaseClass. called to improve situation for a watch item
|
||||
void updateSubItemClassic(const WatchData &data);
|
||||
|
||||
void virtual updateWatchData(const WatchData &data);
|
||||
void virtual updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
|
||||
Q_SLOT void updateWatchDataHelper(const WatchData &data);
|
||||
void rebuildWatchModel();
|
||||
bool showToolTip();
|
||||
@@ -492,7 +492,7 @@ private: ////////// View & Data Stuff //////////
|
||||
|
||||
void updateLocals(const QVariant &cookie = QVariant());
|
||||
void updateLocalsClassic(const QVariant &cookie);
|
||||
void updateLocalsPython(const QByteArray &varList);
|
||||
void updateLocalsPython(bool tryPartial, const QByteArray &varList);
|
||||
void handleStackFramePython(const GdbResponse &response);
|
||||
|
||||
void handleStackListLocalsClassic(const GdbResponse &response);
|
||||
|
||||
@@ -46,12 +46,11 @@
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
void GdbEngine::updateLocalsPython(const QByteArray &varList)
|
||||
void GdbEngine::updateLocalsPython(bool tryPartial, const QByteArray &varList)
|
||||
{
|
||||
PRECONDITION;
|
||||
m_processedNames.clear();
|
||||
|
||||
watchHandler()->beginCycle();
|
||||
watchHandler()->beginCycle(!tryPartial);
|
||||
//m_toolTipExpression.clear();
|
||||
WatchHandler *handler = watchHandler();
|
||||
|
||||
@@ -84,6 +83,8 @@ void GdbEngine::updateLocalsPython(const QByteArray &varList)
|
||||
options += "pe,";
|
||||
if (options.isEmpty())
|
||||
options += "defaults,";
|
||||
if (tryPartial)
|
||||
options += "partial,";
|
||||
options.chop(1);
|
||||
|
||||
QByteArray resultVar;
|
||||
@@ -92,7 +93,7 @@ void GdbEngine::updateLocalsPython(const QByteArray &varList)
|
||||
|
||||
postCommand("bb options:" + options + " vars:" + varList + ' '
|
||||
+ resultVar + expanded + " watchers:" + watchers.toHex(),
|
||||
WatchUpdate, CB(handleStackFramePython));
|
||||
WatchUpdate, CB(handleStackFramePython), QVariant(tryPartial));
|
||||
}
|
||||
|
||||
void GdbEngine::handleStackListLocalsPython(const GdbResponse &response)
|
||||
@@ -105,7 +106,7 @@ void GdbEngine::handleStackListLocalsPython(const GdbResponse &response)
|
||||
varList.append(',');
|
||||
varList.append(child.data());
|
||||
}
|
||||
updateLocalsPython(varList);
|
||||
updateLocalsPython(false, varList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +114,8 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
|
||||
{
|
||||
PRECONDITION;
|
||||
if (response.resultClass == GdbResultDone) {
|
||||
bool partial = response.cookie.toBool();
|
||||
//qDebug() << "READING " << (partial ? "PARTIAL" : "FULL");
|
||||
QByteArray out = response.data.findChild("consolestreamoutput").data();
|
||||
while (out.endsWith(' ') || out.endsWith('\n'))
|
||||
out.chop(1);
|
||||
|
||||
@@ -556,7 +556,7 @@ void PdbEngine::assignValueInDebugger(const QString &expression,
|
||||
}
|
||||
|
||||
|
||||
void PdbEngine::updateWatchData(const WatchData &data)
|
||||
void PdbEngine::updateWatchData(const WatchData &data, const WatchUpdateFlags &flags)
|
||||
{
|
||||
Q_UNUSED(data);
|
||||
updateAll();
|
||||
|
||||
@@ -103,7 +103,7 @@ private:
|
||||
|
||||
bool supportsThreads() const { return true; }
|
||||
bool isSynchronous() const { return true; }
|
||||
void updateWatchData(const WatchData &data);
|
||||
void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
|
||||
|
||||
signals:
|
||||
void outputReady(const QByteArray &data);
|
||||
|
||||
@@ -98,9 +98,9 @@ void QmlCppEngine::setToolTipExpression(const QPoint & mousePos,
|
||||
m_activeEngine->setToolTipExpression(mousePos, editor, cursorPos);
|
||||
}
|
||||
|
||||
void QmlCppEngine::updateWatchData(const WatchData &data)
|
||||
void QmlCppEngine::updateWatchData(const WatchData &data, const WatchUpdateFlags &flags)
|
||||
{
|
||||
m_activeEngine->updateWatchData(data);
|
||||
m_activeEngine->updateWatchData(data, flags);
|
||||
}
|
||||
|
||||
void QmlCppEngine::watchPoint(const QPoint &point)
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
virtual void setToolTipExpression(const QPoint & /* mousePos */,
|
||||
TextEditor::ITextEditor * /* editor */, int /* cursorPos */);
|
||||
virtual void updateWatchData(const WatchData & /* data */);
|
||||
virtual void updateWatchData(const WatchData & /* data */, const WatchUpdateFlags &flags);
|
||||
|
||||
virtual void watchPoint(const QPoint &);
|
||||
virtual void fetchMemory(MemoryViewAgent *, QObject *,
|
||||
|
||||
@@ -476,7 +476,7 @@ void QmlEngine::assignValueInDebugger(const QString &expression,
|
||||
}
|
||||
}
|
||||
|
||||
void QmlEngine::updateWatchData(const WatchData &data)
|
||||
void QmlEngine::updateWatchData(const WatchData &data, const WatchUpdateFlags &)
|
||||
{
|
||||
// qDebug() << "UPDATE WATCH DATA" << data.toString();
|
||||
//watchHandler()->rebuildModel();
|
||||
|
||||
@@ -117,7 +117,7 @@ private:
|
||||
void reloadFullStack() {}
|
||||
|
||||
bool supportsThreads() const { return false; }
|
||||
void updateWatchData(const WatchData &data);
|
||||
void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
|
||||
void executeDebuggerCommand(const QString& command);
|
||||
|
||||
unsigned int debuggerCapabilities() const;
|
||||
|
||||
@@ -721,7 +721,7 @@ void ScriptEngine::updateLocals()
|
||||
notifyInferiorRunOk();
|
||||
}
|
||||
|
||||
void ScriptEngine::updateWatchData(const WatchData &data)
|
||||
void ScriptEngine::updateWatchData(const WatchData &data, const WatchUpdateFlags &flags)
|
||||
{
|
||||
updateSubItem(data);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ private:
|
||||
|
||||
bool supportsThreads() const { return true; }
|
||||
bool checkForBreakCondition(bool byFunction);
|
||||
void updateWatchData(const WatchData &data);
|
||||
void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
|
||||
void updateLocals();
|
||||
void updateSubItem(const WatchData &data);
|
||||
|
||||
|
||||
@@ -554,7 +554,7 @@ void TcfEngine::updateLocals()
|
||||
{
|
||||
}
|
||||
|
||||
void TcfEngine::updateWatchData(const WatchData &)
|
||||
void TcfEngine::updateWatchData(const WatchData &, const WatchUpdateFlags &)
|
||||
{
|
||||
//qq->watchHandler()->rebuildModel();
|
||||
showStatusMessage(tr("Stopped."), 5000);
|
||||
|
||||
@@ -106,7 +106,7 @@ private:
|
||||
|
||||
bool supportsThreads() const { return true; }
|
||||
void maybeBreakNow(bool byFunction);
|
||||
void updateWatchData(const WatchData &data);
|
||||
void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
|
||||
void updateLocals();
|
||||
void updateSubItem(const WatchData &data);
|
||||
|
||||
|
||||
@@ -487,7 +487,9 @@ void WatchModel::fetchMore(const QModelIndex &index)
|
||||
if (item->children.isEmpty()) {
|
||||
WatchData data = *item;
|
||||
data.setChildrenNeeded();
|
||||
engine()->updateWatchData(data);
|
||||
WatchUpdateFlags flags;
|
||||
flags.tryIncremental = true;
|
||||
engine()->updateWatchData(data, flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1146,8 +1148,9 @@ WatchHandler::WatchHandler(DebuggerEngine *engine)
|
||||
SIGNAL(triggered()), this, SLOT(emitAllChanged()));
|
||||
}
|
||||
|
||||
void WatchHandler::beginCycle()
|
||||
void WatchHandler::beginCycle(bool fullCycle)
|
||||
{
|
||||
if (fullCycle)
|
||||
++generationCounter;
|
||||
m_return->beginCycle();
|
||||
m_locals->beginCycle();
|
||||
@@ -1155,7 +1158,7 @@ void WatchHandler::beginCycle()
|
||||
m_tooltips->beginCycle();
|
||||
}
|
||||
|
||||
void WatchHandler::endCycle()
|
||||
void WatchHandler::endCycle(bool /*fullCycle*/)
|
||||
{
|
||||
m_return->endCycle();
|
||||
m_locals->endCycle();
|
||||
|
||||
@@ -143,9 +143,9 @@ public:
|
||||
void removeWatchExpression(const QString &exp);
|
||||
Q_SLOT void emitAllChanged();
|
||||
|
||||
void beginCycle(); // Called at begin of updateLocals() cycle
|
||||
void beginCycle(bool fullCycle = true); // Called at begin of updateLocals() cycle
|
||||
void updateWatchers(); // Called after locals are fetched
|
||||
void endCycle(); // Called after all results have been received
|
||||
void endCycle(bool fullCycle = true); // Called after all results have been received
|
||||
void showEditValue(const WatchData &data);
|
||||
|
||||
void insertData(const WatchData &data);
|
||||
|
||||
@@ -793,6 +793,7 @@ public:
|
||||
void testQObject(int &argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
QString longString = QString(10000, QLatin1Char('A'));
|
||||
#if 1
|
||||
Names::Bar::TestObject test;
|
||||
test.setMyProp1("HELLO");
|
||||
|
||||
Reference in New Issue
Block a user