I want to setup Qt Creator (3.0) in a way, that I can debug into the Qt classes. So I download the corresponding src code (http://gitorious.org/qt/qt5) and install it in a d
You have to compile your own Qt. That's the only way of getting this functionality. You're free to use any IDE you want, including a precompiled one. Simply register your self-compiled Qt as a kit in Qt Creator.
Precompiled Qt simply doesn't ship with files with debug information. You can waste an unbounded amount of time trying to debug into precompiled Qt. It's not possible on Unix platforms since the required debug-information-containing objects are not shipped. Neither is it available on Windows, for the same reason - the .pdb files aren't there for MSVC builds, and the object files aren't there for mingw builds. That's seriously all there's to it.
When building a -debug-and-release
build of Qt, you must retain all of the following trees (folders) in order for debugging to work:
I don't really know what prebuilt Qt is for. As far as I'm concerned, it shouldn't be offered: it just confuses the heck out of everyone. It's of no use to end users, and it's of no use to developers - I just can't see debugging seriously without access to Qt sources. It defeats the purpose of there being the sources, in a way. Sure, there should be a prebuilt Qt Creator with the prebuilt Qt libraries that it needs, but this shouldn't be exposed outside of it.
If you are using a prebuilded version just remap the source code location as described in http://doc.qt.io/qtcreator/creator-debugger-engines.html
Mapping Source Paths
To enable the debugger to step into the code and display the source code when using a copy of the source tree at a location different from the one at which the libraries where built, map the source paths to target paths:
- Select Tools > Options > Debugger > General > Add.
- In the Source path field, specify the source path in the debug information of the executable as reported by the debugger.
- In the Target path field, specify the actual location of the source tree on the local machine.
To get "the source path in the debug information of the executable as reported by the debugger", you can activate the "Use Tooltips in Stack-View when Debugging" option by right-clicking in the Stack View and move the mouse over a specific function call.
With Xcode, before you step into the Qt library the first time, enter the following command in the LLDB window:
settings set target.source-map /Users/qt/work/qt /path/to/Qt/5.10.1/Src
(Obviously you'll want to change the version number, as relevant).
But suppose Trolltech changes its build directory, what to do then? (Or, how did the community wiki that gave the /Users/qt/work/qt
path find it?) You can guess what the path needs to be by editing /path/to/Qt/5.10.1/clang_64/lib/QtCore.framework.dSYM/Contents/Resources/DWARF/QtCore_debug
(or any other Qt library) and searching for some paths. "/Users" seems like a good guess. About 2% into the library you'll start seeing sections with a lot of paths like:
../../include/QtCore/../../src/corelib/kernel^@../../include/QtCore
/../../src/corelib/tools^@global^@/Users/qt/work/qt/qtbase/src/corelib
/../../include/QtCore/../../src/corelib/arch^@/Applications/Xcode.app
/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/<etc>
Look for an absolute path that looks like it could be writable. (/Applications/...
would not be a likely build path, for example)
In recent Qt creator (v 4.11) press button "Add Qt Sources" in Tools > Options > Debugger > General and select Qt sources file. Qt5 should be installed by online installer with checked "Qt Debug Information files".
If you look into the tooltips, you will see references to /Users/qt/work
, the Mac deployed debug symbols are pointing there. Of course, this is not documented, as these folks want you to buy enterprise.
If you create the /Users/qt/work
directory (as root), then make a soft link to your source directory named qt, everything will work. No need to build anything from source (under Mac that would result in tens of gigs wasted). Same considerations about plugins
Example:
sudo -s
mkdir /Users/qt
cd /Users/qt
mkdir work
cd work
ln -s /Users/your_user_name/Qt/your_qt_release/Src qt
Everything will work. Any source mapping failed here, so leave those alone. Hope this helps