On Wed, Jun 2, 2010 at 6:03 PM, Andre Poenitz <
[email protected]> wrote:

> On Wed, Jun 02, 2010 at 03:16:23PM +0200, Grego wrote:
> > Hi,
>
> Hi.
>


> >
> > I can see the local value of MyClass instance with:
> >
> > def qdump__MyClass(d, item):
> >     data = call(item.value, 'chars()')
> >     s = data.string('utf-8')  # Tells gdb that pointer is 'string like',
> in
> > encoding utf-8
> >     d.putValue(s)  # it would be nice to have a helper to quote this...
> > gdbmacros.py way looks cryptic...
> >     d.putNumChild(0)
>
> This will not work in case of uninitialized or otherwise corrupted data
> or data translating to characters breaking the MI protocol. The only
> way to pass such "random" data is to encode it:
>
>  def qdump__MyClass(d, item):
>     data = call(item.value, 'chars()')
>      d.putValue(encodedCharArray(data, 100), Hex2EncodedUtf8)
>     d.putNumChild(0)
>
> [Not tested, so this might be slightly off the mark]
>
>
Ok, I see the point.  For my own classes less stringent approach works
though, as I never have uninitialized or corrupted data... ;-)


> > But the reference type MyClass & does not show up.
> > I tried the following hack:
>
> That might be the bug that was fixed with b61e32371f055 about a week ago.
> The fix is small, you can apply it locally:
>
> -------------------------------- snip -----------------------------
>    debugger: fix display of children of objects passed by reference.
>
>    The value was adjusted to the referenced value but it was not used
>    when dumping the members, basically leading to an empty child list
>    in such cases.
>
> diff --git a/share/qtcreator/gdbmacros/dumper.py
> b/share/qtcreator/gdbmacros/dumper.py
> index e31b154..2012cef 100644
> --- a/share/qtcreator/gdbmacros/dumper.py
> +++ b/share/qtcreator/gdbmacros/dumper.py
> @@ -1366,7 +1366,8 @@ class Dumper:
>                 if len(fields) == 1 and fields[0].name is None:
>                     innerType = value.type.target()
>                 with Children(self, 1, innerType):
> -                    self.putFields(item)
> +                    child = Item(value, item.iname, None, item.name)
> +                    self.putFields(child)
>
>     def putFields(self, item, innerType = None):
> -------------------------------- snip -----------------------------
>
>
Hmm.. looking at my copy of dumper.py I don't think this applies cleanly to
stock 1.3.83.    I'll have to peruse the git repo at some point.


> You debugging helper does not have to take care of references or
> such, that's done by the "framework" in dumper.py.
>

That's kind of what I was expecting, thanks for the confirmation.


-- 
Grego
http://mpaja.com/
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-creator

Reply via email to