Commit 26fa769b authored by hjk's avatar hjk Committed by hjk

Debugger: Add dumper for QMeta{Enum,Method,Property}

Task-number: QTCREATORBUG-16593
Change-Id: Iaa710660d8ef69459596f93831cf8467913f0468
Reviewed-by: Alexandru Croitor's avatarAlexandru Croitor <alexandru.croitor@qt.io>
parent ac1c04b6
This diff is collapsed.
...@@ -1136,23 +1136,10 @@ class Dumper(DumperBase): ...@@ -1136,23 +1136,10 @@ class Dumper(DumperBase):
#warn("INAME: %s " % self.currentIName) #warn("INAME: %s " % self.currentIName)
#warn("INAMES: %s " % self.expandedINames) #warn("INAMES: %s " % self.expandedINames)
#warn("EXPANDED: %s " % (self.currentIName in self.expandedINames)) #warn("EXPANDED: %s " % (self.currentIName in self.expandedINames))
if self.showQObjectNames:
staticMetaObject = self.extractStaticMetaObject(value.type)
if staticMetaObject:
self.putQObjectNameValue(value)
self.putType(typeName) self.putType(typeName)
self.putEmptyValue()
self.putNumChild(len(typeobj.fields())) self.putNumChild(len(typeobj.fields()))
self.putStructGuts(value)
if self.currentIName in self.expandedINames:
innerType = None
self.put('sortable="1"')
with Children(self, 1, childType=innerType):
self.putFields(value)
if not self.showQObjectNames:
staticMetaObject = self.extractStaticMetaObject(value.type)
if staticMetaObject:
self.putQObjectGuts(value, staticMetaObject)
def toBlob(self, value): def toBlob(self, value):
size = toInteger(value.type.sizeof) size = toInteger(value.type.sizeof)
...@@ -1251,7 +1238,7 @@ class Dumper(DumperBase): ...@@ -1251,7 +1238,7 @@ class Dumper(DumperBase):
# int (**)(void) # int (**)(void)
n = 100 n = 100
self.putType(" ") self.putType(" ")
self.put('sortgroup="1"') self.put('sortgroup="20"')
self.putValue(value[field.name]) self.putValue(value[field.name])
self.putNumChild(n) self.putNumChild(n)
if self.isExpanded(): if self.isExpanded():
...@@ -1275,7 +1262,7 @@ class Dumper(DumperBase): ...@@ -1275,7 +1262,7 @@ class Dumper(DumperBase):
baseNumber += 1 baseNumber += 1
with UnnamedSubItem(self, "@%d" % baseNumber): with UnnamedSubItem(self, "@%d" % baseNumber):
baseValue = value.cast(field.type) baseValue = value.cast(field.type)
self.put('sortgroup="2"') self.put('sortgroup="30"')
self.putBaseClassName(field.name) self.putBaseClassName(field.name)
self.putAddress(baseValue.address) self.putAddress(baseValue.address)
self.putItem(baseValue, False) self.putItem(baseValue, False)
......
...@@ -1084,27 +1084,14 @@ class Dumper(DumperBase): ...@@ -1084,27 +1084,14 @@ class Dumper(DumperBase):
self.putValue(v) self.putValue(v)
self.putType(typeName) self.putType(typeName)
self.putEmptyValue()
self.putNumChild(numchild) self.putNumChild(numchild)
if self.showQObjectNames: self.putStructGuts(value)
staticMetaObject = self.extractStaticMetaObject(value.GetType())
if staticMetaObject:
self.context = value
self.putQObjectNameValue(value)
if self.currentIName in self.expandedINames:
self.put('sortable="1"')
with Children(self):
self.putFields(value)
if not self.showQObjectNames:
staticMetaObject = self.extractStaticMetaObject(value.GetType())
if staticMetaObject:
self.putQObjectGuts(value, staticMetaObject)
def warn(self, msg): def warn(self, msg):
self.put('{name="%s",value="",type="",numchild="0"},' % msg) self.put('{name="%s",value="",type="",numchild="0"},' % msg)
def putFields(self, value): def putFields(self, value, dumpBase = True):
# Suppress printing of 'name' field for arrays. # Suppress printing of 'name' field for arrays.
if value.GetType().GetTypeClass() == lldb.eTypeClassArray: if value.GetType().GetTypeClass() == lldb.eTypeClassArray:
for i in xrange(value.GetNumChildren()): for i in xrange(value.GetNumChildren()):
...@@ -1139,9 +1126,10 @@ class Dumper(DumperBase): ...@@ -1139,9 +1126,10 @@ class Dumper(DumperBase):
for i in xrange(len(baseObjects)): for i in xrange(len(baseObjects)):
baseObject = baseObjects[i] baseObject = baseObjects[i]
with UnnamedSubItem(self, "@%d" % (i + 1)): with UnnamedSubItem(self, "@%d" % (i + 1)):
self.put('iname="%s",' % self.currentIName) self.put('iname="%s",' % self.currentIName)
self.put('name="[%s]",' % baseObject.name) self.put('name="[%s]",' % baseObject.name)
self.putItem(baseObject.value) self.put('sortgroup="30"')
self.putItem(baseObject.value)
memberCount = value.GetNumChildren() memberCount = value.GetNumChildren()
if memberCount > 10000: if memberCount > 10000:
......
This diff is collapsed.
...@@ -217,6 +217,7 @@ void dummyStatement(...) {} ...@@ -217,6 +217,7 @@ void dummyStatement(...) {}
#include <string> #include <string>
#include <vector> #include <vector>
#include <QMetaMethod>
#include <stdarg.h> #include <stdarg.h>
#include <stdint.h> #include <stdint.h>
...@@ -1842,6 +1843,9 @@ namespace qobject { ...@@ -1842,6 +1843,9 @@ namespace qobject {
Q_SIGNAL void sigFoo(); Q_SIGNAL void sigFoo();
Q_SIGNAL void sigBar(int); Q_SIGNAL void sigBar(int);
enum Side { LeftSide, RightSide };
Q_ENUMS(Side)
public: public:
Ui *m_ui; Ui *m_ui;
QString m_myProp1; QString m_myProp1;
...@@ -1860,11 +1864,32 @@ namespace qobject { ...@@ -1860,11 +1864,32 @@ namespace qobject {
test.setObjectName("An object"); test.setObjectName("An object");
QString s = test.myProp1(); QString s = test.myProp1();
s += test.myProp2(); s += test.myProp2();
const QMetaObject *mo = test.metaObject();
QMetaMethod mm0;
const QMetaObject smo = test.staticMetaObject;
QMetaMethod mm = mo->method(0);
QByteArray mmname = mm.name();
QMetaEnum me0;
QMetaEnum me = mo->enumerator(0);
QMetaProperty mp0;
QMetaProperty mp = mo->property(0);
QMetaClassInfo mci0;
QMetaClassInfo mci = mo->classInfo(0);
int n = mo->methodCount();
QVector<QMetaMethod> v(n);
for (int i = 0; i < n; ++i)
v[i] = mo->method(i);
BREAK_HERE; BREAK_HERE;
// Check s "HELLOWORLD" QString. // Check s "HELLOWORLD" QString.
// Check test qobject::Names::Bar::TestObject. // Check test qobject::Names::Bar::TestObject.
// Continue. // Continue.
dummyStatement(&s); dummyStatement(&s, &mm, &smo, &mo, &mmname, &mm0, &me, &me0, &mp, &mp0, &mci, &mci0);
} }
void testQObject3() void testQObject3()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment