Fixed – KDevelop not stopping at breakpoints on Ubuntu Mate
I couldn’t get KDevelop to stop at breakpoints even on simple ‘hello world’ C++ projects. It appeared that CMAKE_BUILD_TYPE was being correctly set and GDB worked fine from the command-line, but from within kdevelop breakpoints were never respected! I think the problem stemmed from the Cache Value for CMAKE_BUILD_TYPE being empty, this value can be seen in the Project / Open Configuration… menu:
Following the advice from this post I added the following into the project’s CMakeLists.txt file:
# Set a default build type if none was specified if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "Setting build type to 'Debug' as none was specified.") set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif()
[Originally from here]
I ran clean & rebuild etc. and then cache value was set correctly to ‘Debug’ and the debugger happily stops at breakpoints!
I hope this post helps folks as I spent _ages_ trying to get the breakpoints to work!!