Plasma/Debugging

From KDE Community Wiki
 
Under Construction
This is a new page, currently under construction!

Plasmashell debugging

This guide serves as a collection of useful resources for debugging plasmashell. As plasmashell controls essentially all widgets on your desktop, a faulty widget might be hard to spot at first sight. Likewise, any official widget issues should be reported to bugs.kde.org under the plasmashell product.

Check widgets dynamically

This procedure is useful for checking for memory leaks.

  • Open Konsole and press Meta+Right to tile it to the right.
  • Run journalctl /usr/bin/plasmashell and check whether any warnings or errors are present.
  • If there are, run journalctl /usr/bin/plasmashell -f 2> plasmashell.log to check logs in real time and paste it automatically into a log.
  • Open the default process manager based on KSysGuard by pressing Ctrl+Esc, then press Meta+Left to tile it to the left. Write plasmashell to filter it for easier visualization, or just select it. Take note of memory usage.
  • Click each individual widget on the panel and check if any warnings appear on Konsole as well as whether there is any change in memory usage on the process manager. If after closing a widget memory usage comes back to normal, it's fine. If this does not occur, this might indicate a memory leak, so check if it occurs repeatedly.
  • You should now have a file named plasmashell.log on your home folder that you may send to the devs together with your bug report over bugs.kde.org.

Simply opening a widget may not cause an increase in memory. If you want to verify this more thoroughly, click each individual action in that widget, or check each widget individually as shown in the next section.

You may also want to use this after you've determined a way to reproduce a crash in plasmashell caused by a widget. If so, run some debug tool such as gdb, valgrind, or strace.

Check widgets individually

  • Open Konsole
  • If the widget you want to check is system-wide, list all available system widgets with ls /usr/share/plasma/plasmoids/, then locate the widget you want to check.
  • If the widget you want to check was installed by you/is made by a third-party, list all available user widgets with ls .local/share/plasma/plasmoids/, then locate the widget you want to check. Remember that if an issue is found with a third-party widget, it should be reported to the original developer, not to the KDE developers.
  • You can use plasmawindowed (available by default on Plasma) or plasmoidviewer (made available in plasma-sdk) to run a widget individually. plasmawindowed runs the widget separately but as if running natively, plasmoidviewer is more developer-oriented and allows you to set positions and whatnot. For general debugging, plasmawindowed should suffice.
  • Run a debug tool such as gdb like so: gdb plasmawindowed

If any debug symbols are missing, gdb will tell you. Depending on your package manager it might even tell you what command to run in order to fetch the required debug symbols, in which case you should install such packages before continuing. Follow the instructions provided by your distribution for that.

  • Inside gdb, execute the command set logging on before anything else so a file named gdb.txt is created. Optionally, you may want to set logging file filename.txt to have a special filename for your log.
  • Then execute run org.kde.plasma.plasmoidname, utilizing the correct widget name you saw in the plasma/plasmoids folder. The widget should now run standalone with a few window controls (minimize, maximize, close) on top.

The run command inside gdb executes the application, and anything coming after run should be its arguments or options. Thus, it works analogously to plasmawindowed org.kde.plasma.plasmoidname, except gdb will log everything or most things you need.

  • Test as much as you want, then close the widget by clicking the close button.
  • Back to gdb, run bt to create the backtrace.
  • Finish by running quit.
  • You should now have a file named gdb.txt on your home folder that you may send to the devs together with your bug report over bugs.kde.org.