Jump to content

Get Involved/development/IDE configuration/KDevelop: Difference between revisions

From KDE Community Wiki
Nmariusp (talk | contribs)
Add screen recording version
Nmariusp (talk | contribs)
Use flat
Line 9: Line 9:
{{Input|1=<nowiki>
{{Input|1=<nowiki>
cmake-options -DCMAKE_BUILD_TYPE=Debug
cmake-options -DCMAKE_BUILD_TYPE=Debug
stop-on-failure false
directory-layout invent
</nowiki>}}
</nowiki>}}


Line 27: Line 25:
Start kdevelop. From the kdevelop main menu Session > make sure that you have a new/clean session. E.g. Delete Current Session...
Start kdevelop. From the kdevelop main menu Session > make sure that you have a new/clean session. E.g. Delete Current Session...


From kdevelop main menu > Project > Open/Import Project... Name: /home/n/kde/src/frameworks/bluez-qt/CMakeLists.txt > Next > Finish. If it asks to Override, override.
From kdevelop main menu > Project > Open/Import Project... Name: /home/n/kde/src/bluez-qt/CMakeLists.txt > Next > Finish. If it asks to Override, override.


A dialog is shown: Configure a Build Directory for bluez-qt. It will guess all of the values: Build directory: /home/n/kde/build/frameworks/bluez-qt. "Using an already created build directory.". Installation prefix: /home/n/kde/usr. Build type: Debug. CMake executable: /usr/bin/cmake. Press OK button.
A dialog is shown: Configure a Build Directory for bluez-qt. It will guess all of the values: Build directory: /home/n/kde/build/bluez-qt. "Using an already created build directory.". Installation prefix: /home/n/kde/usr. Build type: Debug. CMake executable: /usr/bin/cmake. Press OK button.


From kdevelop main menu > Window > Tool Views > Projects. Expand the treeview to one of the entrypoints (CMake targets). E.g. bluez-qt > autotests > managertest > managertest.cpp. The file "/home/n/kde/src/frameworks/bluez-qt/autotests/managertest.cpp" will be opened in the text editor view.
From kdevelop main menu > Window > Tool Views > Projects. Expand the treeview to one of the entrypoints (CMake targets). E.g. bluez-qt > autotests > managertest > managertest.cpp. The file "/home/n/kde/src/bluez-qt/autotests/managertest.cpp" will be opened in the text editor view.


Navigate to the method "bluezNotRunningTest()", put a breakpoint on the line with "{" (the opening curly bracket of the method). Right click on the line > Toggle Breakpoint.
Navigate to the method "bluezNotRunningTest()", put a breakpoint on the line with "{" (the opening curly bracket of the method). Right click on the line > Toggle Breakpoint.

Revision as of 18:14, 30 December 2022

KDevelop is an IDE from KDE.

A screen recording version is available https://www.youtube.com/watch?v=LcSfUNrd3S4

kdesrc-build

Make sure kdesrc-build works correctly. Make sure ~/.config/kdesrc-buildrc contains the lines:

cmake-options -DCMAKE_BUILD_TYPE=Debug

Using kdesrc-build build a module. E.g.

kdesrc-build bluez-qt

KDevelop

E.g. on Kubuntu 22.04.

apt install kdevelop clazy heaptrack

Start kdevelop. From the kdevelop main menu Session > make sure that you have a new/clean session. E.g. Delete Current Session...

From kdevelop main menu > Project > Open/Import Project... Name: /home/n/kde/src/bluez-qt/CMakeLists.txt > Next > Finish. If it asks to Override, override.

A dialog is shown: Configure a Build Directory for bluez-qt. It will guess all of the values: Build directory: /home/n/kde/build/bluez-qt. "Using an already created build directory.". Installation prefix: /home/n/kde/usr. Build type: Debug. CMake executable: /usr/bin/cmake. Press OK button.

From kdevelop main menu > Window > Tool Views > Projects. Expand the treeview to one of the entrypoints (CMake targets). E.g. bluez-qt > autotests > managertest > managertest.cpp. The file "/home/n/kde/src/bluez-qt/autotests/managertest.cpp" will be opened in the text editor view.

Navigate to the method "bluezNotRunningTest()", put a breakpoint on the line with "{" (the opening curly bracket of the method). Right click on the line > Toggle Breakpoint.

In Projects view, right click on the CMake target "managertest" > Debug As... > Compiled Binary.

An error will be shown "Could not start debugger. Could not run 'lldb-mi'. Make sure that the path name is specified correctly.". From kdevelop main menu > Settings > Configure KDevelop... > Plugins > Debugging > uncheck "LLDB Support" > OK.

Navigate to method "bluezNotRunningTest()", put a breakpoint on the line with "{" (the opening curly bracket of the method). Right click on the line > Toggle Breakpoint.

In Projects view, right click on the CMake target "managertest" > Debug As... > Compiled Binary.

The debugger starts and breaks on the first line of C++ source code after the breakpoint. From the main menu > Run > Step Over (F10)/Step Into (F11)/Step Out (F12).