]> git.sur5r.net Git - i3/i3/blob - docs/debugging
Merge pull request #1693 from mh21/wm-class-garbage-no-copy
[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 http://code.i3wm.org/i3/commit/?h=next and see if
36 the line "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 Please note that log files may contain sensitive data such as window titles.
97 The best way to avoid submitting such information is to only run the necessary
98 applications to reproduce the behavior when saving the log file. This will also
99 make analyzing the log file easier.
100
101 No matter whether i3 misbehaved in some way without crashing or whether it just
102 crashed, the logfile provides all information necessary to debug the problem.
103
104 To upload a compressed version of the logfile (for a bugreport), use:
105 ------------------------------------------------------------------------------
106 DISPLAY=:0 i3-dump-log | bzip2 -c | curl --data-binary @- http://logs.i3wm.org
107 ------------------------------------------------------------------------------
108
109 This command does not depend on i3 (it also works while i3 displays
110 the crash dialog), but it requires a working X11 connection.
111
112 After running it, you will get a URL to the logfile. Please include that URL in
113 your bug report.
114
115 == On crashes: Obtaining a backtrace
116
117 When i3 crashes, it will display a dialog stating “i3 just crashed”, offering
118 you to save a backtrace to a text file.
119
120 To actually get useful backtraces, you should make sure that your version of i3
121 is compiled with debug symbols:
122
123 ------------------------------------------------------------------------------
124 $ file `which i3`
125 /usr/bin/i3: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically
126 linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
127 ------------------------------------------------------------------------------
128
129 Notice the +not stripped+, which is the important part. If you have a version
130 which is stripped, please check whether your distribution provides debug
131 symbols (package +i3-wm-dbg+ on Debian for example) or if you can turn off
132 stripping. If nothing helps, please build i3 from source.
133
134 Once you have made sure that your i3 is compiled with debug symbols and the C
135 debugger +gdb+ is installed on your machine, you can let i3 generate a
136 backtrace in the crash dialog.
137
138 After pressing "b" in the crash dialog, you will get a file called
139 +/tmp/i3-backtrace.%d.%d.txt+ where the first +%d+ is replaced by i3’s process
140 id (PID) and the second one is incremented each time you generate a backtrace,
141 starting at 0.
142
143 == Sending bug reports/debugging on IRC
144
145 When sending bug reports, please attach the *whole* log file. Even if you think
146 you found the section which clearly highlights the problem, additional
147 information might be necessary to completely diagnose the problem.
148
149 When debugging with us in IRC, be prepared to use a so called nopaste service
150 such as http://nopaste.info or http://pastebin.com because pasting large
151 amounts of text in IRC sometimes leads to incomplete lines (servers have line
152 length limitations) or flood kicks.
153
154 == Debugging i3bar
155
156 To debug i3bar problems, add +verbose yes+ to all +bar {}+ blocks in your i3 config
157 and then restart all i3bar instances like this:
158
159 ---------------------------------------------------------------------
160 $ killall i3bar
161 $ for c in $(i3-msg -t get_bar_config | python -c \
162       'import json,sys;print("\n".join(json.load(sys.stdin)))'); do \
163     (i3bar --bar_id=$c >i3bar.$c.log 2>&1) & \
164   done;
165 ---------------------------------------------------------------------
166
167 There will now be +i3bar.*.log+ files in your current directory that you can provide
168 in your bug report.