modifying non-simple data types in Creator debugger



  • Hi -

    I have a program using complex numbers (from <complex>). I'd like to be able to modify the contents of some of these variables during debugging, but Creator ignores my attempted changes. From the debugger doc:

    *You can use the Locals and Expressions view to change the contents of variables of simple data types, for example, int, float, QString and std::string when the program is interrupted. *

    So, does this mean that you can't modify any other data types? If so, does anyone know of any workarounds for this? Thanks.



  • Hi,

    it looks indeed as there is only basic support for displaying std::complex. However, there is the possibility to extend the so called "debugging helpers" [1] with small python programs. With that, you can modify any data type, as long as you know its internal memory layout.

    [1] http://doc.qt.io/qtcreator/creator-debugging-helpers.html



  • Hi again,

    I found the dumper for std::complex in /opt/qtcreator-4.3.0/share/qtcreator/debugger/stdtypes.py

    It seems the dumper is already prepared to expand in the watch window, making it possible to display real and imaginary part on seperate lines. This should also make it possible to edit them. However, the type has no expandig triangle, so I guess there is a (small) bug somewhere.

    I've therefore created https://bugreports.qt.io/browse/QTCREATORBUG-18680 to track this issue.



  • Good news, the developer hjk fixed the small bug in stdtypes.py. Either use a Creator 4.4 snapshot starting tomorrow or apply the one-line patch to your stdtypes.py yourself.

    The change is the following: https://codereview.qt-project.org/201972

    I guess this thread can now be closed also :)



  • Thank you for taking the trouble to get this resolved. Currently Creator 4.4 is a bit buggy for my uses (didn't auto-detect my desktop kit), so I'll probably wait for it to settle down a bit, but I do appreciate your work on this.


Log in to reply
 

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