QT Creator - Debug QT Source Code (Using Windows & MingW Only)
-
When looking back, there seems to be a lot of unsolved posts in the attempt to answer the "How" in being able to Debug or step into the QT Source code in QT Creator under Windows utilizing MingW.
Why is this? Why is there no clarity in the community for Windows & MingW when it comes to stepping into the QT source code?🤔
A lot of the posts have attempted to answer this by instructing users to do the following :
QT 5:
[QT Creator]->[Tools]->[Options]->[Debugger]->[General]->[Source Path Mapping]->click [Add QT Sources]QT 6:
[QT Creator]->[Edit]->[Debugger]->[General]->[Source Path Mapping]->click [Add QT Sources]After clicking on 'Add QT Sources' everyone says point it to the 'Src' folder such as:
QT 5:
C:\Qt\Qt5.14.0\5.14.0\SrcQT 6:
C:\Qt\6.4.3\SrcI have tried this in both QT5 and QT6, and I still can't get QT Creator to step into the QT Source code.
Question: Is the real answer that it is NOT possible to step into the QT Source code when running QT Creator on Windows and using MingW?
Using the QT Maintenance Tool, yes I do have "Sources" & "Qt Debug Information Files" checked and installed.
Can anyone please confirm or provide clarity as to what is and is not possible for Windows using QT Creator and a flavor of MingW?
-
@JasonCA said in QT Creator - Debug QT Source Code (Using Windows & MingW Only):
Can anyone please confirm or provide clarity as to what is and is not possible for Windows using QT Creator and a flavor of MingW?
Definitely this should be possible.
Do you run your project in debug mode?!Qt Company even made a video dealing with this.
See here:Windows + QtCreator + MinGW
-
@Pl45m4 said in QT Creator - Debug QT Source Code (Using Windows & MingW Only):
@JasonCA said in QT Creator - Debug QT Source Code (Using Windows & MingW Only):
Can anyone please confirm or provide clarity as to what is and is not possible for Windows using QT Creator and a flavor of MingW?
Definitely this should be possible.
Do you run your project in debug mode?!Qt Company even made a video dealing with this.
See here:Windows + QtCreator + MinGW
I appreciate the response @Pl45m4. 👍
Prior to posting, I did see this video. However, if you look carefully at the video, the compilation is with Visual Studio. Please see the following snippet taking from the YouTube video:
See the green arrow?
If it was MingGW, I would see something like ... "Desktop_Qt_5_15_2_MinGW_64_bit"... rather than MSVC2019 as is seen in that video tutorial.
I have followed this and verified that I have everything installed per the video. However, in use of MinGW, I can't step into the QT Source code. It's for this reason I am posting in question if it's possible to debug the QT Source with MinGW or if it's only possible through the Microsoft compiler? 🤔
-
@JasonCA said in QT Creator - Debug QT Source Code (Using Windows & MingW Only):
if it's possible to debug the QT Source with MinGW
I just tested it. It works. Qt5.14 & QtCreator on Windows 10 and definitely MinGW.
Did nothing but adding the Qt source directory. -
@Bonnie said in QT Creator - Debug QT Source Code (Using Windows & MingW Only):
@JasonCA It is possibile, if all your configuration is right, then the only thing need is to move all the
.debug
file from Qt'slib
folder tobin
folder, this is from my own experience.Thanks Bonnie! I wanted to take the opportunity to follow up with you.
For me, your suggestion is indeed the solution to my problem.
I did the following:
Copied all <filename>.debug from:
C:\Qt\5.15.2\mingw81_64\lib
To:
C:\Qt\5.15.2\mingw81_64\binAfter doing this, then QT Creator was able to step into the QT libraries. It was NOT enough to simply point QT Creator to the included 'Src' directly like so many threads have suggested.
On the other hand, I have a version of QT on a different system that has absolutely no <filename>.debug files anywhere. It seems like .debug files are not distributed for some QT installations (nor an option to select for including it upon install).
Where is there any documentation that states you must copy the .debug files into the 'lib' from the 'bin' when you are interested in debug? It's the first I have seen this mentioned.
Perhaps QT Creator, or some versions, may point to the bin folder and find the corresponding .debug files. But, I know at least in my case and in a clean QT installation, QT Creator hasn't worked out of the box without first copying the files into the 'lib' folder.
Thanks Bonnie! 👍😃
-
Perhaps this varies for installation versions? Your environment may magically be picking up the .debug files? Did you have to move any .debug file around? 🤔
In the case for 5.14.0, for example, .debug files are not included. Debug doesn't seem possible even when the 'Src' is installed.
🙂
-
@JasonCA I think this might be a BUG, see https://bugreports.qt.io/browse/QTBUG-86790 they seem to fix it from Qt5.15.11 and Qt6.
And from this https://bugreports.qt.io/browse/QTBUG-88022 it seems that before 5.15 the .debug files are not used and there should be pure debug binaries.