KWin/Debugging: Difference between revisions
Created page with "= Debug & log KWin (or any process) via gdb = While interacting with gdb, the debugged process is stopped - that's of course nasty if the debugged process is what paints what ..." |
Add kwin diagnosis dbus info and QT_LOGGING_RULES info |
||
Line 44: | Line 44: | ||
detach | detach | ||
quit</nowiki>}} | quit</nowiki>}} | ||
= Getting diagnosis information = | |||
The following command retrieves internal diagnosis from a running KWin instance : | |||
{{Input|1=<nowiki>qdbus org.kde.KWin /KWin supportInformation</nowiki>}} | |||
= Getting debug log output = | |||
The environment variable QT_LOGGING_RULES can be used to turn on full debug output from kwin : | |||
{{Input|1=<nowiki>export QT_LOGGING_RULES="kwin_*.debug=true"</nowiki>}} | |||
The logs in X are at {{Input|1=<nowiki>~/.xsession-errors</nowiki>}} | |||
The logs in Wayland are in {{Input|1=<nowiki>~/.local/share/sddm/wayland-session.log</nowiki>}} |
Revision as of 09:29, 22 October 2019
Debug & log KWin (or any process) via gdb
While interacting with gdb, the debugged process is stopped - that's of course nasty if the debugged process is what paints what you see. Therefore it's inevitable to debug KWin from a side-channel, eg. another VT or via ssh - depending on what's available on your system.
NOTICE that debugging from a ssh login is generally preferable, since it doesn't impact the framebuffer/scanout buffer state.
gdb says "ptrace: Operation not permitted."
This is a security feature in "newer" linux kernels - you must explicitly allow gdb to attach to a non-inferior process:
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
Do I have to write down the debug output by hand ????
No ;-)
You just copy the gdb output into a file.
gdb --pid `pidof kwin_x11` 2>&1 | tee kwin.gdb
I don't know nothing about gdb, how do I obtain a stacktrace?
After attaching to the process, you likely want to cause a certain condition (halt or crash) - in that case you first need to
continue
the process.
If kwin does not crash, but you want to inspect the stack at some other time, you firt need to interrupt the process, press
Ctrl+C
To dump a stacktrace, issue
bt
then hit the
Enter
key until you reach the end of the stack.
Sometimes, you may want to see what's in another thread
thread 2 bt thread 3 bt
Finally, to leave gdb thread 2
detach quit
Getting diagnosis information
The following command retrieves internal diagnosis from a running KWin instance :
qdbus org.kde.KWin /KWin supportInformation
Getting debug log output
The environment variable QT_LOGGING_RULES can be used to turn on full debug output from kwin :
export QT_LOGGING_RULES="kwin_*.debug=true"
The logs in X are at
~/.xsession-errors
The logs in Wayland are in
~/.local/share/sddm/wayland-session.log