From: hjk Date: Thu, 26 May 2011 14:35:36 +0000 (+0200) Subject: debugger: introduce a parameter struct for updateLocal X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=de929e825d4350bde2aed817e80aeabb44e7b73e;p=qt-creator-jp%2Fqt-creator-jp.git debugger: introduce a parameter struct for updateLocal Change-Id: I05ecc935e1b6cf9483f23624f18e4dc5b9f295f3 Reviewed-on: http://codereview.qt.nokia.com/178 Reviewed-by: hjk --- diff --git a/share/qtcreator/gdbmacros/dumper.py b/share/qtcreator/gdbmacros/dumper.py index 56f2bc589b..98348da093 100644 --- a/share/qtcreator/gdbmacros/dumper.py +++ b/share/qtcreator/gdbmacros/dumper.py @@ -1233,6 +1233,8 @@ class Dumper: self.passExceptions = "pe" in options self.autoDerefPointers = "autoderef" in options self.partialUpdate = "partial" in options + self.tooltipOnly = "tooltiponly" in options + self.noLocals = "nolocals" in options self.ns = qtNamespace() self.alienSource = False #try: @@ -1244,6 +1246,8 @@ class Dumper: #warn("VARIABLES: %s" % varList) #warn("EXPANDED INAMES: %s" % self.expandedINames) #warn("WATCHERS: %s" % watchers) + #warn("PARTIAL: %s" % self.partialUpdate) + #warn("NO LOCALS: %s" % self.noLocals) module = sys.modules[__name__] # @@ -1268,10 +1272,9 @@ class Dumper: pass varList = [] - if fullUpdateNeeded: + locals = [] + if fullUpdateNeeded and not self.tooltipOnly and not self.noLocals: locals = listOfLocals(varList) - if "nolocals" in options: - locals = [] # Take care of the return value of the last function call. if len(resultVarName) > 0: diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index ee26f799d6..8cfe9711d4 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -3628,7 +3628,11 @@ bool GdbEngine::setToolTipExpression(const QPoint &mousePos, qDebug() << "GdbEngine::setToolTipExpression2 " << exp << (*m_toolTipContext); if (isSynchronous()) { - updateLocalsPython(true, tooltipIName(exp)); + UpdateParameters params; + params.tryPartial = true; + params.tooltipOnly = true; + params.varList = tooltipIName(exp); + updateLocalsPython(params); } else { WatchData toolTip; toolTip.exp = exp.toLatin1(); @@ -3709,12 +3713,15 @@ void GdbEngine::updateWatchData(const WatchData &data, const WatchUpdateFlags &f // << (m_pendingWatchRequests == 0) // << (m_pendingBreakpointRequests == 0); - bool tryPartial = flags.tryIncremental + UpdateParameters params; + params.tryPartial = flags.tryIncremental && hasPython() && m_pendingWatchRequests == 0 && m_pendingBreakpointRequests == 0; + params.tooltipOnly = false; + params.varList = data.iname; - updateLocalsPython(tryPartial, data.iname); + updateLocalsPython(params); #endif } else { // Bump requests to avoid model rebuilding during the nested @@ -3845,7 +3852,7 @@ void GdbEngine::handleDebuggingHelperSetup(const GdbResponse &response) void GdbEngine::updateLocals() { if (hasPython()) - updateLocalsPython(false, QByteArray()); + updateLocalsPython(UpdateParameters()); else updateLocalsClassic(); } diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 6e4666f845..adfb16845e 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -80,6 +80,16 @@ enum DebuggingHelperState }; +class UpdateParameters +{ +public: + UpdateParameters() { tryPartial = tooltipOnly = false; } + + bool tryPartial; + bool tooltipOnly; + QByteArray varList; +}; + /* This is only used with Mac gdb since 2.2 * * "Custom dumper" is a library compiled against the current @@ -646,7 +656,7 @@ private: ////////// View & Data Stuff ////////// void updateLocals(); void updateLocalsClassic(); - void updateLocalsPython(bool tryPartial, const QByteArray &varList); + void updateLocalsPython(const UpdateParameters ¶meters); void handleStackFramePython(const GdbResponse &response); void handleStackListLocalsClassic(const GdbResponse &response); diff --git a/src/plugins/debugger/gdb/pythongdbengine.cpp b/src/plugins/debugger/gdb/pythongdbengine.cpp index 99273e840d..f6826a0b3b 100644 --- a/src/plugins/debugger/gdb/pythongdbengine.cpp +++ b/src/plugins/debugger/gdb/pythongdbengine.cpp @@ -51,14 +51,14 @@ namespace Debugger { namespace Internal { -void GdbEngine::updateLocalsPython(bool tryPartial, const QByteArray &varList) +void GdbEngine::updateLocalsPython(const UpdateParameters ¶ms) { PRECONDITION; m_pendingWatchRequests = 0; m_pendingBreakpointRequests = 0; m_processedNames.clear(); WatchHandler *handler = watchHandler(); - handler->beginCycle(!tryPartial); + handler->beginCycle(!params.tryPartial); QByteArray expanded = "expanded:" + handler->expansionRequests() + ' '; expanded += "typeformats:" + handler->typeFormatRequests() + ' '; @@ -100,17 +100,19 @@ void GdbEngine::updateLocalsPython(bool tryPartial, const QByteArray &varList) options += "pe,"; if (options.isEmpty()) options += "defaults,"; - if (tryPartial) + if (params.tryPartial) options += "partial,"; + if (params.tooltipOnly) + options += "tooltiponly,"; options.chop(1); QByteArray resultVar; if (!m_resultVarName.isEmpty()) resultVar = "resultvarname:" + m_resultVarName + ' '; - postCommand("bb options:" + options + " vars:" + varList + ' ' + postCommand("bb options:" + options + " vars:" + params.varList + ' ' + resultVar + expanded + " watchers:" + watchers.toHex(), - WatchUpdate, CB(handleStackFramePython), QVariant(tryPartial)); + WatchUpdate, CB(handleStackFramePython), QVariant(params.tryPartial)); } void GdbEngine::handleStackListLocalsPython(const GdbResponse &response) @@ -123,7 +125,8 @@ void GdbEngine::handleStackListLocalsPython(const GdbResponse &response) varList.append(','); varList.append(child.data()); } - updateLocalsPython(false, varList); + UpdateParameters params; + updateLocalsPython(params); } }