]> git.sur5r.net Git - i3/i3.github.io/blob - docs/4.0/debugging.html
Merge pull request #64 from ultrabug/master
[i3/i3.github.io] / docs / 4.0 / debugging.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"\r
2     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
4 <head>\r
5 <link rel="icon" type="image/png" href="/favicon.png">\r
6 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />\r
7 <meta name="generator" content="AsciiDoc 8.6.4" />\r
8 <title>i3: Debugging i3: How To</title>\r
9 <link rel="stylesheet" href="/css/style.css" type="text/css" />\r
10 <link rel="stylesheet" href="/css/xhtml11.css" type="text/css" />\r
11 <script type="text/javascript">\r
12 /*<![CDATA[*/\r
13 window.onload = function(){asciidoc.footnotes();}\r
14 /*]]>*/\r
15 </script>\r
16 <script type="text/javascript" src="/js/asciidoc-xhtml11.js"></script>\r
17 </head>\r
18 <body class="article">\r
19 \r
20         <div id="main">\r
21             <a href="/"><h1 id="title">i3 - improved tiling WM</h1></a>\r
22                         <ul id="nav">\r
23                                 <li><a style="border-bottom: 2px solid #fff" href="/docs">Docs</a></li>\r
24                                 <li><a href="/screenshots">Screens</a></li>\r
25                                 <li><a href="/contact">Contact</a></li>\r
26                                 <li><a href="http://bugs.i3wm.org/">Bugs</a></li>\r
27                         </ul>\r
28         <br style="clear: both">\r
29 <div id="content">\r
30 <div id="header">\r
31 <h1>Debugging i3: How To</h1>\r
32 <span id="author">Michael Stapelberg</span><br />\r
33 <span id="email"><tt>&lt;<a href="mailto:michael+i3@stapelberg.de">michael+i3@stapelberg.de</a>&gt;</tt></span><br />\r
34 <span id="revdate">July 2011</span>\r
35 </div>\r
36 <div id="preamble">\r
37 <div class="sectionbody">\r
38 <div class="paragraph"><p>This document describes how to debug i3 suitably for sending us useful bug\r
39 reports, even if you have no clue of C programming.</p></div>\r
40 <div class="paragraph"><p>First of all: Thank you for being interested in debugging i3. It really means\r
41 something to us to get your bug fixed. If you have any questions about the\r
42 debugging and/or need further help, do not hesitate to contact us!</p></div>\r
43 </div>\r
44 </div>\r
45 <div class="sect1">\r
46 <h2 id="_enabling_logging">1. Enabling logging</h2>\r
47 <div class="sectionbody">\r
48 <div class="paragraph"><p>i3 logs useful information to stdout. To have a clearly defined place where log\r
49 files will be saved, you should redirect stdout and stderr in your\r
50 <tt>~/.xsession</tt>. While you’re at it, putting each run of i3 in a separate log\r
51 file with date/time in its filename is a good idea to not get confused about\r
52 the different log files later on.</p></div>\r
53 <div class="listingblock">\r
54 <div class="content">\r
55 <pre><tt>exec /usr/bin/i3 &gt;~/i3log-$(date +'%F-%k-%M-%S') 2&gt;&amp;1</tt></pre>\r
56 </div></div>\r
57 <div class="paragraph"><p>To enable verbose output and all levels of debug output (required when\r
58 attaching logfiles to bugreports), add the parameters <tt>-V -d all</tt>, like this:</p></div>\r
59 <div class="listingblock">\r
60 <div class="content">\r
61 <pre><tt>exec /usr/bin/i3 -V -d all &gt;~/i3log-$(date +'%F-%k-%M-%S') 2&gt;&amp;1</tt></pre>\r
62 </div></div>\r
63 </div>\r
64 </div>\r
65 <div class="sect1">\r
66 <h2 id="_enabling_core_dumps">2. Enabling core dumps</h2>\r
67 <div class="sectionbody">\r
68 <div class="paragraph"><p>When i3 crashes, often you have the chance of getting a <em>core dump</em> (an image\r
69 of the memory of the i3 process which can be loaded into a debugger). To get a\r
70 core dump, you have to make sure that the user limit for core dump files is set\r
71 high enough. Many systems ship with a default value which even forbids core\r
72 dumps completely. To disable the limit completely and thus enable core dumps,\r
73 use the following command (in your <tt>~/.xsession</tt>, before starting i3):</p></div>\r
74 <div class="listingblock">\r
75 <div class="content">\r
76 <pre><tt>ulimit -c unlimited</tt></pre>\r
77 </div></div>\r
78 <div class="paragraph"><p>Furthermore, to easily recognize core dumps and allow multiple of them, you\r
79 should set a custom core dump filename pattern, using a command like the\r
80 following:</p></div>\r
81 <div class="listingblock">\r
82 <div class="content">\r
83 <pre><tt>sudo sysctl -w kernel.core_pattern=core.%e.%p</tt></pre>\r
84 </div></div>\r
85 <div class="paragraph"><p>This will generate files which have the executable’s file name (%e) and the\r
86 process id (%p) in it. You can save this setting across reboots using\r
87 <tt>/etc/sysctl.conf</tt>.</p></div>\r
88 </div>\r
89 </div>\r
90 <div class="sect1">\r
91 <h2 id="_compiling_with_debug_symbols">3. Compiling with debug symbols</h2>\r
92 <div class="sectionbody">\r
93 <div class="paragraph"><p>To actually get useful core dumps, you should make sure that your version of i3\r
94 is compiled with debug symbols, that is, that the symbols are not stripped\r
95 during the build process. You can check whether your executable contains\r
96 symbols by issuing the following command:</p></div>\r
97 <div class="listingblock">\r
98 <div class="content">\r
99 <pre><tt>file $(which i3)</tt></pre>\r
100 </div></div>\r
101 <div class="paragraph"><p>You should get an output like this:</p></div>\r
102 <div class="listingblock">\r
103 <div class="content">\r
104 <pre><tt>/usr/bin/i3: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically\r
105 linked (uses shared libs), for GNU/Linux 2.6.18, not stripped</tt></pre>\r
106 </div></div>\r
107 <div class="paragraph"><p>Notice the <tt>not stripped</tt>, which is the important part. If you have a version\r
108 which is stripped, please have a look if your distribution provides debug\r
109 symbols (package <tt>i3-wm-dbg</tt> on Debian for example) or if you can turn off\r
110 stripping. If nothing helps, please build i3 from source.</p></div>\r
111 </div>\r
112 </div>\r
113 <div class="sect1">\r
114 <h2 id="_generating_a_backtrace">4. Generating a backtrace</h2>\r
115 <div class="sectionbody">\r
116 <div class="paragraph"><p>Once you have made sure that your i3 is compiled with debug symbols and that\r
117 core dumps are enabled, you can start making sense out of the core dumps.</p></div>\r
118 <div class="paragraph"><p>Because the core dump depends on the original executable (and its debug\r
119 symbols), please do this as soon as you encounter the problem. If you\r
120 re-compile i3, your core dump might be useless afterwards.</p></div>\r
121 <div class="paragraph"><p>Please install <tt>gdb</tt>, a debugger for C. No worries, you don’t need to learn it\r
122 now.  Start gdb using the following command (replacing the actual name of the\r
123 core dump of course):</p></div>\r
124 <div class="listingblock">\r
125 <div class="content">\r
126 <pre><tt>gdb $(which i3) core.i3.3849</tt></pre>\r
127 </div></div>\r
128 <div class="paragraph"><p>Then, generate a backtrace using:</p></div>\r
129 <div class="listingblock">\r
130 <div class="content">\r
131 <pre><tt>backtrace full</tt></pre>\r
132 </div></div>\r
133 </div>\r
134 </div>\r
135 <div class="sect1">\r
136 <h2 id="_sending_bug_reports_debugging_on_irc">5. Sending bug reports/debugging on IRC</h2>\r
137 <div class="sectionbody">\r
138 <div class="paragraph"><p>When sending bug reports, please paste the relevant part of the log (if in\r
139 doubt, please send us rather too much information than too less) and the whole\r
140 backtrace (if there was a core dump).</p></div>\r
141 <div class="paragraph"><p>When debugging with us in IRC, be prepared to use a so called nopaste service\r
142 such as <a href="http://nopaste.info">http://nopaste.info</a> or <a href="http://pastebin.com">http://pastebin.com</a> because pasting large\r
143 amounts of text in IRC sometimes leads to incomplete lines (servers have line\r
144 length limitations) or flood kicks.</p></div>\r
145 </div>\r
146 </div>\r
147 </div>\r
148 <div id="footnotes"><hr /></div>\r
149 <div id="footer" lang="de">\r
150 © 2009-2011 Michael Stapelberg, <a href="/impress.html">Impressum</a>\r
151 </div>\r
152 </body>\r
153 </html>\r