mirror of https://code.videolan.org/videolan/vlc
56 lines
2.2 KiB
XML
56 lines
2.2 KiB
XML
<appendix> <title> Advanced debugging </title>
|
|
|
|
<para>
|
|
We never debug our code, because we don't put bugs in. Okay, you want
|
|
some real stuff. Sam still uses <function> printf() </function> to
|
|
find out where it crashes. For real programmers, here is a summary
|
|
of what you can do if you have problems.
|
|
</para>
|
|
|
|
<sect1> <title> Where does it crash ? </title>
|
|
|
|
<para>
|
|
The best way to know that is to use gdb. You can start using it with
|
|
good chances by configuring with <parameter> --enable-debug </parameter>.
|
|
It will add <parameter> -g </parameter> to the compiler <parameter>
|
|
CFLAGS</parameter>, and activate some additional safety checks. Just
|
|
run <command> gdb vlc</command>, type <command> run myfile.vob</command>,
|
|
and wait until it crashes. You can view where it stopped with
|
|
<command>bt</command>, and print variables with <command>print
|
|
<C-style></command>.
|
|
</para>
|
|
|
|
<para>
|
|
If you run into troubles, you may want to turn the optimizations off.
|
|
Optimizations (especially inline functions) may confuse the debugger.
|
|
Use <parameter> --disable-optimizations </parameter> in that case.
|
|
</para>
|
|
|
|
</sect1>
|
|
|
|
<sect1> <title> Other problems </title>
|
|
|
|
<para>
|
|
It may be more complicated than that, for instance unpredictable
|
|
behaviour, random bug or performance issue. You have several options
|
|
to deal with this. If you experience unpredictable behaviour, I hope
|
|
you don't have a heap or stack corruption (eg. writing in an unallocated
|
|
space), because they are hard to find. If you are really desperate, have
|
|
a look at something like ElectricFence or dmalloc. Under GNU/Linux, an
|
|
easy check is to type <command> export MALLOC_CHECK_=2 </command> before
|
|
launching vlc (see <command> malloc(3) </command> for more information).
|
|
</para>
|
|
|
|
<para>
|
|
VLC offers a "trace-mode". It can create a log file with very accurate dates
|
|
and messages of what it does, so it is useful to detect performance
|
|
issues or lock-ups. Compile with <parameter> --enable-trace </parameter>
|
|
and tune the <parameter> TRACE_* </parameter> flags in <filename>
|
|
include/config.h </filename> to enable certain types of messages (log
|
|
file writing can take up a lot of time, and will have side effects).
|
|
</para>
|
|
|
|
</sect1>
|
|
|
|
</appendix>
|