[Interest] debug helper Q
David M. Cotter
dave at kjams.com
Mon Aug 28 07:30:34 CEST 2017
i got my debug helper sorta working, but have a Q about how they work
how do i show a field within the class/struct as “the value” i want to see?
details: steps i took were this:
go to folder that contains Qt Creator.app
right click "Qt Creator"->show package contents (obviously, right?)
go into Contents->Resources->debugger
edit the file "personaltypes.py <http://personaltypes.py/>"
at the bottom, enter the SIMPLEST POSSIBLE function, like this:
def qdump__YOUR_CLASS(d, value):
d.putValue("i see the light!")
d.putNumChild(0)
substitute your actual class name, above, for "YOUR_CLASS"
now run
you SHOULD see "i see the light!" in the debugger, next to any var of type YOUR_CLASS
so far so good?
copy the file "personaltypes.py <http://personaltypes.py/>" into your own dev tree, wherever you want to keep your python code
revert the changes to the original one (so they do not conflict)
in Qt Creator 4.3, go to preferences->debuggers->gdb (note: in 4.4 or later, go to "preferences->debuggers->locals & expressions")
in that panel, in "Extra Debugging Helpers", put the path to your version of the "personaltypes.py <http://personaltypes.py/>" script
run your app again. you should still see "i see the light!". if not, check your steps
note that if ANYTHING unexpected is in your python file, it will fail silently, no message in the debug log. this is a large part of why i could not figure this whole thing out in the first place.
now that you have your script actually RUNNING, you can fiddle with it to make it do what you need.
so my last question is this:
If I have a class:
class foo {
type1 var1;
type2 var2;
type3 var3;
};
and say var2 and var3 are implementation details and all i care about is just seeing var1 WITHOUT having to click the little "disclosure triangle" (twirly arrow), i thought i could just have my helper say this:
def qdump__foo(d, value):
d.putValue(value["var1"])
d.putNumChild(0)
but then all i get is TYPEINFO about "type1", i do not get the VALUE of type1. what do i do to see the value?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170827/b9f6bad8/attachment.html>
More information about the Interest
mailing list