how to debug Qt sources on mac
-
Hi,
One thing I find surprising, why do you have the Qt frameworks deployed in your application bundle since you are currently developing your application ?
-
cuz otherwise the app doesn't run
-
It doesn't run from Qt Creator without the frameworks embedded ?
-
yes that is correct
i think what's going on there is that i'm linking to boost::threads and its dependencies (system and atomic), and
macdeployqt
magically manages all the necessaryinstall_name_tool -change
things even for my boost libraries, so i let it do its thing.I suppose for the debug release i could script those things myself? i haven't tried. but if it means i'll be able to use the debugger to step through Qt source code, then i'll have at it?
-
do you think this is the problem? that in the debugger, the qt frameworks are loading from my app bundle?
-
Since you ran
macdeployqt
and install_name_tools, you like have everything loaded from your application bundle rather than from your Qt installation.Note that you have the
-use-debug-libs
option formacdeploqt
that should help. -
okay so i eliminated macdeployqt from the equation, by manually calling install_name_tool on my boost libraries, and now the Qt libs are running from the Qt installation folder. yet i still can not debug (view or step through) the Qt Widgets or Core code:
-
anyone have any further hints? have i set things up correctly? is what i'm trying to do even POSSIBLE?
-
pretty please?
-
It looks like you are linked to the Qt release frameworks (QtCore.framework/Versions/5/QtCore), not the debug versions (QtCore.framework/Versions/5/QtCore_debug). When I am debugging in Xcode, I see the QtCore_debug filename, not QtCore.
I'm not sure how you fix this with Qt Creator. Are you actually debugging a debug build, with CONFIG = debug, not CONFIG = release?
-
I believe so yes, if this is what you mean:
now looking, i see i also have this line in my .pro file:
# this line makes qmake parse this file ONCE not three times CONFIG -= debug_and_release
-
and are we sure i have my "source path mappings" set right? what SHOULD that be set to?
-
@davecotter debug looks fine.
I poked around in Xcode and found that the source for QCoreApplication for example lived at /Users/qt/work/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp
So your source mapping looks correct. I added that source mapping in lldb inside Xcode, using
settings set target.source-map /Users/qt/work/qt /Users/hamish/dev/Qt5.12.4/5.12.4/Src
and Xcode displayed the Qt source OK.
-
your source mapping looks correct
well i provided two examples, so which one is correct? is it
clang_64/bin
or is itSrc
?how do i configure Qt Creator so that i can debug in Qt Creator debugger? I'm not directly using Xcode
-
@davecotter said in how to debug Qt sources on mac:
how do i configure Qt Creator so that i can debug in Qt Creator debugger? I'm not directly using Xcode
In the Run Settings you should tick the box that says "Use debug version of frameworks" or alternatively set the environment variable
DYLD_IMAGE_SUFFIX=_debug
.
See: https://doc.qt.io/qtcreator/creator-debugger-engines.html#debugging-tools-for-macos and https://doc.qt.io/qt-5/macos-issues.html#qt-libraries-as-frameworks -
i see no such "Use debug version of frameworks":
but setting the environment variable worked!!
-
@davecotter said in how to debug Qt sources on mac:
i see no such "Use debug version of frameworks":
I just checked: It seems to be there only for automatically added run configurations.
Yours is probably a Custom Executable run configuration which apparently doesn't have it.See also: https://doc.qt.io/qtcreator/creator-run-settings.html
but setting the environment variable worked!!
Good. Perhaps this topic could be marked as solved?