]> git.sur5r.net Git - i3/i3/blob - docs/debugging
Add an i3bar flag: --verbose
[i3/i3] / docs / debugging
1 Debugging i3: How To
2 ====================
3 Michael Stapelberg <michael@i3wm.org>
4 January 2014
5
6 This document describes how to debug i3 to send us useful bug
7 reports, even if you have no knowledge of C programming.
8
9 Thank you for being interested in debugging i3. It really means
10 something to us to get your bug fixed. If you have any questions about the
11 process and/or need further help, do not hesitate to contact us!
12
13 == Verify you are using i3 ≥ 4.10
14
15 Only the latest major version of i3 is supported. To verify which version
16 you are running, use:
17
18 ---------------
19 $ i3 --moreversion 2>&- || i3 --version
20 Binary i3 version:  4.7 (2013-12-22, branch "tags/4.7")
21 Running i3 version: 4.7-84-gac74a63 (2014-01-01, branch "next") (pid 1995)
22 ---------------
23
24 Your version can look like this:
25
26 4.7 (release version)::
27 You are using a release version. In many cases, bugs are already
28 fixed in the development version of i3. Even if the bug is not a known fixed
29 one, we will still ask you to reproduce your error with the most recent
30 development version of i3. Therefore, please upgrade to a development version
31 if you can.
32
33 4.7-85-g9c15b95 (development version)::
34 Your version is 85 commits newer than 4.7, and the git revision of your
35 version is +9c15b95+. Go to https://github.com/i3/i3/commits/next and see if
36 the most recent commit starts with the same revision. If so, you are using the
37 latest version.
38
39 Development versions of i3 have logging enabled by default and are compiled
40 with debug symbols.
41
42 == Enabling logging
43
44 If you are using a development version (see previous section), you don’t need
45 to do anything -- skip to section 3.
46
47 If you are using a release version with a custom +~/.xsession+ (or xinitrc)
48 file, execute i3 with a line like this:
49
50 ----------------------------------
51 # Use 25 MiB of RAM for debug logs
52 exec i3 --shmlog-size=26214400
53 ----------------------------------
54
55 If you are *NOT* using an +~/.xsession+ file but you just chose "i3" from the
56 list of sessions in your desktop manager (gdm, lxdm, …), edit
57 +/usr/share/xsessions/i3.desktop+ and replace the +Exec=i3+ line with:
58
59 ------------------------------
60 Exec=i3 --shmlog-size=26214400
61 ------------------------------
62
63 If you cannot restart i3 for some reason, you can enable debug logging on the
64 fly:
65
66 ---------------------------------------
67 i3-msg 'debuglog on; shmlog on; reload'
68 ---------------------------------------
69
70 == Reproducing the problem
71
72 Before submitting an issue, please make sure to close down on the problem as
73 much as you can yourself. Here are some steps you should consider:
74
75 * Find a deterministic, reliable way to reproduce the problem and provide it
76   with your bug report.
77 * Try using the default i3 config to reproduce the problem. If the issue does
78   not appear with the default config, gradually adapt it to track down what 
79   change(s) to the config introduce the problem.
80 * Reproduce the problem with a minimal setup, i.e., only use as few applications,
81   windows and steps as necessary.
82 * In addition, try to stick to applications that are common and, even more
83   importantly, free / open source.
84 * Before obtaining the log file, restart i3 in-place, execute the steps to
85   reproduce the problem and then save the logs. This keeps the log file as
86   small as possible and necessary.
87
88 Please be aware that we cannot support compatibility issues with closed-source
89 software, as digging into compatibility problems without having access to the
90 source code is too time-consuming. Additionally, experience has shown that
91 often, the software in question is responsible for the issue. Please raise an
92 issue with the software in question, not i3.
93
94 == Obtaining the debug logfile
95
96 [CAUTION]
97 ================================================================================
98 Logs may contain sensitive information, so please inspect the log before
99 submitting it. Logs may be viewed by anyone, once posted. If you choose to
100 redact the log, make an effort not to discard information which may be relevant
101 to the issue you are reporting.
102
103 The best way to avoid submitting such information is to only run the necessary
104 steps to reproduce the behavior when saving the log file. This will also make
105 analyzing the log file easier.
106 ================================================================================
107
108 No matter whether i3 misbehaved in some way without crashing or whether it just
109 crashed, the logfile provides all information necessary to debug the problem.
110
111 To upload a compressed version of the logfile (for a bugreport), use:
112 -------------------------------------------------------------------------------
113 DISPLAY=:0 i3-dump-log | bzip2 -c | curl --data-binary @- https://logs.i3wm.org
114 -------------------------------------------------------------------------------
115
116 This command does not depend on i3 (it also works while i3 displays
117 the crash dialog), but it requires a working X11 connection.
118
119 After running it, you will get a URL to the logfile. Please include that URL in
120 your bug report.
121
122 == On crashes: Obtaining a backtrace
123
124 When i3 crashes, it will display a dialog stating “i3 just crashed”, offering
125 you to save a backtrace to a text file.
126
127 To actually get useful backtraces, you should make sure that your version of i3
128 is compiled with debug symbols:
129
130 ------------------------------------------------------------------------------
131 $ file `which i3`
132 /usr/bin/i3: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically
133 linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
134 ------------------------------------------------------------------------------
135
136 Notice the +not stripped+, which is the important part. If you have a version
137 which is stripped, please check whether your distribution provides debug
138 symbols (package +i3-wm-dbg+ on Debian for example) or if you can turn off
139 stripping. If nothing helps, please build i3 from source.
140
141 Once you have made sure that your i3 is compiled with debug symbols and the C
142 debugger +gdb+ is installed on your machine, you can let i3 generate a
143 backtrace in the crash dialog.
144
145 After pressing "b" in the crash dialog, you will get a file called
146 +/tmp/i3-backtrace.%d.%d.txt+ where the first +%d+ is replaced by i3’s process
147 id (PID) and the second one is incremented each time you generate a backtrace,
148 starting at 0.
149
150 == Sending bug reports/debugging on IRC
151
152 When sending bug reports, please attach the *whole* log file. Even if you think
153 you found the section which clearly highlights the problem, additional
154 information might be necessary to completely diagnose the problem.
155
156 When debugging with us in IRC, be prepared to use a so-called nopaste service
157 such as https://pastebin.com because pasting large amounts of text in IRC
158 sometimes leads to incomplete lines (servers have line length limitations) or
159 flood kicks.
160
161 == Debugging i3bar
162
163 To debug i3bar problems, use the +--verbose+ commandline parameter,
164 or add +verbose yes+ to all +bar {}+ blocks in your i3
165 config, reload your config and then restart all i3bar instances like this:
166
167 ---------------------------------------------------------------------
168 $ i3 reload
169 $ killall i3bar
170 $ for c in $(i3-msg -t get_bar_config | python -c \
171       'import json,sys;print("\n".join(json.load(sys.stdin)))'); do \
172     (i3bar --bar_id=$c >i3bar.$c.log 2>&1) & \
173   done;
174 ---------------------------------------------------------------------
175
176 There will now be +i3bar.*.log+ files in your current directory that you can provide
177 in your bug report.