[SOLVED] Breakpoints are not getting hit, not working in Qt creator.
-
Hi,
I am working on application.The build is successful. On clicking debug button application launches but breakpoints don't get hit, breakpoints aren't working. I tried this scenario on 3 machines. 2 opensuse 13.1 machines & 1 Mac 10.10. Everywhere on debugging, application is launched but breakpoints aren't working.My Qt details:
Qt creator 3.3.1
Based on Qt 5.4.1 (GCC 4.6.1, 64 bit)
Built on Feb 20 2015Machine details:
Linux linux-s17i 3.11.6-4-desktop #1 SMP PREEMPT Wed Oct 30 18:04:56 UTC 2013 (e6d4a27) x86_64 x86_64 x86_64 GNU/LinuxGNU gdb (GDB; openSUSE 13.1) 7.6.50.20130731-cvs
-
This might be extremelly basic, but are you sure you are working on Debug, and not on Release?
If you place breakpoints, and then click the Debug Button, while working on Release, the breakpoints wont work, and Qt wont give you any warning at all. -
@darkp03 Later I installed Netbeans latest version & it built successfully & I was also able to debug also!! . But Netbeans can't recognize QString & shows it as some structure which is unreadable :(
I uninstalled & reinstalled gdb, but still in debug mode, Qt creator breakpoints won't hit. I checked all cmakelists.txt & cmake files, everything is correct. No success still.
-
SET(CMAKE_BUILD_TYPE Debug) added this line to CMakeLists.txt and now I am able to debug now. Breakpoints are getting hit properly :)
or you can simply give cmake command cmake -DCMAKE_BUILD_TYPE=Debug
But, how were Netbeans' breakpoint getting hit without the above command still bothers me. Anyways thanks.
-
If you have code that benefits significantly from compiler optimizations, you might want to try to compile in 'release with debug info' instead:
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo
As @darkp03 mentioned, make sure you are pressing QtCreator's 'debug button' (or shortcut key F5) and not the 'run' button.
1/5