tags:

views:

798

answers:

3

I need to step through the Qt code to help solve a bug in my C++ application. I've downloaded qt-mac-opensource-src-4.5.2.tar from here and followed the install instructions that came with this:

  1. unpacked the file to /tmp.
  2. typed ./configure -debug.
  3. typed make.
  4. typed sudo make install.
  5. edited the PATH environment variable as instructed.
  6. set the DYLD_IMAGE_SUFFIX environment variable to _debug.

This installed Qt and my Qt application runs, but I still can't step into the Qt code.

I'm using Xcode 3.1.3 and tried changing the Executable Info to "use debug suffix when loading frameworks". This generated a lot of warnings like:

warning: Could not find object file "/private/tmp/qt-mac-opensource-src-4.5.2/src/corelib/.obj/debug-shared/qmalloc.o" - no debug information available for "global/qmalloc.cpp".

warning: Could not find object file "/private/tmp/qt-mac-opensource-src-4.5.2/src/corelib/.obj/debug-shared/qnumeric.o" - no debug information available for "global/qnumeric.cpp".

and also a lot of non-qt related warnings.

I'd shutdown the Macbook Pro overnight, which I can only assume clears the tmp directory as the unpacked file is no longer there.

I think I could fix it by rebuilding Qt without frameworks, but this is more of a work-around than a fix that will probably come back to bite me. I'm also a bit reluctant to do this, when each rebuild takes between 3 and 4 hours.

Alternatively, would downloading the binaries and debug libs work?

I'd be grateful for any suggestions on what I'm missing and how I address this.

Thanks.

+2  A: 

Have a look at this http://doc.trolltech.com/4.5/debug.html There is a section especially for debugging under MacOSX and Xcode... I guess you need to generate a makefile with debug option using qmake !

Matthieu
Thanks for your reply. As far as I understand, your suggestion to generate a makefile with debug options using qmake is relevant when Qt is installed as dylibs rather than frameworks. The framework equivalent is to set DYLD_IMAGE_SUFFIX, which I've tried.I've managed to now fix my bug without stepping through the code, and have raised an issue with Qt because it seems wrong that they suggest placing the very files that I need to step through the code in a temporary directory.I'll update this question if I find the solution. Thanks.
Robin
A: 

With the help of Qt support, I've now resolved this.

There were a couple of issues:

  • The Qt debug "make install" doesn't currently generate dSYM files for the _debug stuff. They've raised a bug about this. To get round this:

    4a. cd /usr/local/Trolltech/Qt-4.5.2/lib
    4b. Type /usr/bin/dsymutil -o QtGui.framework/QtGui_debug.dSYM QtGui.framework/Versions/4/QtGui_debug
    4c. Repeat for each Qt framework.

  • The tmp directory does indeed get wiped on each reboot. To get round this:

    7- Copy the entire contents of /tmp/qt-mac-opensource-src-4.5.2 to a new directory ~/Qt .

I also added both the frameworks and source code to the Xcode project.

Robin
+1  A: 

In OS X 10.6 and 10.6.1, setting DYLD_IMAGE_SUFFIX to _debug will cause problems. Hopefully this will be addressed by a future update of OS X 10.6.

Wim Leers