diff --git a/share/qtcreator/gdbmacros/dumper.py b/share/qtcreator/gdbmacros/dumper.py index f7000863f30..d3efe526608 100644 --- a/share/qtcreator/gdbmacros/dumper.py +++ b/share/qtcreator/gdbmacros/dumper.py @@ -53,21 +53,26 @@ verbosity = 1 # Encodings Unencoded8Bit, \ - Base64Encoded8BitWithQuotes, \ - Base64Encoded16BitWithQuotes, \ - Base64Encoded32BitWithQuotes, \ - Base64Encoded16Bit, \ - Base64Encoded8Bit, \ - Hex2EncodedLatin1, \ - Hex4EncodedLittleEndian, \ - Hex8EncodedLittleEndian, \ - Hex2EncodedUtf8, \ - Hex8EncodedBigEndian, \ - Hex4EncodedBigEndian \ - = range(12) +Base64Encoded8BitWithQuotes, \ +Base64Encoded16BitWithQuotes, \ +Base64Encoded32BitWithQuotes, \ +Base64Encoded16Bit, \ +Base64Encoded8Bit, \ +Hex2EncodedLatin1, \ +Hex4EncodedLittleEndian, \ +Hex8EncodedLittleEndian, \ +Hex2EncodedUtf8, \ +Hex8EncodedBigEndian, \ +Hex4EncodedBigEndian \ + = range(12) # Display modes -StopDisplay, DisplayImage1, DisplayString, DisplayImage, DisplayProcess = range(5) +StopDisplay, \ +DisplayImage1, \ +DisplayString, \ +DisplayImage, \ +DisplayProcess \ + = range(5) def select(condition, if_expr, else_expr): @@ -180,25 +185,28 @@ class SubItem: self.savedType = self.d.currentType self.savedTypePriority = self.d.currentTypePriority self.d.currentValue = "" - self.d.currentValuePriority = 0 + self.d.currentValuePriority = -100 self.d.currentValueEncoding = None self.d.currentType = "" - self.d.currentTypePriority = 0 + self.d.currentTypePriority = -100 def __exit__(self, exType, exValue, exTraceBack): #warn(" CURRENT VALUE: %s %s %s" % (self.d.currentValue, # self.d.currentValueEncoding, self.d.currentValuePriority)) if self.d.passExceptions and not exType is None: showException("SUBITEM", exType, exValue, exTraceBack) - if not self.d.currentValueEncoding is None: - self.d.putField("valueencoded", self.d.currentValueEncoding) - if not self.d.currentValue is None: - self.d.putField("value", self.d.currentValue) - #warn("TYPE CURRENT: %s" % self.d.currentType) - type = stripClassTag(str(self.d.currentType)) - #warn("TYPE: '%s' DEFAULT: '%s'" % (type, self.d.currentChildType)) - if len(type) > 0 and type != self.d.currentChildType: - self.d.put('type="%s",' % type) # str(type.unqualified()) ? + try: + #warn("TYPE CURRENT: %s" % self.d.currentType) + type = stripClassTag(str(self.d.currentType)) + #warn("TYPE: '%s' DEFAULT: '%s'" % (type, self.d.currentChildType)) + if len(type) > 0 and type != self.d.currentChildType: + self.d.put('type="%s",' % type) # str(type.unqualified()) ? + if not self.d.currentValueEncoding is None: + self.d.putField("valueencoded", self.d.currentValueEncoding) + if not self.d.currentValue is None: + self.d.putField("value", self.d.currentValue) + except: + pass self.d.put('},') self.d.currentValue = self.savedValue self.d.currentValuePriority = self.savedValuePriority @@ -1047,8 +1055,8 @@ class Dumper: def putPointerValue(self, value): # Use a lower priority - self.putField("value2", "0x%x" % value.dereference().cast( - gdb.lookup_type("unsigned long"))) + self.putValue("0x%x" % value.dereference().cast( + gdb.lookup_type("unsigned long")), None, -1) def putStringValue(self, value): if value is None: diff --git a/src/plugins/debugger/gdb/classicgdbengine.cpp b/src/plugins/debugger/gdb/classicgdbengine.cpp index 62f2f400f93..9baabf0923e 100644 --- a/src/plugins/debugger/gdb/classicgdbengine.cpp +++ b/src/plugins/debugger/gdb/classicgdbengine.cpp @@ -754,7 +754,7 @@ void GdbEngine::handleVarListChildrenHelperClassic(const GdbMi &item, data.iname = parent.iname + '.' + data.name.toLatin1(); data.variable = name; setWatchDataType(data, item.findChild("type")); - setWatchDataValue(data, item.findChild("value")); + setWatchDataValue(data, item); setWatchDataAddress(data, item.findChild("addr")); data.setHasChildren(false); insertData(data); @@ -777,7 +777,7 @@ void GdbEngine::handleVarListChildrenHelperClassic(const GdbMi &item, data.iname = parent.iname + '.' + exp; data.variable = name; setWatchDataType(data, item.findChild("type")); - setWatchDataValue(data, item.findChild("value")); + setWatchDataValue(data, item); setWatchDataAddress(data, item.findChild("addr")); setWatchDataChildCount(data, item.findChild("numchild")); if (!manager()->watchHandler()->isExpandedIName(data.iname)) @@ -873,7 +873,7 @@ void GdbEngine::handleEvaluateExpressionClassic(const GdbResponse &response) //if (col == 0) // data.name = response.data.findChild("value").data(); //else - setWatchDataValue(data, response.data.findChild("value")); + setWatchDataValue(data, response.data); } else { data.setError(QString::fromLocal8Bit(response.data.findChild("msg").data())); } diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 99ed718a440..e3f1409eab2 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -3214,13 +3214,15 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos, // ////////////////////////////////////////////////////////////////////// -void GdbEngine::setWatchDataValue(WatchData &data, const GdbMi &mi, - int encoding) +void GdbEngine::setWatchDataValue(WatchData &data, const GdbMi &item) { - if (mi.isValid()) - data.setValue(decodeData(mi.data(), encoding)); - else + GdbMi value = item.findChild("value"); + if (value.isValid()) { + int encoding = item.findChild("valueencoded").data().toInt(); + data.setValue(decodeData(value.data(), encoding)); + } else { data.setValueNeeded(); + } } void GdbEngine::setWatchDataValueToolTip(WatchData &data, const GdbMi &mi, @@ -3501,8 +3503,7 @@ void GdbEngine::handleChildren(const WatchData &data0, const GdbMi &item, if (mi.isValid()) data.typeFormats = QString::fromUtf8(mi.data()); - setWatchDataValue(data, item.findChild("value"), - item.findChild("valueencoded").data().toInt()); + setWatchDataValue(data, item); setWatchDataAddress(data, item.findChild("addr")); setWatchDataExpression(data, item.findChild("exp")); setWatchDataValueEnabled(data, item.findChild("valueenabled")); @@ -3604,7 +3605,7 @@ WatchData GdbEngine::localVariable(const GdbMi &item, } //: Type of local variable or parameter shadowed by another //: variable of the same name in a nested block. - setWatchDataValue(data, item.findChild("value")); + setWatchDataValue(data, item); data.setType(GdbEngine::tr("")); data.setHasChildren(false); return data; @@ -3622,8 +3623,7 @@ WatchData GdbEngine::localVariable(const GdbMi &item, return data; } if (isSynchroneous()) { - setWatchDataValue(data, item.findChild("value"), - item.findChild("valueencoded").data().toInt()); + setWatchDataValue(data, item); // We know that the complete list of children is // somewhere in the response. data.setChildrenUnneeded(); @@ -3631,9 +3631,9 @@ WatchData GdbEngine::localVariable(const GdbMi &item, // Set value only directly if it is simple enough, otherwise // pass through the insertData() machinery. if (isIntOrFloatType(data.type) || isPointerType(data.type)) - setWatchDataValue(data, item.findChild("value")); + setWatchDataValue(data, item); if (isSymbianIntType(data.type)) { - setWatchDataValue(data, item.findChild("value")); + setWatchDataValue(data, item); data.setHasChildren(false); } } diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index dba14acdf00..b1259d5e499 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -529,8 +529,7 @@ private: ////////// Convenience Functions ////////// static QPoint m_toolTipPos; static QByteArray tooltipINameForExpression(const QByteArray &exp); - static void setWatchDataValue(WatchData &data, const GdbMi &mi, - int encoding = 0); + static void setWatchDataValue(WatchData &data, const GdbMi &item); static void setWatchDataValueToolTip(WatchData &data, const GdbMi &mi, int encoding = 0); static void setWatchDataChildCount(WatchData &data, const GdbMi &mi); diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index 067bb7d8980..3e2dca87c58 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -376,7 +376,9 @@ void testQFileInfo() { QFileInfo fi("/tmp/t"); QString s = fi.absoluteFilePath(); - QString t = fi.bundleName(); + s = fi.bundleName(); + s = fi.bundleName(); + s = fi.bundleName(); } void testQHash() @@ -701,6 +703,7 @@ public: void testQObject(int &argc, char *argv[]) { QApplication app(argc, argv); +#if 1 Names::Bar::TestObject test; QAction act("xxx", &app); @@ -710,6 +713,7 @@ void testQObject(int &argc, char *argv[]) t += "y"; t += "y"; t += "y"; +#endif #if 1 QObject ob(&app); @@ -719,7 +723,9 @@ void testQObject(int &argc, char *argv[]) QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater())); QObject::connect(&app, SIGNAL(lastWindowClosed()), &ob, SLOT(deleteLater())); +#endif +#if 1 QList obs; obs.append(&ob); obs.append(&ob1); @@ -727,10 +733,13 @@ void testQObject(int &argc, char *argv[]) obs.append(&app); ob1.setObjectName("A Subobject"); #endif + +#if 1 QString str = QString::fromUtf8("XXXXXXXXXXXXXXyyXXX รถ"); QLabel l(str); l.setObjectName("Some Label"); l.show(); +#endif app.exec(); } @@ -889,7 +898,7 @@ void testStdList() for (int i = 0; i < 100; ++i) flist.push_back(i + 15); -#if 0 +#if 1 std::list plist1; plist1.push_back(new int(1)); plist1.push_back(0); @@ -1251,6 +1260,7 @@ void testQVariant2() my[1] = (QStringList() << "Hello"); my[3] = (QStringList() << "World"); var.setValue(my); + // FIXME: Known to break QString type = var.typeName(); var.setValue(my); var.setValue(my);