Hi André,

thanks for the help.
You might of noticed that I made a mistake writing that thing.
Anyway I wrote another test, and actually tested it.

the source file contains:
#include <iostream>

namespace Ns {

struct A {
    int i;
};

} //namespace Ns


int main(int, char**) {
    Ns::A a;

    std::cout << "a: " << a.i << std::endl;

    return 0;
}

and the dumpers.py contains:
def qdump__Ns__A(d, item):
    warn('qdump__Ns__A')
    d.putType(item.value.type)
    v = item.value
    d.putValue("(%s)" % (v['i']))
    d.putNumChild(0)

warn('loaded extra dumpers')

This is kind of adapted from the previously posted version.
Unfortunately it does nothing.
Well it does print
>~"XXX: loaded extra dumpers\n"

I just downloaded the latest version of QtCreator and tested adding the
dumpers file directly as dumpers.py in the gdb start-up script, and I also
created a dumpers.gdbinit that contains:
python execfile('/path/to/dumpers.py'). This results in the same message
being printed, so I assume it has the same effect.

Additionally I also tried to add the dumpers.py to the "debugging helper
from custom location".
This one prints nothing.

Strange since I'm sure that it worked once, when I first tried this thing.
I can't understand what is wrong.

Can you give me a hint to where you guys call the qdump__Ns__A if one is
available.
Maybe that way I can understand what is being called instead.
That would save me a bit of searching. =)

Thanks,
Paulo

On Sun, Dec 19, 2010 at 6:18 AM, Andre Poenitz <
[email protected]> wrote:

> On Sun, Dec 19, 2010 at 12:43:00AM +0900, Paulo Silva wrote:
> > I'm playing around with the debugger helpers feature, but I can't seem to
> be
> > able to add custom helpers. I'm following this page:
> >
> http://doc.qt.nokia.com/qtcreator-snapshot/creator-debugging-helpers.html
> >
> > which says:
> > "The function name has to be qdump__NS__Foo, where NS::Foo is the class
> or
> > class template to be examined. Nested namespaces are possible."
> >
> > Well I have a
> > namespace ns {
> > struct Abc {
> >     int i;
> >     float f;
> > };
> > }
> >
> > and I created a dumper like:
> > def qdump__cgl__Abc(self, item):
> >     print 'qdump__cgl__Abc'
> >     self.putType(item.value.type)
> >     v = item.value
> >     self.putValue("(%f %f)" % (v["i"], v["f"]))
> >     self.putNumChild(0)
> > Am I doing something wrong here?
>
> The 'cgl' in the dumper name does not match the 'ns' namespace, but
> it has to. You should also use %s instead of %f in the format string.
>
> Note that you cannot use 'print' for debug messages as the real content
> is transfered using this 'channel'. You can use the 'warn(...)' function
> to pass debug output to the debugger log.
>
> ['self' is an unusual name for the dumper parameter, as this is not a
> class method, but as this is only convention it should not matter]
>
> Apart from that the dumper looks ok and should work.
>
> > How do I set the DebugDebuggingHelpers to true?
> > Maybe that could help me understand what I'm doing wrong.
>
> That was only useful for the compiled version of the dumper and it
> recently was even removed it from the codebase in the master branch.
>
> Andre'
> _______________________________________________
> Qt-creator mailing list
> [email protected]
> http://lists.qt.nokia.com/mailman/listinfo/qt-creator
>
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-creator

Reply via email to