OSDN Git Service

debugger: introduce a parameter struct for updateLocal
authorhjk <qtc-committer@nokia.com>
Thu, 26 May 2011 14:35:36 +0000 (16:35 +0200)
committerhjk <qthjk@ovi.com>
Fri, 27 May 2011 09:23:08 +0000 (11:23 +0200)
Change-Id: I05ecc935e1b6cf9483f23624f18e4dc5b9f295f3
Reviewed-on: http://codereview.qt.nokia.com/178
Reviewed-by: hjk <qthjk@ovi.com>
share/qtcreator/gdbmacros/dumper.py
src/plugins/debugger/gdb/gdbengine.cpp
src/plugins/debugger/gdb/gdbengine.h
src/plugins/debugger/gdb/pythongdbengine.cpp

index 56f2bc5..98348da 100644 (file)
@@ -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:
index ee26f79..8cfe971 100644 (file)
@@ -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();
 }
index 6e4666f..adfb168 100644 (file)
@@ -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 &parameters);
             void handleStackFramePython(const GdbResponse &response);
 
     void handleStackListLocalsClassic(const GdbResponse &response);
index 99273e8..f6826a0 100644 (file)
 namespace Debugger {
 namespace Internal {
 
-void GdbEngine::updateLocalsPython(bool tryPartial, const QByteArray &varList)
+void GdbEngine::updateLocalsPython(const UpdateParameters &params)
 {
     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);
     }
 }