Re: [Qt-creator] Overriding dumper.py
Cool! I haven't updated recently. Paulo Andre Poenitz wrote: > On Wed, Apr 07, 2010 at 04:26:40AM +0900, paulo wrote: >> Hi, >> >> well it took me quite a while get back, but finally I got a bit of free >> time and tested your patch. >> >> Definitely it looks better. >> Although it might be considered a conner case, I think it could well be >> included in the main source. > > It has been in for a while now... > > Andre' > ___ > Qt-creator mailing list > Qt-creator@trolltech.com > http://lists.trolltech.com/mailman/listinfo/qt-creator > ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] Overriding dumper.py
On Wed, Apr 07, 2010 at 04:26:40AM +0900, paulo wrote: > Hi, > > well it took me quite a while get back, but finally I got a bit of free > time and tested your patch. > > Definitely it looks better. > Although it might be considered a conner case, I think it could well be > included in the main source. It has been in for a while now... Andre' ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] Overriding dumper.py
Hi, well it took me quite a while get back, but finally I got a bit of free time and tested your patch. Definitely it looks better. Although it might be considered a conner case, I think it could well be included in the main source. Thanks, Paulo André Pönitz wrote: > On Wednesday 24 February 2010 17:46:22 ext paulo wrote: >> 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 still puts everything in a flat list, which is not really nice (but in > line with what is there, so it's not your fault...) > > Could you check that the attached patch helps, too? > > Andre' > > > > > ___ > Qt-creator mailing list > Qt-creator@trolltech.com > http://lists.trolltech.com/mailman/listinfo/qt-creator ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] Overriding dumper.py
On Wednesday 24 February 2010 17:46:22 ext paulo wrote: > 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 still puts everything in a flat list, which is not really nice (but in line with what is there, so it's not your fault...) Could you check that the attached patch helps, too? Andre' --- a/share/qtcreator/gdbmacros/dumper.py +++ b/share/qtcreator/gdbmacros/dumper.py @@ -1165,34 +1165,7 @@ class Dumper: # Anonymous union. We need a dummy name to distinguish # multiple anonymous unions in the struct. anonNumber += 1 -iname = "%s.#%d" % (item.iname, anonNumber) - -#innerType = item.value.type.target() -#self.putType(innerType) -#self.childTypes.append( -#stripClassTag(str(innerType))) -#self.putItemHelper( -#Item(item.value.dereference(), item.iname, None, None)) -#self.childTypes.pop() -#isHandled = True - -self.beginHash() -self.putField("iname", iname) -self.putField("name", "#%d" % anonNumber) -self.putField("value", " ") -self.putField("type", "") -if self.isExpandedIName(iname): -self.beginChildren() -fields = listOfFields(field.type) -for field in fields: -value = item.value[field] -child = Item(value, item.iname, field, field) -self.beginHash() -self.put('addr="%s",' % cleanAddress(value.address)) -self.safePutItemHelper(child) -self.endHash(); -self.endChildren() -self.endHash() +self.listAnonymous(item, "#%d" % anonNumber, type) else: # Named field. self.beginHash() @@ -1202,3 +1175,35 @@ class Dumper: self.endHash() self.endChildren() + +def listAnonymous(self, item, name, type): +anonNumber = 0 +for field in type.fields(): +if len(field.name) > 0: +value = item.value[field.name] +child = Item(value, item.iname, field.name, field.name) +self.beginHash() +self.put('addr="%s",' % cleanAddress(value.address)) +self.putItemHelper(child) +self.endHash(); +else: +# Further nested. +anonNumber += 1 +name = "#%d" % anonNumber +iname = "%s.%s" % (item.iname, name) +child = Item(item.value, iname, None, name) +self.beginHash() +self.putField("name", name) +self.putField("value", " ") +if str(field.type).endswith(""): +self.putField("type", "") +elif str(field.type).endswith(""): +self.putField("type", "") +else: +self.putField("type", field.type) +self.beginChildren(1) +self.listAnonymous(child, name, field.type) +self.endChildren() +self.endHash() + + ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] Overriding dumper.py
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 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.py2010-02-19 23:54:53.0 +0900 +++ dumper.py 2010-02-25 01:24:08.0 +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", "") 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
Re: [Qt-creator] Overriding dumper.py
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 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.py2010-02-19 23:54:53.0 +0900 +++ dumper.py 2010-02-25 01:24:08.0 +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", "") 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
Re: [Qt-creator] Overriding dumper.py
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
[Qt-creator] Overriding dumper.py
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 ~? thank you, paulo ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator