X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=docs%2Fdebugging.html;h=b84cff841ae75965a7d217465603d4f6bf9d3c6c;hb=1192fdf4b6df07734626617389fc161d31c45a85;hp=2fc749ba1f8da543568a5d590f0ef4614c8bd812;hpb=a51955422cfef50d617cd856bddec422cb8c3493;p=i3%2Fi3.github.io diff --git a/docs/debugging.html b/docs/debugging.html index 2fc749b..b84cff8 100644 --- a/docs/debugging.html +++ b/docs/debugging.html @@ -2,15 +2,15 @@ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> - + - + i3: Debugging i3: How To @@ -22,8 +22,9 @@ window.onload = function(){asciidoc.footnotes();}
@@ -31,145 +32,226 @@ window.onload = function(){asciidoc.footnotes();}

Debugging i3: How To

Michael Stapelberg
<michael@i3wm.org>
-February 2012 +January 2014
-

This document describes how to debug i3 suitably for sending us useful bug -reports, even if you have no clue of C programming.

-

First of all: Thank you for being interested in debugging i3. It really means +

This document describes how to debug i3 to send us useful bug +reports, even if you have no knowledge of C programming.

+

Thank you for being interested in debugging i3. It really means something to us to get your bug fixed. If you have any questions about the -debugging and/or need further help, do not hesitate to contact us!

+process and/or need further help, do not hesitate to contact us!

-

1. Verify you are using the latest (development) version

+

1. Verify you are using i3 ≥ 4.16.1

-

Please verify that you are using the latest version of i3:

+

Only the latest major version of i3 is supported. To verify which version +you are running, use:

-
$ i3 --version
-i3 version 4.1.2-248-g51728ba (2012-02-12, branch "next")
+
$ i3 --moreversion 2>&- || i3 --version
+Binary i3 version:  4.7 (2013-12-22, branch "tags/4.7")
+Running i3 version: 4.7-84-gac74a63 (2014-01-01, branch "next") (pid 1995)

Your version can look like this:

-4.1.2 +4.7 (release version)

-You are using a release version. Please -upgrade to a development version first, or read -Debugging i3: How To (release version). +You are using a release version. In many cases, bugs are already +fixed in the development version of i3. Even if the bug is not a known fixed +one, we will still ask you to reproduce your error with the most recent +development version of i3. Therefore, please upgrade to a development version +if you can.

-4.1.2-248-g51728ba +4.7-85-g9c15b95 (development version)

-Your version is 248 commits newer than 4.1.2, and the git revision of your -version is 51728ba. Go to http://code.i3wm.org/i3/commit/?h=next and see if -the line "commit" starts with the same revision. If so, you are using the +Your version is 85 commits newer than 4.7, and the git revision of your +version is 9c15b95. Go to https://github.com/i3/i3/commits/next and see if +the most recent commit starts with the same revision. If so, you are using the latest version.

-

Development versions of i3 have several properties which make debugging easier:

-
    -
  1. -

    -Shared memory debug logging is enabled by default. You do not have to enable - logging explicitly. -

    -
  2. -
  3. -

    -Core dumps are enabled by default. -

    -
  4. -
  5. -

    -If you are using a version from the Debian/Ubuntu autobuilder, it is - compiled without optimization. Debug symbols are available in the i3-wm-dbg - package. When compiling i3 yourself, debug mode is the default. -

    -
  6. -
+

Development versions of i3 have logging enabled by default and are compiled +with debug symbols.

-

2. Obtaining the debug logfile

+

2. Enabling logging

-

No matter whether i3 misbehaved in some way without crashing or whether it just -crashed, the logfile provides all information necessary to debug the problem.

-

To save a compressed version of the logfile (suitable for attaching it to a -bugreport), use:

+

If you are using a development version (see previous section), you don’t need +to do anything — skip to section 3.

+

If you are using a release version with a custom ~/.xsession (or xinitrc) +file, execute i3 with a line like this:

+
+
+
# Use 25 MiB of RAM for debug logs
+exec i3 --shmlog-size=26214400
+
+

If you are NOT using an ~/.xsession file but you just chose "i3" from the +list of sessions in your desktop manager (gdm, lxdm, …), edit +/usr/share/xsessions/i3.desktop and replace the Exec=i3 line with:

-
i3-dump-log | gzip -9c > /tmp/i3.log.gz
+
Exec=i3 --shmlog-size=26214400
-

This command does not depend on i3 (it also works when i3 currently displays -the crash dialog), but it requires a working X11 connection. When running it -from a virtual console (Ctrl-Alt-F1), use:

+

If you cannot restart i3 for some reason, you can enable debug logging on the +fly:

-
DISPLAY=:0 i3-dump-log | gzip -9c > /tmp/i3.log.gz
+
i3-msg 'debuglog on; shmlog on; reload'
-

3. Obtaining a backtrace

+

3. Reproducing the problem

-

When i3 displays its crash dialog, do the following:

-
    +

    Before submitting an issue, please make sure to close down on the problem as +much as you can yourself. Here are some steps you should consider:

    +
      +
    • +

      +Find a deterministic, reliable way to reproduce the problem and provide it + with your bug report. +

      +
    • -Switch to a virtual console (Ctrl-Alt-F1) or login from a different computer +Try using the default i3 config to reproduce the problem. If the issue does + not appear with the default config, gradually adapt it to track down what + change(s) to the config introduce the problem.

    • -Generate a backtrace (see below) +Reproduce the problem with a minimal setup, i.e., only use as few applications, + windows and steps as necessary.

    • -Switch back to the crash dialog (Ctrl-Alt-F7) +In addition, try to stick to applications that are common and, even more + importantly, free / open source.

    • -Restart i3 in-place (you will keep your session), continue working +Before obtaining the log file, restart i3 in-place, execute the steps to + reproduce the problem and then save the logs. This keeps the log file as + small as possible and necessary.

    • -
-

This is how you get a backtrace from a running i3 process:

+
+

Please be aware that we cannot support compatibility issues with closed-source +software, as digging into compatibility problems without having access to the +source code is too time-consuming. Additionally, experience has shown that +often, the software in question is responsible for the issue. Please raise an +issue with the software in question, not i3.

+
+ +
+

4. Obtaining the debug logfile

+
+
+ + + +
+
Caution
+
+

Logs may contain sensitive information, so please inspect the log before +submitting it. Logs may be viewed by anyone, once posted. If you choose to +redact the log, make an effort not to discard information which may be relevant +to the issue you are reporting.

+

The best way to avoid submitting such information is to only run the necessary +steps to reproduce the behavior when saving the log file. This will also make +analyzing the log file easier.

+
+
+

No matter whether i3 misbehaved in some way without crashing or whether it just +crashed, the logfile provides all information necessary to debug the problem.

+

To upload a compressed version of the logfile (for a bugreport), use:

-
I3PID=$(pidof i3)
-gdb /proc/$I3PID/exe $I3PID \
-    --batch --quiet \
-    --ex 'backtrace full' > /tmp/i3-backtrace.txt 2>&1
+
DISPLAY=:0 i3-dump-log | bzip2 -c | curl --data-binary @- https://logs.i3wm.org
+

This command does not depend on i3 (it also works while i3 displays +the crash dialog), but it requires a working X11 connection.

+

After running it, you will get a URL to the logfile. Please include that URL in +your bug report.

-

4. Sending bug reports/debugging on IRC

+

5. On crashes: Obtaining a backtrace

+
+

When i3 crashes, it will display a dialog stating “i3 just crashed”, offering +you to save a backtrace to a text file.

+

To actually get useful backtraces, you should make sure that your version of i3 +is compiled with debug symbols:

+
+
+
$ file `which i3`
+/usr/bin/i3: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically
+linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
+
+

Notice the not stripped, which is the important part. If you have a version +which is stripped, please check whether your distribution provides debug +symbols (package i3-wm-dbg on Debian for example) or if you can turn off +stripping. If nothing helps, please build i3 from source.

+

Once you have made sure that your i3 is compiled with debug symbols and the C +debugger gdb is installed on your machine, you can let i3 generate a +backtrace in the crash dialog.

+

After pressing "b" in the crash dialog, you will get a file called +/tmp/i3-backtrace.%d.%d.txt where the first %d is replaced by i3’s process +id (PID) and the second one is incremented each time you generate a backtrace, +starting at 0.

+
+
+
+

6. Sending bug reports/debugging on IRC

When sending bug reports, please attach the whole log file. Even if you think you found the section which clearly highlights the problem, additional information might be necessary to completely diagnose the problem.

-

When debugging with us in IRC, be prepared to use a so called nopaste service -such as http://nopaste.info or http://pastebin.com because pasting large -amounts of text in IRC sometimes leads to incomplete lines (servers have line -length limitations) or flood kicks.

+

When debugging with us in IRC, be prepared to use a so-called nopaste service +such as https://pastebin.com because pasting large amounts of text in IRC +sometimes leads to incomplete lines (servers have line length limitations) or +flood kicks.

+
+
+
+

7. Debugging i3bar

+
+

To debug i3bar problems, use the --verbose commandline parameter, +or add verbose yes to all bar {} blocks in your i3 +config, reload your config and then restart all i3bar instances like this:

+
+
+
$ i3 reload
+$ killall i3bar
+$ for c in $(i3-msg -t get_bar_config | python -c \
+      'import json,sys;print("\n".join(json.load(sys.stdin)))'); do \
+    (i3bar --bar_id=$c >i3bar.$c.log 2>&1) & \
+  done;
+
+

There will now be i3bar.*.log files in your current directory that you can provide +in your bug report.