Results 1 to 17 of 17

Thread: qt creator - breakpoints don't work

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qt creator - breakpoints don't work

    I've kind of tracked down the issue - qtcreator doesn't add -g option to CFLAGS when building in debug mode. In fact it doesn't add any optimization options when building in release mode either...

    Here's a build line in debug mode:
    Qt Code:
    1. g++ -c -pipe -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp
    To copy to clipboard, switch view to plain text mode 

    ant this is in release mode:
    Qt Code:
    1. g++ -c -pipe -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp
    To copy to clipboard, switch view to plain text mode 

    The only difference is -DQT_NO_DEBUG.

    I clearly remember, that this stuff used to work in the past. What could have happened that broke it?

  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: qt creator - breakpoints don't work

    As a side note, and one I did encounter.
    Do not use-o optimisation and -g dwarf information at the same time.

    Some breakpoints will fail because the code is optimised.
    A debugger making use of the dwarf information will not report the correct line numbers. It will report line numbers of the optimised code.

  3. #3
    Join Date
    May 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qt creator - breakpoints don't work

    Oddly, I rebuilt qt-core (I'm on Gentoo) without optimized-qmake and it started including -g in debug mode, but still is not doing any optimizations in release mode.

    I did some snooping around and found the file /usr/share/qt4/mkspecs/common/g++.conf. There I found the lines:
    Qt Code:
    1. QMAKE_CFLAGS_RELEASE +=
    2. QMAKE_CFLAGS_DEBUG += -g
    To copy to clipboard, switch view to plain text mode 

    Should the first line be empty?

  4. #4
    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: qt creator - breakpoints don't work

    Did you recently change /etc/make.conf ?
    On my system it contains the CXX_FLAGS (or something like that) environment variable.

    Edit: note that optimisation isn't always wanted, so you should set the level yourself.

  5. #5
    Join Date
    May 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qt creator - breakpoints don't work

    No, I didn't change /etc/make.conf C(XX)FLAGS lately. It's set to:
    Qt Code:
    1. CFLAGS="-O2 -march=core2 -msse3 -mssse3 -msse4.1 -pipe -g"
    2. CXXFLAGS="${CFLAGS}"
    To copy to clipboard, switch view to plain text mode 

    I also remember, that in the past the release mode used some or all of these flags.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt creator - breakpoints don't work

    I don't think qmake takes /etc/make.conf into consideration when generating the Makefile. It should work solely based upon $QTDIR/mkspecs/*.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    May 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qt creator - breakpoints don't work

    Well then, should the QMAKE_CFLAGS_RELEASE variable be empty?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt creator - breakpoints don't work

    I think you should care more about QMAKE_CXXFLAGS and family.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    May 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qt creator - breakpoints don't work

    Quote Originally Posted by wysota View Post
    I think you should care more about QMAKE_CXXFLAGS and family.
    This one's set to just "-pipe".

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt creator - breakpoints don't work

    What about QMAKE_CXXFLAGS_DEBUG and others like it?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    May 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qt creator - breakpoints don't work

    Here are all the defaults:
    Qt Code:
    1. QMAKE_CC = gcc
    2. QMAKE_CFLAGS += -pipe
    3. QMAKE_CFLAGS_DEPS += -M
    4. QMAKE_CFLAGS_WARN_ON += -Wall -W
    5. QMAKE_CFLAGS_WARN_OFF += -w
    6. QMAKE_CFLAGS_RELEASE +=
    7. QMAKE_CFLAGS_DEBUG += -g
    8. QMAKE_CFLAGS_SHLIB += -fPIC
    9. QMAKE_CFLAGS_STATIC_LIB += -fPIC
    10. QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses
    11. QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden
    12. QMAKE_CFLAGS_PRECOMPILE += -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
    13. QMAKE_CFLAGS_USE_PRECOMPILE += -include ${QMAKE_PCH_OUTPUT_BASE}
    14.  
    15. QMAKE_CXX = g++
    16. QMAKE_CXXFLAGS += $$QMAKE_CFLAGS
    17. QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS
    18. QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON
    19. QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF
    20. QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
    21. QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG
    22. QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB
    23. QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB
    24. QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC
    25. QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
    26. QMAKE_CXXFLAGS_PRECOMPILE += -x c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
    27. QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
    To copy to clipboard, switch view to plain text mode 

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qt creator - breakpoints don't work

    Looks fine to me. According to this -g should be in debug mode and not in release mode. My qmake gives me -g in release mode as well (it might be platform dependent, I'm using 'linux-g++' platform) but it's more important that it's there for debug. If -g is missing from your debug makefile, then obviously something had to remove it - maybe you are using some 3rd party addition that introduces such effect.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #13
    Join Date
    May 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qt creator - breakpoints don't work

    I'm not saying -g should be in the release mode. I'm saying that at least -O2 should be in the release mode. Am I not right?

    I just want to know if some optimization flags are SUPPOSED to be there or is it up to the distribution's maintainers. Or maybe it's supposed to be empty after all?

    -g was missing from debug, but then I rebuilt qt-core and it popped back. Weird, but it happens, this problem is solved now. I just want to know about the release thing and I'll be gone
    Last edited by pmitas; 8th September 2010 at 10:33.

Similar Threads

  1. Breakpoints set at a slot will not stop?
    By MorrisLiang in forum Newbie
    Replies: 7
    Last Post: 19th May 2010, 16:18
  2. Replies: 2
    Last Post: 13th December 2009, 20:27
  3. Qt Creator doesn't stop at breakpoints
    By TheSaw in forum Qt Tools
    Replies: 3
    Last Post: 12th May 2009, 15:53
  4. Replies: 0
    Last Post: 18th March 2009, 11:56
  5. Replies: 3
    Last Post: 15th January 2008, 12:11

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
  •  
Qt is a trademark of The Qt Company.