Results 1 to 9 of 9

Thread: How to debug with release libaries?

  1. #1
    Join Date
    Aug 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default How to debug with release libaries?

    Hello!
    I want to speed up debuger start, and reduce memory consumption when I debug my applications. So, I want compile my program in debug mode, but when Qt Creator start debuger I want force it to load release Qt dlls instead debug dlls.

    How to do that with Qt Creatort???

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to debug with release libaries?

    I guess from reading your post you have two versions of Qt installed. One with debugging symbols, and one without?

    If so, go to your configuration panel (projects button on the left) in Qt Creator, select the "debug" profile and see which qt version is used to link your program. If the qt library with debugging symbols is used, change it to the one without debugging symbols.

  3. #3
    Join Date
    Aug 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Arrow Re: How to debug with release libaries?

    Thank you for your reply.

    I use Qt SDK 2010.04 for Windows. And in QtCreator->Projects i can choose Qt version, but in combo I have only two options:
    1. Qt in path
    2. 4.6.3
    But above of this I have combo "build configuration" with four options:
    1. Qt in path debug
    2. Qt in path release
    3. 4.6.3 debug
    4. 4.6.3 release
    I use this combo to swich between debug and reelase mode (I use only "Qt in path" options).

    I can't find way to choose option "compile program in debug" and "use Qt release".

  4. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to debug with release libaries?

    Quote Originally Posted by jmj View Post
    I can't find way to choose option "compile program in debug" and "use Qt release".
    That won't be possible, you need to have "debugging information" in both your application (witch use the library) and the library itself (or release configuration again for both).

    But you can use the debugger on the "release" build of your application, just that it doesn't contain so mutch "debugging information" and it contains the optimisations.

  5. #5
    Join Date
    Aug 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: How to debug with release libaries?

    I was thinking that it is possible when I read answer for bug:

    http://bugreports.qt.nokia.com/brows...s:all-tabpanel

    That bug report debug memory consumption, and (as far as I understood) they claims that it is possible... But maybe I don't fully understand them.

  6. #6
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to debug with release libaries?

    You can perfectly debug applications and libraries without debugging information (symbols). BUT!!! It will be very difficult as you don't see what is what at first sight.

    You also do not need a debug version of Qt to be able to debug your own program.

    If you want to have a lot of information, compile everything with the -g option (even Qt), but this will result in a lot of disk space being used and slower compile times (Webkit with the -g option is a pain to link because of its size). But it will give you a very clear picture when tracing (like backtraces).

    How the memory consumption in that bug report was measured is unknown to me though.

  7. #7
    Join Date
    Aug 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to debug with release libaries?

    @tbscope
    Thanks for your reply. But you do not answer how I can compile my program with debug informations but run it with Qt release libraries under Qt Creator? - This is my problem posted in this thread.

  8. #8
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to debug with release libaries?

    1. Open your project in Qt Creator
    2. Go to the projects page (it's the fourth button from the top on the left side of the window)
    3. Select the debug configuration
    4. In the build settings, you can see which Qt version is used. For me that is, for the project I have open, "Default Qt Version (Qt in PATH)"
    Here you want to change it to a non debug version of Qt. To do this, click on show details, and then select the version you want.
    5. When you now compile your program, you have a debug version of your program using a non debug version of Qt. As noted several times above, this might not be the preference since backtraces get more abstract.


    Now, if you want all the information, use the -g flag.
    Alter your .pro file and add the following line

    Qt Code:
    1. QMAKE_CXXFLAGS += -g
    To copy to clipboard, switch view to plain text mode 
    This last line is especially useful when using dtrace or systemtap since you can just monitor variables by their actual name etc...

  9. #9
    Join Date
    Aug 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to debug with release libaries?

    Quote Originally Posted by tbscope View Post
    4. In the build settings, you can see which Qt version is used. For me that is, for the project I have open, "Default Qt Version (Qt in PATH)"
    Here you want to change it to a non debug version of Qt. To do this, click on show details, and then select the version you want.
    I am a little confused... I found "Qt version" combo in "Build settings" but it have only two options: "Qt in PATH" and "4.6.3" which are perfectly the same (because former is searched in PATH and later was written in configuration by Qt SDK instaler). So I haven't option "Qt in PATH Debug" which should be.
    Even worst: I don't known whether "Qt in PATH" and "4.6.3" mind "Debug" or "Release"???
    I think this is very weird...


    Quote Originally Posted by tbscope View Post
    Now, if you want all the information, use the -g flag.
    Do you mind all debug information for my program? (Not for Qt library - I am not intend to compile Qt library)

Similar Threads

  1. Qt Creator How to set .pro file about debug and release
    By yycking in forum Qt Tools
    Replies: 2
    Last Post: 28th February 2011, 18:28
  2. Debug or Release mode in MAC
    By ssaa in forum Installation and Deployment
    Replies: 6
    Last Post: 9th March 2010, 05:15
  3. Replies: 3
    Last Post: 3rd December 2009, 16:12
  4. Why not on release but debug
    By baray98 in forum Qt Programming
    Replies: 6
    Last Post: 10th August 2007, 09:08
  5. Debug and Release
    By paranoid_android in forum Qt Programming
    Replies: 5
    Last Post: 18th November 2006, 13:58

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.