Skip to content
Dave Davenport edited this page Oct 4, 2019 · 10 revisions

Creating a backtrace.

First make sure you compile rofi with debug symbols:

make CFLAGS="-O0 -g3" clean rofi

Getting a backtrace using GDB is not very handy. Because if rofi get stuck, it grabs keyboard and mouse. So if it crashes in GDB you are stuck. The best way to go is to enable core file. (ulimit -c unlimited in bash) then make rofi crash. You can then load the core in GDB.

gdb rofi core

Then type inside gdb:

thread apply all bt

The output trace is useful when reporting crashes.

Timing traces

To get timing traces from rofi, we can compile it with the --enable-timings flag. This, when running, will create a rofi-timings.log file in the current working directory. This log file contains a trace of execution times, for example:

0.000002 (0.000000): Started
0.000075 (0.000075): main:651 
0.000140 (0.000065): main:674 
0.000144 (0.000004): main:678 
0,001009 (0,000865): main:693 Open Display
0,024048 (0,023039): main:793 Setup mainloop
0,024155 (0,000107): main:808 Startup Notification
0,024180 (0,000025): main:811 Setup abe
0,027631 (0,003451): main:848 X11 Setup 
0,027637 (0,000006): rofi_view_workers_initialize:1577 Setup Threadpool, start
0,027672 (0,000035): rofi_view_workers_initialize:1600 Setup Threadpool, done
0,027928 (0,000256): startup:531 Startup
0,047919 (0,019991): startup:545 Create Window
0,048059 (0,000140): startup:551 Parse ABE
0,048137 (0,000078): startup:556 Config sanity check
0,073299 (0,025162): get_apps:245 start
0,079653 (0,006354): get_apps:363 stop
0,079763 (0,000110): rofi_view_create:1333 
0,079765 (0,000002): rofi_view_create:1351 Startup notification
0,079875 (0,000110): rofi_view_create:1367 Grab keyboard
0,079878 (0,000003): rofi_view_create:1369 Get active monitor
0,085358 (0,005480): rofi_view_refilter:829 Filter start
0,085402 (0,000044): rofi_view_refilter:918 Filter done
0,085404 (0,000002): rofi_view_update:697 
0,086033 (0,000629): rofi_view_update:722 Background

The first column is the absolute time since start, the 2nd between () is the time since last trace point. Then the current function name and line number is listed, with an optional custom message.

The exact format can change at any time.

In the above log file it shows rofi starting in 86ms.

Debug domains

You can enable debug output for multiple parts in rofi using the glib debug framework. Debug domains can be enabled by setting the G_MESSAGES_DEBUG environment variable. At creation of this page the following debug domains exists:

  • all: Show debug information from all domains.
  • X11Helper: The X11 Helper functions.
  • View: The main rofi_view functions.
  • Widgets.Box: The Box widget.
  • Dialogs.DMenu: The dmenu dialog.
  • Dialogs.Run: The run dialog.
  • Dialogs.DRun: The desktop file run dialog.

TODO: Change naming dialogs to mode.

Example: G_MESSAGES_DEBUG=Dialogs.DRun rofi -show drun To get specific output from the Desktop file run dialog.

Clone this wiki locally