Guidelines and HOWTOs/Gammaray: Difference between revisions

From KDE Community Wiki
No edit summary
(kernel.yama.ptrace_scope = 0)
Line 27: Line 27:
See https://github.com/KDAB/GammaRay/wiki/Known-Issues for troubleshooting</pre>
See https://github.com/KDAB/GammaRay/wiki/Known-Issues for troubleshooting</pre>


As per https://github.com/KDAB/GammaRay/wiki/Known-Issues#gdb-method-fails-to-attach-to-running-process
As per https://github.com/KDAB/GammaRay/wiki/Known-Issues#gdb-method-fails-to-attach-to-running-process run:
 
<pre>
sudo cp /etc/sysctl.d/10-ptrace.conf /etc/sysctl.d/10-ptrace.conf~orig
sudo nano /etc/sysctl.d/10-ptrace.conf
</pre>
Replace:
<pre>kernel.yama.ptrace_scope = 1</pre>
with:
<pre>kernel.yama.ptrace_scope = 0</pre>
Then, reboot your computer.

Revision as of 20:35, 23 May 2024

KDAB GammaRay is a GUI app that allows you to inspect a running GUI app that uses Qt widgets or Qt QML. See https://github.com/KDAB/GammaRay and https://www.kdab.com/gammaray .

A video version is available https://www.youtube.com/watch?v=W6dVfn1nAzI

Both gammaray and the app that you want to inspect should use the exact same version of Qt. E.g. install both gammaray and the app that you want to inspect from your Linux OS' packages. If you have built Qt using kdesrc-build or if you have installed Qt using the app "Qt online installer", you should build gammaray using kdesrc-build.

E.g. we have built using kdesrc-build Qt6, kcalc and gammaray. We run in Konsole tab:

kdesrc-build --run kcalc

In another Konsole tab:

source ~/kde/build/kconfig/prefix.sh
gammaray

The window "GammaRay Launcher" is shown. From the "Attach" tab, select "/home/user/kde/usr/bin/kcalc".

At this point, gammaray might fail to connect to the process kcalc and show the error dialog:

Launcher Error
gdb: Yama security extension is blocking runtime attaching, see /proc/sys/kernel/yama/ptrace_scope
lldb: The debugger executable 'lldb' could not be found
Uh-oh, there is no default attach injector on this platform.
See https://github.com/KDAB/GammaRay/wiki/Known-Issues for troubleshooting

As per https://github.com/KDAB/GammaRay/wiki/Known-Issues#gdb-method-fails-to-attach-to-running-process run:

sudo cp /etc/sysctl.d/10-ptrace.conf /etc/sysctl.d/10-ptrace.conf~orig
sudo nano /etc/sysctl.d/10-ptrace.conf

Replace:

kernel.yama.ptrace_scope = 1

with:

kernel.yama.ptrace_scope = 0

Then, reboot your computer.