diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index e96fe86d632918b6c9199246fb4182fdff1457b2..4c9216c3817c952812fe81f15e998ccfc8335f0a 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -262,6 +262,8 @@ class Dumper(DumperBase): self.autoDerefPointers = int(args.get("autoderef", "0")) self.partialUpdate = int(args.get("partial", "0")) self.fallbackQtVersion = 0x50200 + self.sortStructMembers = bool(args.get("sortStructMembers", True)) + #warn("NAMESPACE: '%s'" % self.qtNamespace()) #warn("EXPANDED INAMES: %s" % self.expandedINames) #warn("WATCHERS: %s" % self.watchers) @@ -399,6 +401,7 @@ class Dumper(DumperBase): # Don't bother. It's only supplementary information anyway. pass + locals.sort(key = lambda item: item.name) for item in locals: value = self.downcast(item.value) if self.useDynamicType else item.value with OutputSafer(self): @@ -1143,6 +1146,9 @@ class Dumper(DumperBase): def putFields(self, value, dumpBase = True): fields = value.type.fields() + if self.sortStructMembers: + fields.sort(key = lambda field: + '[' + field.name if field.is_base_class else field.name) #warn("TYPE: %s" % value.type) #warn("FIELDS: %s" % fields) diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 98d581543c57b0ef522a07dfdbff2b7d16c1663f..64fcf71dd6651eb77ca581ee938c34f5d21696e2 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -1145,9 +1145,11 @@ class Dumper(DumperBase): self.put('iname="%s",' % self.currentIName) self.put('name="[%s]",' % child.name) self.putItem(child) - for i in xrange(m, n): - #for i in range(n): - child = value.GetChildAtIndex(i) + + children = [value.GetChildAtIndex(i) for i in xrange(m, n)] + if self.sortStructMembers: + children.sort(key = lambda child: str(child.GetName())) + for child in children: # Only needed in the QVariant4 test. if int(child.GetLoadAddress()) == 0xffffffffffffffff: typeClass = child.GetType().GetTypeClass() @@ -1655,6 +1657,7 @@ class Dumper(DumperBase): self.reportToken(args) self.expandedINames = set(args.get('expanded', [])) self.autoDerefPointers = int(args.get('autoderef', '0')) + self.sortStructMembers = bool(args.get("sortStructMembers", True)); self.useDynamicType = int(args.get('dyntype', '0')) self.useFancy = int(args.get('fancy', '0')) self.passExceptions = int(args.get('passexceptions', '0')) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 921861e9d307035314daecea914a849ce3a5955d..a5de348e6ce844eb03cbb5a4a3d831d076c8d6a2 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4711,6 +4711,7 @@ void GdbEngine::doUpdateLocals(const UpdateParameters ¶ms) cmd.arg("resultvarname", m_resultVarName); cmd.arg("partialVariable", params.partialVariable); + cmd.arg("sortStructMembers", boolSetting(SortStructMembers)); cmd.flags = Discardable; cmd.callback = [this, params](const DebuggerResponse &r) { handleStackFrame(r); }; runCommand(cmd); diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 664758e2e3f7d79a883a85917550c39a5677c373..f7730df23275a3d305b5583b682c891443f8f77e 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -874,6 +874,7 @@ void LldbEngine::doUpdateLocals(const UpdateParameters ¶ms) cmd.arg("autoderef", boolSetting(AutoDerefPointers)); cmd.arg("dyntype", boolSetting(UseDynamicType)); cmd.arg("partialVariable", params.partialVariable); + cmd.arg("sortStructMembers", boolSetting(SortStructMembers)); cmd.beginList("watchers");