Help on mac: "Debugging Helpers"



  • Using Qt Creator 4.3.1

    The documentation here seems, shall we say, lacking. It's as if it describes all the constituent parts of a car: valves, hoses, bolts, tubes, etc, but fails to describe how to put it together.

    I've googled a lot and tried many different things. I can't for the life of me even get my script to run, much less have it show something interesting in the debugger.

    Would someone, who knows what they're doing on a mac, please illuminate this for us all? Pretty please? Free pro karaoke software for the one who solves this! ;-)



  • i got it sorta working, but have a new Q.
    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"
    • 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" 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" 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 out.

    now that you have your script actually RUNNING, you can fiddle with it to make it do what you need.

    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?



  • is it really true that nobody in the universe of Qt development (who browses the forums) knows the answer to this question?


  • Qt Champions 2016

    It is possible. As a user programmer (for many years) I have never had the need to write my own debug helpers. You should try asking in the mailing list, where you may attract the attention of Qt's developers (they don't frequent the forum).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.