Guidelines and HOWTOs/Debugging/KCM: Difference between revisions

From KDE Community Wiki
(Add chapter "Open a System Settings module (KCM) built using kdesrc-build")
(Add chapter "Debug KCM built using kdesrc-build in the IDE Qt Creator")
Line 25: Line 25:


See https://community.kde.org/Solid/Projects/ScreenManagement#Debugging_Information
See https://community.kde.org/Solid/Projects/ScreenManagement#Debugging_Information
=== Debug KCM built using kdesrc-build in the IDE Qt Creator ===
In Qt Creator, as per https://community.kde.org/Get_Involved/development/IDE_configuration/Qt_Creator I open the project "~/kde/src/plasma-nm".
I put a breakpoint on the line ~/kde/src/plasma-nm/kcm/kcm.cpp:58 in KCMNetworkmanagement ctor.
In the left hand bar "Switch to Projects mode Ctrl+5" > Build & Run > Imported kit > Run Run Settings > Run > Run configuration: > Add... > Custom Executable
Executable: /home/username/kde/usr/bin/kcmshell5
Command line arguments: kcm_networkmanagement
Run in terminal
I edit "Environment" as per https://community.kde.org/Get_Involved/development/IDE_configuration/Qt_Creator#If_Qt_Creator_fails_to_run_the_executable_correctly .
I build, I start the debugger. And Qt creator IDE's debugger stops at the correct breakpoint ~/kde/src/plasma-nm/kcm/kcm.cpp:58.

Revision as of 00:41, 12 January 2023

Open a System Settings module (KCM) from your Linux OS

which -a kcmshell5
kcmshell5 --help-all
kcmshell5 kcm_networkmanagement

Open a System Settings module (KCM) built using kdesrc-build

kdesrc-build plasma-nm kde-cli-tools
source ~/kde/build/plasma-nm/prefix.sh
which -a kcmshell5
kcmshell5 --help-all
kcmshell5 kcm_networkmanagement
# In a new terminal:
lsof | grep kcmshell5 |& tee ~/a.txt
kate ~/a.txt
# From the kate main menu > Tools > Highlighting > 3D > GLSL. For a random syntax highlighting.
# All KDE *.so files should come from ~/kde/usr. E.g. "/home/username/kde/usr/lib/x86_64-linux-gnu/plugins/imageformats/kimg_xcf.so".
# All KDE *.qml files should come from your Linux user's home directory (i.e. "~"). E.g. "/home/username/.cache/kcmshell5/qmlcache/20f578eeb7bf80e91733db06de9bc7f19f8b3a22.qmlc".
# All non KDE things including Qt should come from "/usr". E.g. "/usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so", "/usr/lib/x86_64-linux-gnu/qt5/qml/QtQuick/Controls/Styles/Desktop/ButtonStyle.qmlc", "/usr/lib/x86_64-linux-gnu/libdeflate.so.0".

See https://community.kde.org/Solid/Projects/ScreenManagement#Debugging_Information

Debug KCM built using kdesrc-build in the IDE Qt Creator

In Qt Creator, as per https://community.kde.org/Get_Involved/development/IDE_configuration/Qt_Creator I open the project "~/kde/src/plasma-nm".

I put a breakpoint on the line ~/kde/src/plasma-nm/kcm/kcm.cpp:58 in KCMNetworkmanagement ctor.

In the left hand bar "Switch to Projects mode Ctrl+5" > Build & Run > Imported kit > Run Run Settings > Run > Run configuration: > Add... > Custom Executable

Executable: /home/username/kde/usr/bin/kcmshell5

Command line arguments: kcm_networkmanagement

Run in terminal

I edit "Environment" as per https://community.kde.org/Get_Involved/development/IDE_configuration/Qt_Creator#If_Qt_Creator_fails_to_run_the_executable_correctly .

I build, I start the debugger. And Qt creator IDE's debugger stops at the correct breakpoint ~/kde/src/plasma-nm/kcm/kcm.cpp:58.