Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Expanding the ‘this’ Pointer in the Debug Locals Window



  • I’ve run into a situation using Qt Creator that I’m hopping that someone has seen and already solved because I don’t really even know where to start on figuring this one out. I’ve saw several posts on this forum that were similar but the suggested fixes didn’t seem to apply.

    I’m using Windows 7 Pro, 64-bit with Qt Creator v4.9.2 and applying the Desktop Qt 5.12.3 minGW 64-bit kit to run and debug.

    When running in debug and a break point is set, when the program halts execution at the break point, I can see the variables and their values that were declared in the current function displayed in a rather unusual way (explanation in next paragraph). When I attempt to expand the local this pointer, the following window pops up and after selecting “OK”, the debugger shuts down completely.

    Error.png
    This only occurs when I attempt to expand the this pointer, all other expandable variables expand without any problem.

    In addition, there is something else that I have never seen before. With the exception of the this pointer, the variables and their values that are displayed in the locals window, each appear to have multiple instances displayed with the duplicates having an @ symbol and their value <optimized out>.

    Example...
    file “filename”
    file@1 <optimized out>
    file@2 <optimized out>
    velocity 300
    velocity@1 <optimized out>
    velocity@2 <optimized out>

    I did not make any changes that I’m aware of to the system, the Qt setup or the Qt project build prior to this event occurring. It happened right after changing several large chunks of my code, none of which should have changed anything for Qt, the compiler or the debugger..

    If anybody has seen this or knows what I’ve screwed-up, I would highly appreciate it if someone can help me clear this up.



  • @Corny
    I don't use Qt IDE, but ...

    1. Since you made your "big code changes". have you made everything clean, deleting intermediate files, clearing caches, etc, and done a 100% clean rebuild?

    2. Have you tried just running command-line gdb on it, outside of Qt Creator, and then examine this? Might prove it's gdb that's in the bad state?

    3. Have you created just a simple, brand new project and checked that still debugs OK? Want to make sure the problem is in the existing project and not in Qt/gdb itself.



  • Thanks for the suggestions JonB, they are all good suggestions. I have indeed cleaned the program up and also re-ran qmake. I will try your other two suggestions and let you know the result.



  • I eventually became overly frustrated and I just re-installed the whole Qt package. It appears to be working fine now. Thanks so much for your assistance.