Hi again,
careful the last patch had an extra tab (which, as everybody knows, will cause segmentation faults and core dumps in the python interpreter).

This one is ok.
Cheers,
Paulo

paulo wrote:
Ok that wont be necessary any more.

Sorry for taking so long (about 4 hours for 10 lines of code errrm), but I had to learn python.
Here's my first patch submission. (to whom it may concern lol)
It's just a hack to remove the (des)ordering introduced by the hash in dumpers.py.

Not much, but it works for me.

Of course after this crash course on python I can say that I feel like the python inventor should be castrated (and that's me being nice; dam this XXXX doesn't even support tabs). I'm sure that guy will burn in hell for making me(us) suffer with the most idiotic scoping idea in the world.

well cheers,
Paulo



André Pönitz wrote:
On Wednesday 24 February 2010 13:36:50 ext paulo wrote:
Hi,
I was thinking of doing some changes to /usr/share/qtcreator/gdbmacros/dumper.py

and before looking into qt-creator source I thought asking would be faster, can I override the original dumper.py if I put a copy somewhere in my ~?

That's not supported. But you can add a line loading your personal dumpers in ~/.gdbinit.

Andre'
_______________________________________________
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator

--- /usr/share/qtcreator/gdbmacros/dumper.py    2010-02-19 23:54:53.000000000 
+0900
+++ dumper.py   2010-02-25 01:24:08.000000000 +0900
@@ -179,15 +179,30 @@
         d.put('},')
         bp = Breakpoint()
 
+#######################################################################
+#
+# Node ( hack to order names in nested anon unions :p )
+#
+#######################################################################
+
+class Node:
+    def __init__(self, depth, idx, iname):
+        self.depth = depth
+        self.idx = idx
+        self.iname = iname
+        self.name = "#%d_%d_%s" % (depth, idx, iname)
 
 # Creates a list of field names of an anon union or struct
-def listOfFields(type):
+def listOfFields(type, depth):
     fields = []
+    idx = 0
     for field in type.fields():
         if len(field.name) > 0:
-            fields += field.name
+            fields.append(Node(depth, idx, field.name))
+            idx += 1
         else:
-            fields += listOfFields(field.type)
+            depth += 1
+            fields += listOfFields(field.type, depth)
     return fields
 
 
@@ -1183,10 +1198,11 @@
                         self.putField("type", "<anonymous union>")
                         if self.isExpandedIName(iname):
                             self.beginChildren()
-                            fields = listOfFields(field.type)
+                            depth = 0
+                            fields = listOfFields(field.type, depth)
                             for field in fields:
-                                value = item.value[field]
-                                child = Item(value, item.iname, field, field)
+                                value = item.value[field.iname]
+                                child = Item(value, item.iname, field.iname, 
field.name)
                                 self.beginHash()
                                 self.put('addr="%s",' % 
cleanAddress(value.address))
                                 self.safePutItemHelper(child)
_______________________________________________
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator

Reply via email to