To create new wiki account, please join us on #znc at Libera.Chat and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.

Debugging: Difference between revisions

From ZNC
Jump to navigation Jump to search
>Mkaysi
Tracing crash bugs: Add instructions to log gdb output so copy-pasting isn't required.
>Mkaysi
Document using core files.
Line 49: Line 49:
</pre>
</pre>


If you had logging file set and logging enabled, you can find the bt full and everything else in /tmp/znc.gdb.log. You might want to copy it somewhere safe and remove things before the backtrace.
If you had logging file set and logging enabled, you can find the bt full and everything else in /tmp/znc.gdb.log. You might want to copy it somewhere safe (that doesn't get cleared every boot unlike /tmp) and remove things before the backtrace.
 
=== core files ===
 
You can also get the full backtrace from core file if you have core files enabled.
 
First run <pre>ulimit -c unlimited</pre> and preferrably add it to your ~/.bashrc or rc of whatever shell you use.
 
When your ZNC crashes, you should find a file with name "core" in the directory where you ran znc. If you used cron, it is probably located at $HOME. Now run <pre>gdb znc core</pre> and there
<pre>
set logging /tmp/znc.gdb.log
set logging on
bt full
quit
</pre>
 
Now your full backtrace should be in /tmp/znc.gdb.log and you can send it to the developers. It's also adviced to copy znc.gdb.log to somewhere outside /tmp as /tmp is cleared every boot.


=== Why use --enable-debug? ===
=== Why use --enable-debug? ===

Revision as of 15:29, 20 April 2014

Reporting bugs

Steps to do when you think you found a bug:

Tracing crash bugs

Configure your ZNC version with --enable-debug.

./configure --enable-debug --enable-other-things-you-may-want
make
make install

Then you can run ZNC under gdb:

set logging /tmp/znc.gdb.log
set logging on
gdb ./znc
handle SIGPIPE nostop
run -D

If znc is already running, you can attach gdb to the already-running instance (where pid is znc's process id):

set logging /tmp/znc.gdb.log
set logging on
gdb ./znc
attach pid
handle SIGPIPE nostop
cont

Now you use ZNC as you would always do and try to make it crash. Once it crashed, gdb will show you something like this:

Program received signal SIGSEGV, Segmentation fault.

Now we can get the useful info. This info, together with an explanation how the bug happened are then very useful to the developers.

bt full

If you had logging file set and logging enabled, you can find the bt full and everything else in /tmp/znc.gdb.log. You might want to copy it somewhere safe (that doesn't get cleared every boot unlike /tmp) and remove things before the backtrace.

core files

You can also get the full backtrace from core file if you have core files enabled.

First run

ulimit -c unlimited

and preferrably add it to your ~/.bashrc or rc of whatever shell you use. When your ZNC crashes, you should find a file with name "core" in the directory where you ran znc. If you used cron, it is probably located at $HOME. Now run

gdb znc core

and there

set logging /tmp/znc.gdb.log
set logging on
bt full
quit

Now your full backtrace should be in /tmp/znc.gdb.log and you can send it to the developers. It's also adviced to copy znc.gdb.log to somewhere outside /tmp as /tmp is cleared every boot.

Why use --enable-debug?

With this flag bt full shows much more info, which is needed to understand why the crash had happened. If you're interested in details, search the Web for "debug symbols" or just try with and without.