Bug 407065 - Debugging silently does not work without CMAKE_BUILD_TYPE=DEBUG
Summary: Debugging silently does not work without CMAKE_BUILD_TYPE=DEBUG
Status: REPORTED
Alias: None
Product: kdevelop
Classification: Applications
Component: CPP Debugger (show other bugs)
Version: 5.3.2
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-29 19:10 UTC by Alexander Potashev
Modified: 2020-08-06 20:42 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
screenshot1 (31.37 KB, image/png)
2019-04-29 19:37 UTC, Alexander Potashev
Details
screenshot2 (79.13 KB, image/png)
2019-04-29 19:38 UTC, Alexander Potashev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Potashev 2019-04-29 19:10:23 UTC
SUMMARY
Debugging silently does not work without CMAKE_BUILD_TYPE=DEBUG.

I had to manually set CMAKE_BUILD_TYPE=DEBUG in build/CMakeCache.txt to make debugging work. Before this change, when clicking "Start Debugging" in KDevelop it would start my application, but the breakpoints didn't work and I didn't receive any error messages from KDevelop which was very confusing.

Please either
 1. Automatically set CMAKE_BUILD_TYPE=DEBUG when starting debugging, or
 2. When clicking "Debug", inform the user that it won't work properly and tell them how to fix it manually.

STEPS TO REPRODUCE
1. Open a source tree in KDevelop as a new project. Use the suggested build path "<project-dir>/build/"
2. Add a run target for an application in the project.
3. Set some breakpoints that will definitely be triggered on application start.
4. Click "Debug".

OBSERVED RESULT
The application runs and is never stopped at the breakpoints. Notice the empty "CMAKE_BUILD_TYPE:STRING=" in build/CMakeCache.txt.

EXPECTED RESULT
Breakpoints should work out-of-the-box.

SOFTWARE/OS VERSIONS
Операционная система: Fedora 29
Версия KDE Plasma: 5.14.5
Версия Qt: 5.11.3
Версия KDE Frameworks: 5.55.0
Версия ядра: 5.0.6-200.fc29.x86_64
Архитектура: 64-битная
Comment 1 Juraj 2019-04-29 19:13:35 UTC
What is your project build type ?
Comment 2 Alexander Potashev 2019-04-29 19:20:34 UTC
(In reply to Juraj from comment #1)
> What is your project build type ?

I don't know. How do I find it out?
Comment 3 Juraj 2019-04-29 19:29:52 UTC
You should be able to set it during project creation.
Or if I am not wrong you can find it in project coniguration.

Menu > Project > Open Configuration... > CMake > Show Advanced > Build Type:
Comment 4 Alexander Potashev 2019-04-29 19:37:40 UTC
On project creation, it was set to the default value "Debug". Still build/CMakeCache.txt has this variable empty: "CMAKE_BUILD_TYPE:STRING="
Comment 5 Alexander Potashev 2019-04-29 19:37:53 UTC
Created attachment 119725 [details]
screenshot1
Comment 6 Alexander Potashev 2019-04-29 19:38:10 UTC
Created attachment 119726 [details]
screenshot2
Comment 7 Luís Henrique Camargo Quiroz 2020-08-06 20:42:09 UTC
This still happens with KDevelop 5.5.2 (on Debian testing). 
For a new and very small project the default configuration is "debug" but the compilation is not the debug one. I missed lots of time trying to check if I had configured KDevelop or the launch in wrong ways, even checked in other machines (where I had to do install, etc). Only when I decided to create a new configuration as "release" and compiled the project I saw that the executables, debug and release ones, are the same! And, after that, when I compiled again the debug version, then the executable was bigger and really with debug information, and the breakpoints started to work as they should. After... a day of work :(



Steps to reproduce:
  1 - Create a new project, for instance in the category Standard and type terminal;
  2 - I opted not to use a version control system;
  3 - A sample/initial main.c appears, I will use it (a "Hello, World!" classic)
  4 - configure a launch for the debug
  5 - put a breakpoint in the line that will print the "Hello, World!"
  6 - start the debug session

Observed result
The program runs and finishes, without regard to the breakpoint
However, if I create a new configuration for the project (Project/Open configuration...) of any type (debug or release) then the initial configuration will bbe compiled as a debug version.

FIX
I noticed, while writing here in the debug tracker, that if I had selected Project/Configure the selection after the initial project was created, then the compilation will be correct, with debug information, and breakpoints work