Guidelines and HOWTOs/Debugging/KCM: Difference between revisions

From KDE Community Wiki
(Add screen recording version)
 
Line 1: Line 1:
A screen recording version is available https://www.youtube.com/watch?v=wDadi_wB_Es
== Open a System Settings module (KCM) from your Linux OS ==
== Open a System Settings module (KCM) from your Linux OS ==



Latest revision as of 18:24, 5 February 2023

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

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

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 .

Build the KCM using Qt Creator.

Since Qt Creator does not run make install. The file kcm_networkmanagement.so will not be copied/installed to the directory ~/kde/usr/lib/. You can e.g. create a symlink:

rm -rf ~/kde/usr/lib/x86_64-linux-gnu/plugins/plasma/kcms/systemsettings_qwidgets/kcm_networkmanagement.so
ln -s ~/kde/build/plasma-nm/bin/plasma/kcms/systemsettings_qwidgets/kcm_networkmanagement.so ~/kde/usr/lib/x86_64-linux-gnu/plugins/plasma/kcms/systemsettings_qwidgets/kcm_networkmanagement.so

Now you can start Qt Creator IDE's debugger. The debugger will stop at the first breakpoint at line ~/kde/src/plasma-nm/kcm/kcm.cpp:58.