PDA

View Full Version : Qt 4.8: Step into Qt's source code on Windows using MSVC



agarny
15th April 2012, 10:37
Hi,

I was wondering whether there is a way to step into Qt's source code on Windows using MSVC? Right now, if I try to trace into Qt's source code, it will go into whatever code is located in a Qt header file, but not in anything which is located in Qt .cpp file. I have donwloaded Qt's source code, but I was surprised to find out that is located in a complete different place to where Qt's header files are. Anyway, any help on this (and, to some extent, the same on Linux and Mac OS X) would be much appreciated...

Cheers, Alan.

Boron
16th April 2012, 11:47
Your thread would better fit into "Installation and Deployment" :).

You have the source of Qt?
The you should compile it with the configure option -debug-and-release.
After the nmake you will have two version of the Qt libraries, e.g. QtCore4.dll and QtCored4.dll.
The 'd' in the second filename marks the file as the one with debug information included.
When compiling as debug version in Visual Studio you can step into all Qt functions.

agarny
16th April 2012, 12:15
You have the source of Qt?Yes


The you should compile it with the configure option -debug-and-release.
After the nmake you will have two version of the Qt libraries, e.g. QtCore4.dll and QtCored4.dll.
The 'd' in the second filename marks the file as the one with debug information included.
When compiling as debug version in Visual Studio you can step into all Qt functions.Hmm... why should I have to compile Qt? I have downloaded and installed the Qt SDK and asked for the MSVC version of Qt to be installed. Also, and for good measure, I thought, I installed Qt's source code. So, from there, I would expect to be able to trace into Qt's source code using CDB from within Qt Creator, but I am clearly wrong since I can't seem to be able to do that...

Boron
16th April 2012, 13:18
I thought you were using Visual Studio and a self compiled Qt.
Unfortunately I never used the Qt SDK and Qt Creator, so I am sorry for not being able to help you :(.

Spitfire
17th April 2012, 09:12
Usually I work with Qt 4.6 and there it works out of the box but when I've tried 4.8 I had the same issue as you.
Never had time to look into that though ;/

If you find an answer, please post it here :)

agarny
18th April 2012, 08:33
Usually I work with Qt 4.6 and there it works out of the box but when I've tried 4.8 I had the same issue as you.Could it be that Qt 4.6 ships with PDB files while Qt 4.8 doesn't? (Just a very wild guess since I am not very familiar with MSVC.)

Nesbit
18th April 2012, 10:03
Hmm... why should I have to compile Qt? I have downloaded and installed the Qt SDK and asked for the MSVC version of Qt to be installed.
If you use the QtSDK installer, I don't think that you can get the source code files. It's the case for me, and I've checked carefully (I have two different installations of Qt on my computer, one using QtSDK installer and the other compiled by myself. And for the second one, the source files are in the /src folder).

agarny
18th April 2012, 10:10
If you use the QtSDK installer, I don't think that you can get the source code files. It's the case for me, and I've checked carefully (I have two different installations of Qt on my computer, one using QtSDK installer and the other compiled by myself. And for the second one, the source files are in the /src folder).I used the QtSDK installer and I definitely have the source files (under C:\QtSDK\QtSources\4.8.0\src). See here (http://www.opencor.ws/developer/res/pics/QtSDK.png) for how I installed the Qt SDK.

krabicezpapundeklu
21st June 2012, 19:48
I am using 4.8.1 SDK and Qt Creator 2.5, so things may be a little bit different for you...
This works for me:

1) install Debugging Tools for Windows
2) in Qt Creator: Tools > Options > Debugger > Source Paths Mapping - add:

Source path: c:\iwmake\build_vs2010_opensource_________________ PADDING_________________
Target path: c:\QtSDK\QtSources\4.8.1

I found source path by looking for some "path-like" strings in PDB files under c:\QtSDK\Desktop\Qt\4.8.1\msvc2010\lib.

agarny
22nd June 2012, 15:07
I am using 4.8.1 SDK and Qt Creator 2.5, so things may be a little bit different for you...

I personally use Qt 4.8.0 with Qt Creator 2.4.1.


1) install Debugging Tools for Windows

I already had them installed so that I could debug using CDB using Qt Creator.


2) in Qt Creator: Tools > Options > Debugger > Source Paths Mapping - add:

Source path: c:\iwmake\build_vs2010_opensource_________________ PADDING_________________
Target path: c:\QtSDK\QtSources\4.8.1

I found source path by looking for some "path-like" strings in PDB files under c:\QtSDK\Desktop\Qt\4.8.1\msvc2010\lib.

Ok, I thought I would look for PDB files under c:\QtSDK\Desktop\Qt\4.8.0\msvc2010\lib, but couldn't find any.

I use Qt SDK so I decided to double check what is the latest version of Qt and Qt Creator which comes with it. The Update Qt SDK program tells me that there are no updates available, yet the website says that the latest version of Qt SDK comes with Qt 4.8.1, and indeed if I decide to maintain (rather than update) my copy of Qt SDK, then I can see that Qt 4.8.1 is available (hmm... so much for the Update Qt SDK program!).

Anyway, I have upgraded my copy of Qt to version 4.8.1 and I can now see some PDB files. So, there is already a difference between Qt 4.8.0 and Qt 4.8.1...

Next, I did what you suggested, but unfortunately for me, it doesn't work in my case (I mean, I tried to trace into the QApplication code using the 'mainwindow' Qt demo, but to no avail). Maybe it's related to my using Qt Creator 2.4.1 while you use version 2.5?...

krabicezpapundeklu
25th June 2012, 18:07
I tried Qt Creator 2.4.1 and it works too...
Can you start debugging, hit some breakpoint and then:

1) open Window > Views > Debugger Log
2) execute !lmi QtCored4 command?

I get:

Loaded Module Info: [qtcored4]
Module: QtCored4
Base Address: 000000006d670000
Image Name: C:\QtSDK\Desktop\Qt\4.8.1\msvc2010\lib\QtCored4.dl l
Machine Type: 332 (I386)
Time Stamp: 4f619340 Thu Mar 15 07:59:12 2012
Size: 449000
CheckSum: 445fcf
Characteristics: 2102
Debug Data Dirs: Type Size VA Pointer
CODEVIEW 74, 39664c, 39544c RSDS - GUID: {D9B88246-65E9-4B48-8C50-AA74663B223F}
Age: 1, Pdb: c:\iwmake\build_vs2010_opensource_________________ PADDING_________________\lib\QtCored4.pdb
Symbol Type: DEFERRED - No error - symbol load deferred
Load Report: no symbols loaded

Maybe image name is different?

agarny
26th June 2012, 10:51
Ok, I have just tried what you suggested and I got the exact same result except for the base address, as well as... a space before "PADDING" in your version of the source path. In my comment above (#10), I used your version (with the space) which is the reason things were not working for me. Now, I am using the version (without a space before "PADDING") and everything works as expected. So, thanks a lot for following up on my issue. Much appreciated!

PS: the issue with the space before "PADDING" is the forum's fault: it is it which added a space!