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

    Hi,

    I'm having problems with debugging stuff in qt creator.

    I write a simple test app:
    Qt Code:
    1. int main(int argc, char** argv)
    2. {
    3. QApplication app(argc, argv);
    4. QLabel* lol = new QLabel("test");
    5. lol->show();
    6. return app.exec();
    7. }
    To copy to clipboard, switch view to plain text mode 

    Then I set a breakpoint on any of the lines (or even on all lines) and run the debugger. It skips right through all the breakpoints and enters the main loop. If I then pause the execution and look at the stack trace, it shows the main function is at line 0 and is grayed out, like this: http://i.imgur.com/3EZ3g.png . Double clicking it takes me to the assembly view.

    What's going on?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 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

    Hard to say without any additional info. You may look at the output from Creator to see if there aren't any warnings related to the debugger.
    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.


  3. #3
    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?

  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

    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.

  5. #5
    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?

  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: 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.

  7. #7
    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.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 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.


  9. #9
    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?

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 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.


  11. #11
    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".

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 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.


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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.