Important: Please read the Qt Code of Conduct -

Interrupting into the running application launched from Qt using CDB as debug tool fails!

  • Dear Qt fans,

    In short: Interrupting into the running application launched from Qt using CDB as debug tool fails miserably! I am really sad now or rather angry or rather sad, i do not know... : ((((((((((((((((

    In long:
    First sorry for the long introduction but I have a strange error and I try to share all the pieces of information which might be relevant. So I have downloaded/installed a Qt (sdk???) following the link: Qt 5.0.1 for Windows 32-bit (VS 2010, 481 MB) on the download page (2013 03. 30.) First I had some problems with VS2012 which installed .Net framework v4.5 and as a consequence (relatively old) VS2010 express stopped to work (and Qt as well) I googled the problem and after uninstalling VS2012, .Net v4.5 (and everything which was not essential to me (previously installing along with VS2012 I hope : ))) and Qt, I reinstalled VS2010 express. After that I could build and run applications with VS2010E. Then I installed Qt again (Qt Creator 2.6.2 Based on Qt 5.0.1 (32 bit) Built on Jan 30 2013 at 07:08:53 From revision 55e2124f32) and It seemed to work: I tried the notepad example and I could build and run the application both in debug and release configurations. Then I tried to debug it. And I received an error related to the missing cdb. I tried install WinSDK7, but It was unsuccessful because of an annoying bug: since Qt use 32bit tool chain I tried to install 32bit WinSDK but setup.exe failed not founding WinSDK_amd64.msi (I tried both web and ISO install). Finally I tried installing just the dbg_x86.msi and (later) WinSDKDebugToolsRedist_x86.msi. Both installed successfully. Than Qt found automatically cdb and asked for debug symbol path setup. After that I could start debugging the application. If I set a breakpoint before launching the application the breakpoint was recognized and the execution was breaked hitting the breakpoint. But I realized I could not remove or set break points while the application was running.
    Since I have not too much experience and knowledge about how debugging works technically (e.g. how .exe and .cpp related; how debugger knows the mapping between the lines of the code and the memory addresses of the instructions in the exe, what is exactly stored in a pdb etc) I tried CDB to attach to a running notepadexample.exe. Well starting the exe was not succesfull so I copied all of the dll-s, pdb-s to a folder along with the exe and the exe launched. I could attach to it with CDB, but it is not similar to gdb so I used windbg.exe instead (is this a big difference in this case?). So I could debug the running application with windbg, and after playing with it a bit and receiving some useful and comprehensive warnings I noticed that I can set and remove breakpoints if and only if the application is interrupted! Assuming this is the way how it works I turned back to Qt start debugging the application and I tried to interrupt it. After pressing the || buttom a cmd windows appears and disappears immediately, so I can not read it and the following message appears in the debugger window

    State changed from InferiorRunOk(11) to InferiorStopRequested(13) [master]
    Attempting to interrupt.
    Interrupting process 3164...

    Next to the arrow the circle appears indicating the Qt is waiting for something, but nothing happens. The debugger push buttoms (interruption and stop debugging) are grays, and the application is not interrupted: I can even enter text into the textEdit widgets area of the application and the application behaves as usual. The Qt seems to lost the control over the application. I can not even stop the debug section! I have to close the application using the application own functionality.
    I tried to attach to the running application with VS2010 and it works. I can set/remove breakpoints while the application is running and the breakpoints break the execution. So it works.
    I tried to interrupt (pressing ctrl+c) the application while debugging it with cdb and then continue using the "g" command and it works.
    So here the story ends now. My knowledge stops here. If anyone could be so kind to meditate about my problem and suggest any solution (even a workaround would be appreciated! Well a better workaround than develop with Qt then debug with VS) E.g. how difficult would be to build Qt with VS2010E and set a custom build to run moc and QtDesigner when editing ui files, that is using VS instead of Qt? Is it at all possible?

    By the way trying to launch the .exe (debug version) I started to add dll-s to the directory where the .exe is. After adding some of them the application seems to start but immediately an error message is popped up:
    Debug Error!

    Pogram: .... .exe
    Module: 5.0.1
    File: kernel\qguiapplication.cpp
    Line 781

    Failed to load platform plugin "windows". Available platforms are: minimal, windows
    ... (Abort, Retry, Ignore)

    Choosing whatever options the application quits. So perhaps the conditions under I executed the application is different when I copied everything next to the .exe compared to the launch from Qt. I do not know how to launch the application in the same way using the built exe and some other stuffs than launched from Qt. (The built kit is for the desktop platform where I developed, built and run the code... so this all kind of platform simulation like stuff is strange to me in this situation and well frankly in general as well)

    Thanks in advance and sorry for the long story!

Log in to reply