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.useFancy = "fancy" in options
|
||||||
self.passExceptions = "pe" in options
|
self.passExceptions = "pe" in options
|
||||||
self.autoDerefPointers = "autoderef" in options
|
self.autoDerefPointers = "autoderef" in options
|
||||||
|
self.partialUpdate = "partial" in options
|
||||||
#self.ns = qqNs
|
#self.ns = qqNs
|
||||||
self.ns = qtNamespace()
|
self.ns = qtNamespace()
|
||||||
|
|
||||||
@@ -1059,6 +1060,26 @@ class Dumper:
|
|||||||
#
|
#
|
||||||
# Locals
|
# 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)
|
locals = listOfLocals(varList)
|
||||||
if "nolocals" in options:
|
if "nolocals" in options:
|
||||||
locals = []
|
locals = []
|
||||||
|
|||||||
@@ -691,7 +691,7 @@ void CdbEngine::evaluateWatcher(WatchData *wd)
|
|||||||
wd->setHasChildren(false);
|
wd->setHasChildren(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::updateWatchData(const WatchData &incomplete)
|
void CdbEngine::updateWatchData(const WatchData &incomplete, const WatchUpdateFlags &flags)
|
||||||
{
|
{
|
||||||
// Watch item was edited while running
|
// Watch item was edited while running
|
||||||
if (m_d->isDebuggeeRunning())
|
if (m_d->isDebuggeeRunning())
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
virtual void shutdownInferior();
|
virtual void shutdownInferior();
|
||||||
virtual void shutdownEngine();
|
virtual void shutdownEngine();
|
||||||
virtual void detachDebugger();
|
virtual void detachDebugger();
|
||||||
virtual void updateWatchData(const WatchData &data);
|
virtual void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
|
||||||
virtual unsigned debuggerCapabilities() const;
|
virtual unsigned debuggerCapabilities() const;
|
||||||
|
|
||||||
virtual void executeStep();
|
virtual void executeStep();
|
||||||
|
|||||||
@@ -130,6 +130,12 @@ class WatchHandler;
|
|||||||
|
|
||||||
class DebuggerEnginePrivate;
|
class DebuggerEnginePrivate;
|
||||||
|
|
||||||
|
struct WatchUpdateFlags
|
||||||
|
{
|
||||||
|
WatchUpdateFlags() : tryIncremental(false) {}
|
||||||
|
bool tryIncremental;
|
||||||
|
};
|
||||||
|
|
||||||
// FIXME: DEBUGGER_EXPORT?
|
// FIXME: DEBUGGER_EXPORT?
|
||||||
class DEBUGGER_EXPORT DebuggerEngine : public QObject
|
class DEBUGGER_EXPORT DebuggerEngine : public QObject
|
||||||
{
|
{
|
||||||
@@ -140,10 +146,11 @@ public:
|
|||||||
virtual ~DebuggerEngine();
|
virtual ~DebuggerEngine();
|
||||||
|
|
||||||
virtual void setToolTipExpression(const QPoint & /* mousePos */,
|
virtual void setToolTipExpression(const QPoint & /* mousePos */,
|
||||||
TextEditor::ITextEditor * /* editor */, int /* cursorPos */) { }
|
TextEditor::ITextEditor * /* editor */, int /* cursorPos */) {}
|
||||||
void initializeFromTemplate(DebuggerEngine *other);
|
void initializeFromTemplate(DebuggerEngine *other);
|
||||||
|
|
||||||
virtual void updateWatchData(const WatchData & /* data */) { }
|
virtual void updateWatchData(const WatchData & /* data */,
|
||||||
|
const WatchUpdateFlags & /* flags */ = WatchUpdateFlags()) {}
|
||||||
void startDebugger(DebuggerRunControl *runControl);
|
void startDebugger(DebuggerRunControl *runControl);
|
||||||
virtual bool isSessionEngine() const { return false; }
|
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()) {
|
if (isSynchronous()) {
|
||||||
// This should only be called for fresh expanded items, not for
|
// 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);
|
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();
|
updateLocals();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
@@ -3491,7 +3506,7 @@ void GdbEngine::updateLocals(const QVariant &cookie)
|
|||||||
m_pendingWatchRequests = 0;
|
m_pendingWatchRequests = 0;
|
||||||
m_pendingBreakpointRequests = 0;
|
m_pendingBreakpointRequests = 0;
|
||||||
if (hasPython())
|
if (hasPython())
|
||||||
updateLocalsPython(QByteArray());
|
updateLocalsPython(false, QByteArray());
|
||||||
else
|
else
|
||||||
updateLocalsClassic(cookie);
|
updateLocalsClassic(cookie);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -460,7 +460,7 @@ private: ////////// View & Data Stuff //////////
|
|||||||
// FIXME: BaseClass. called to improve situation for a watch item
|
// FIXME: BaseClass. called to improve situation for a watch item
|
||||||
void updateSubItemClassic(const WatchData &data);
|
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);
|
Q_SLOT void updateWatchDataHelper(const WatchData &data);
|
||||||
void rebuildWatchModel();
|
void rebuildWatchModel();
|
||||||
bool showToolTip();
|
bool showToolTip();
|
||||||
@@ -492,7 +492,7 @@ private: ////////// View & Data Stuff //////////
|
|||||||
|
|
||||||
void updateLocals(const QVariant &cookie = QVariant());
|
void updateLocals(const QVariant &cookie = QVariant());
|
||||||
void updateLocalsClassic(const QVariant &cookie);
|
void updateLocalsClassic(const QVariant &cookie);
|
||||||
void updateLocalsPython(const QByteArray &varList);
|
void updateLocalsPython(bool tryPartial, const QByteArray &varList);
|
||||||
void handleStackFramePython(const GdbResponse &response);
|
void handleStackFramePython(const GdbResponse &response);
|
||||||
|
|
||||||
void handleStackListLocalsClassic(const GdbResponse &response);
|
void handleStackListLocalsClassic(const GdbResponse &response);
|
||||||
|
|||||||
@@ -46,12 +46,11 @@
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
void GdbEngine::updateLocalsPython(const QByteArray &varList)
|
void GdbEngine::updateLocalsPython(bool tryPartial, const QByteArray &varList)
|
||||||
{
|
{
|
||||||
PRECONDITION;
|
PRECONDITION;
|
||||||
m_processedNames.clear();
|
m_processedNames.clear();
|
||||||
|
watchHandler()->beginCycle(!tryPartial);
|
||||||
watchHandler()->beginCycle();
|
|
||||||
//m_toolTipExpression.clear();
|
//m_toolTipExpression.clear();
|
||||||
WatchHandler *handler = watchHandler();
|
WatchHandler *handler = watchHandler();
|
||||||
|
|
||||||
@@ -84,6 +83,8 @@ void GdbEngine::updateLocalsPython(const QByteArray &varList)
|
|||||||
options += "pe,";
|
options += "pe,";
|
||||||
if (options.isEmpty())
|
if (options.isEmpty())
|
||||||
options += "defaults,";
|
options += "defaults,";
|
||||||
|
if (tryPartial)
|
||||||
|
options += "partial,";
|
||||||
options.chop(1);
|
options.chop(1);
|
||||||
|
|
||||||
QByteArray resultVar;
|
QByteArray resultVar;
|
||||||
@@ -92,7 +93,7 @@ void GdbEngine::updateLocalsPython(const QByteArray &varList)
|
|||||||
|
|
||||||
postCommand("bb options:" + options + " vars:" + varList + ' '
|
postCommand("bb options:" + options + " vars:" + varList + ' '
|
||||||
+ resultVar + expanded + " watchers:" + watchers.toHex(),
|
+ resultVar + expanded + " watchers:" + watchers.toHex(),
|
||||||
WatchUpdate, CB(handleStackFramePython));
|
WatchUpdate, CB(handleStackFramePython), QVariant(tryPartial));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleStackListLocalsPython(const GdbResponse &response)
|
void GdbEngine::handleStackListLocalsPython(const GdbResponse &response)
|
||||||
@@ -105,7 +106,7 @@ void GdbEngine::handleStackListLocalsPython(const GdbResponse &response)
|
|||||||
varList.append(',');
|
varList.append(',');
|
||||||
varList.append(child.data());
|
varList.append(child.data());
|
||||||
}
|
}
|
||||||
updateLocalsPython(varList);
|
updateLocalsPython(false, varList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,6 +114,8 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
|
|||||||
{
|
{
|
||||||
PRECONDITION;
|
PRECONDITION;
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
|
bool partial = response.cookie.toBool();
|
||||||
|
//qDebug() << "READING " << (partial ? "PARTIAL" : "FULL");
|
||||||
QByteArray out = response.data.findChild("consolestreamoutput").data();
|
QByteArray out = response.data.findChild("consolestreamoutput").data();
|
||||||
while (out.endsWith(' ') || out.endsWith('\n'))
|
while (out.endsWith(' ') || out.endsWith('\n'))
|
||||||
out.chop(1);
|
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);
|
Q_UNUSED(data);
|
||||||
updateAll();
|
updateAll();
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ private:
|
|||||||
|
|
||||||
bool supportsThreads() const { return true; }
|
bool supportsThreads() const { return true; }
|
||||||
bool isSynchronous() const { return true; }
|
bool isSynchronous() const { return true; }
|
||||||
void updateWatchData(const WatchData &data);
|
void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void outputReady(const QByteArray &data);
|
void outputReady(const QByteArray &data);
|
||||||
|
|||||||
@@ -98,9 +98,9 @@ void QmlCppEngine::setToolTipExpression(const QPoint & mousePos,
|
|||||||
m_activeEngine->setToolTipExpression(mousePos, editor, cursorPos);
|
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)
|
void QmlCppEngine::watchPoint(const QPoint &point)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
|
|
||||||
virtual void setToolTipExpression(const QPoint & /* mousePos */,
|
virtual void setToolTipExpression(const QPoint & /* mousePos */,
|
||||||
TextEditor::ITextEditor * /* editor */, int /* cursorPos */);
|
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 watchPoint(const QPoint &);
|
||||||
virtual void fetchMemory(MemoryViewAgent *, QObject *,
|
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();
|
// qDebug() << "UPDATE WATCH DATA" << data.toString();
|
||||||
//watchHandler()->rebuildModel();
|
//watchHandler()->rebuildModel();
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ private:
|
|||||||
void reloadFullStack() {}
|
void reloadFullStack() {}
|
||||||
|
|
||||||
bool supportsThreads() const { return false; }
|
bool supportsThreads() const { return false; }
|
||||||
void updateWatchData(const WatchData &data);
|
void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
|
||||||
void executeDebuggerCommand(const QString& command);
|
void executeDebuggerCommand(const QString& command);
|
||||||
|
|
||||||
unsigned int debuggerCapabilities() const;
|
unsigned int debuggerCapabilities() const;
|
||||||
|
|||||||
@@ -721,7 +721,7 @@ void ScriptEngine::updateLocals()
|
|||||||
notifyInferiorRunOk();
|
notifyInferiorRunOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEngine::updateWatchData(const WatchData &data)
|
void ScriptEngine::updateWatchData(const WatchData &data, const WatchUpdateFlags &flags)
|
||||||
{
|
{
|
||||||
updateSubItem(data);
|
updateSubItem(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ private:
|
|||||||
|
|
||||||
bool supportsThreads() const { return true; }
|
bool supportsThreads() const { return true; }
|
||||||
bool checkForBreakCondition(bool byFunction);
|
bool checkForBreakCondition(bool byFunction);
|
||||||
void updateWatchData(const WatchData &data);
|
void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
|
||||||
void updateLocals();
|
void updateLocals();
|
||||||
void updateSubItem(const WatchData &data);
|
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();
|
//qq->watchHandler()->rebuildModel();
|
||||||
showStatusMessage(tr("Stopped."), 5000);
|
showStatusMessage(tr("Stopped."), 5000);
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ private:
|
|||||||
|
|
||||||
bool supportsThreads() const { return true; }
|
bool supportsThreads() const { return true; }
|
||||||
void maybeBreakNow(bool byFunction);
|
void maybeBreakNow(bool byFunction);
|
||||||
void updateWatchData(const WatchData &data);
|
void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
|
||||||
void updateLocals();
|
void updateLocals();
|
||||||
void updateSubItem(const WatchData &data);
|
void updateSubItem(const WatchData &data);
|
||||||
|
|
||||||
|
|||||||
@@ -487,7 +487,9 @@ void WatchModel::fetchMore(const QModelIndex &index)
|
|||||||
if (item->children.isEmpty()) {
|
if (item->children.isEmpty()) {
|
||||||
WatchData data = *item;
|
WatchData data = *item;
|
||||||
data.setChildrenNeeded();
|
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()));
|
SIGNAL(triggered()), this, SLOT(emitAllChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::beginCycle()
|
void WatchHandler::beginCycle(bool fullCycle)
|
||||||
{
|
{
|
||||||
|
if (fullCycle)
|
||||||
++generationCounter;
|
++generationCounter;
|
||||||
m_return->beginCycle();
|
m_return->beginCycle();
|
||||||
m_locals->beginCycle();
|
m_locals->beginCycle();
|
||||||
@@ -1155,7 +1158,7 @@ void WatchHandler::beginCycle()
|
|||||||
m_tooltips->beginCycle();
|
m_tooltips->beginCycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::endCycle()
|
void WatchHandler::endCycle(bool /*fullCycle*/)
|
||||||
{
|
{
|
||||||
m_return->endCycle();
|
m_return->endCycle();
|
||||||
m_locals->endCycle();
|
m_locals->endCycle();
|
||||||
|
|||||||
@@ -143,9 +143,9 @@ public:
|
|||||||
void removeWatchExpression(const QString &exp);
|
void removeWatchExpression(const QString &exp);
|
||||||
Q_SLOT void emitAllChanged();
|
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 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 showEditValue(const WatchData &data);
|
||||||
|
|
||||||
void insertData(const WatchData &data);
|
void insertData(const WatchData &data);
|
||||||
|
|||||||
@@ -793,6 +793,7 @@ public:
|
|||||||
void testQObject(int &argc, char *argv[])
|
void testQObject(int &argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
QString longString = QString(10000, QLatin1Char('A'));
|
||||||
#if 1
|
#if 1
|
||||||
Names::Bar::TestObject test;
|
Names::Bar::TestObject test;
|
||||||
test.setMyProp1("HELLO");
|
test.setMyProp1("HELLO");
|
||||||
|
|||||||
Reference in New Issue
Block a user