<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.videolan.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Stephane-gourichon-lpad</id>
	<title>VideoLAN Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.videolan.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Stephane-gourichon-lpad"/>
	<link rel="alternate" type="text/html" href="https://wiki.videolan.org/Special:Contributions/Stephane-gourichon-lpad/"/>
	<updated>2026-11-04T21:00:09Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.videolan.org/index.php?title=Debug&amp;diff=31926</id>
		<title>Debug</title>
		<link rel="alternate" type="text/html" href="https://wiki.videolan.org/index.php?title=Debug&amp;diff=31926"/>
		<updated>2017-03-10T14:55:22Z</updated>

		<summary type="html">&lt;p&gt;Stephane-gourichon-lpad: Replace &amp;lt;code&amp;gt;-Og&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-O0&amp;lt;/code&amp;gt; to prevent compiler from optimizing out variables.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;When compiling {{VLC}}, you can compile a debug binary using &amp;lt;code&amp;gt;--enable-debug&amp;lt;/code&amp;gt; on the ./configure script.&lt;br /&gt;
&lt;br /&gt;
Those debug facts are common to every programs, not only VLC.&lt;br /&gt;
&lt;br /&gt;
== What it is used for ==&lt;br /&gt;
&lt;br /&gt;
Of course, the binary compiled in debug mode will or should behave like the release one (more or less). Differences are&lt;br /&gt;
* developers can cause VLC to crash when it reached a suspicious state for development purpose, while release version will not in the same suspicious state&lt;br /&gt;
* binary backtraces are meaningful in this mode since symbols are embedded in it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So its main usage is for developers to use debug-friendly binaries and to reproduce a crash and get its backtrace.&lt;br /&gt;
&lt;br /&gt;
== How to enable it ==&lt;br /&gt;
&lt;br /&gt;
As said above, you basically just have to add &amp;lt;code&amp;gt;CFLAGS=&amp;quot;-g&amp;quot; CXXFLAGS=&amp;quot;-g&amp;quot; --enable-debug&amp;lt;/code&amp;gt; parameters at the [[configure|./configure]] stage.&lt;br /&gt;
&lt;br /&gt;
For stepping into code, better is to do &amp;lt;code&amp;gt;CFLAGS=&amp;quot;-g -Og&amp;quot; CXXFLAGS=&amp;quot;-g -Og&amp;quot;&amp;lt;/code&amp;gt; also add &amp;lt;code&amp;gt;--disable-optimizations&amp;lt;/code&amp;gt; and not use &amp;lt;code&amp;gt;--enable-release&amp;lt;/code&amp;gt;. Replace &amp;lt;code&amp;gt;-Og&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-O0&amp;lt;/code&amp;gt; to prevent compiler from optimizing out variables. For more information see [[VLC configure help]].&lt;br /&gt;
&lt;br /&gt;
== Backtraces ==&lt;br /&gt;
&lt;br /&gt;
A backtrace is a snapshot of a process at the time it is about to crash.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What does it look like? ===&lt;br /&gt;
&lt;br /&gt;
Here is a debug-friendly backtrace:&lt;br /&gt;
 &#039;&#039;Program received signal SIGSEGV, Segmentation fault.&#039;&#039;&lt;br /&gt;
 &#039;&#039;[Switching to Thread 0xb22e9b90 (LWP 17982)]&#039;&#039;&lt;br /&gt;
 &#039;&#039;0xb7a965e8 in CDDAFormatTitle (p_access=0x842afe0, i_track=99 &#039;c&#039;) at info.c:630&#039;&#039;&lt;br /&gt;
 &#039;&#039;630     info.c: No such file or directory.&#039;&#039;&lt;br /&gt;
 &#039;&#039;        in info.c&#039;&#039;&lt;br /&gt;
 &#039;&#039;(gdb) bt full&#039;&#039;&lt;br /&gt;
 #0  0xb7a965e8 in CDDAFormatTitle (p_access=0x842afe0, i_track=99 &#039;c&#039;) at&lt;br /&gt;
 info.c:630&lt;br /&gt;
         psz_name = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         config_varname = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         p_cdda = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         psz_mrl = 0x8277238 &amp;quot;cddax:///dev/sr0@T99&amp;quot;&lt;br /&gt;
 #1  0xb7a94b0f in CDDAReadBlocks (p_access=0x842afe0) at access.c:264&lt;br /&gt;
         psz_title = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         go_on = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         p_block = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         p_cdda = (cdda_data_t *) 0x84323c0&lt;br /&gt;
         i_blocks = 20&lt;br /&gt;
         __func__ = &amp;quot;CDDAReadBlocks&amp;quot;&lt;br /&gt;
 [...]&lt;br /&gt;
 #6  0xb6acfe9c in Demux (p_demux=0x833dcb0) at ../../include/vlc_stream.h:189&lt;br /&gt;
         p_sys = (demux_sys_t *) 0x842eca8&lt;br /&gt;
         i_pos = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         p_block = (block_t *) 0x859f380&lt;br /&gt;
 #7  0xb7f34bae in MainLoop (p_input=0x8429c08) at input/input.c:538&lt;br /&gt;
         b_force_update = 0&lt;br /&gt;
         i_ret = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         i_type = 138588128&lt;br /&gt;
         val = {i_int = 1064861644, b_b..........= 0 &#039;\0&#039;, h = 0 &#039;\0&#039;}}&lt;br /&gt;
         i_intf_update = 1214500117823853&lt;br /&gt;
 #8  0xb7f362b2 in Run (p_input=0x8429c08) at input/input.c:444&lt;br /&gt;
 No locals.&lt;br /&gt;
 #9  0xb7e7917b in start_thread () from /lib/libpthread.so.0&lt;br /&gt;
 No symbol table info available.&lt;br /&gt;
 #10 0xb7ddb09e in clone () from /lib/libc.so.6&lt;br /&gt;
 No symbol table info available.&lt;br /&gt;
&lt;br /&gt;
And here is a not debug-friendly backtrace, unuseful in fact.&lt;br /&gt;
 &#039;&#039;Program received signal SIGSEGV, Segmentation fault.&#039;&#039;&lt;br /&gt;
 &#039;&#039;[Switching to Thread -1342661712 (LWP 8792)]&#039;&#039;&lt;br /&gt;
 &#039;&#039;0xb7db65ab in __module_Need () from /usr/lib/libvlc.so.0&#039;&#039;&lt;br /&gt;
 &#039;&#039;(gdb) bt&#039;&#039;&lt;br /&gt;
 #0  0xb7db65ab in __module_Need () from /usr/lib/libvlc.so.0&lt;br /&gt;
 #1  0xb7ec5c34 in ?? () from /usr/lib/libvlc.so.0&lt;br /&gt;
 #2  0xb5487553 in ?? ()&lt;br /&gt;
    from /usr/lib/vlc/stream_out/libstream_out_transcode_plugin.so&lt;br /&gt;
 #3  0x00000009 in ?? ()&lt;br /&gt;
 #4  0xb7ec3c74 in ?? () from /usr/lib/libvlc.so.0&lt;br /&gt;
 #5  0x0854bef8 in ?? ()&lt;br /&gt;
 #6  0x08525a00 in ?? ()&lt;br /&gt;
 #7  0xb7efaf04 in ?? () from /usr/lib/libvlc.so.0&lt;br /&gt;
 #8  0xb7dce493 in __vlc_object_release () from /usr/lib/libvlc.so.0&lt;br /&gt;
 #9  0x0000006f in ?? ()&lt;br /&gt;
 #10 0x00000003 in ?? ()&lt;br /&gt;
 #11 0x00000000 in ?? ()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As you can see, developers can&#039;t cope with last backtrace.&lt;br /&gt;
&lt;br /&gt;
=== Is a backtrace enough to debug? ===&lt;br /&gt;
&lt;br /&gt;
It is not enough for someone else than you to fix a bug.&lt;br /&gt;
At least, you really should describe what you were doing, how to reproduce the bug if you can, etc.&lt;br /&gt;
&lt;br /&gt;
If you try to fix a bug with someone else or if you are asking help on your backtrace, better is really to use an up-to-date VLC source-code. Otherwise, say so and maybe give the commit ID/VLC tag you are working on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Report Bugs]]&lt;br /&gt;
* [[Tutorial for gdb debug under Win32|Tutorial for GDB with Win32]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Coding]]&lt;/div&gt;</summary>
		<author><name>Stephane-gourichon-lpad</name></author>
	</entry>
	<entry>
		<id>https://wiki.videolan.org/index.php?title=Debug&amp;diff=31925</id>
		<title>Debug</title>
		<link rel="alternate" type="text/html" href="https://wiki.videolan.org/index.php?title=Debug&amp;diff=31925"/>
		<updated>2017-03-10T12:54:24Z</updated>

		<summary type="html">&lt;p&gt;Stephane-gourichon-lpad: Fix instructions about getting a meaningul backtrace. Not sure --disable-optimizations has any effect at all.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;When compiling {{VLC}}, you can compile a debug binary using &amp;lt;code&amp;gt;--enable-debug&amp;lt;/code&amp;gt; on the ./configure script.&lt;br /&gt;
&lt;br /&gt;
Those debug facts are common to every programs, not only VLC.&lt;br /&gt;
&lt;br /&gt;
== What it is used for ==&lt;br /&gt;
&lt;br /&gt;
Of course, the binary compiled in debug mode will or should behave like the release one (more or less). Differences are&lt;br /&gt;
* developers can cause VLC to crash when it reached a suspicious state for development purpose, while release version will not in the same suspicious state&lt;br /&gt;
* binary backtraces are meaningful in this mode since symbols are embedded in it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So its main usage is for developers to use debug-friendly binaries and to reproduce a crash and get its backtrace.&lt;br /&gt;
&lt;br /&gt;
== How to enable it ==&lt;br /&gt;
&lt;br /&gt;
As said above, you basically just have to add &amp;lt;code&amp;gt;CFLAGS=&amp;quot;-g&amp;quot; CXXFLAGS=&amp;quot;-g&amp;quot; --enable-debug&amp;lt;/code&amp;gt; parameters at the [[configure|./configure]] stage.&lt;br /&gt;
&lt;br /&gt;
For stepping into code, better is to do &amp;lt;code&amp;gt;CFLAGS=&amp;quot;-g -Og&amp;quot; CXXFLAGS=&amp;quot;-g -Og&amp;quot;&amp;lt;/code&amp;gt; also add &amp;lt;code&amp;gt;--disable-optimizations&amp;lt;/code&amp;gt; and not use &amp;lt;code&amp;gt;--enable-release&amp;lt;/code&amp;gt;. For more information see [[VLC configure help]].&lt;br /&gt;
&lt;br /&gt;
== Backtraces ==&lt;br /&gt;
&lt;br /&gt;
A backtrace is a snapshot of a process at the time it is about to crash.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What does it look like? ===&lt;br /&gt;
&lt;br /&gt;
Here is a debug-friendly backtrace:&lt;br /&gt;
 &#039;&#039;Program received signal SIGSEGV, Segmentation fault.&#039;&#039;&lt;br /&gt;
 &#039;&#039;[Switching to Thread 0xb22e9b90 (LWP 17982)]&#039;&#039;&lt;br /&gt;
 &#039;&#039;0xb7a965e8 in CDDAFormatTitle (p_access=0x842afe0, i_track=99 &#039;c&#039;) at info.c:630&#039;&#039;&lt;br /&gt;
 &#039;&#039;630     info.c: No such file or directory.&#039;&#039;&lt;br /&gt;
 &#039;&#039;        in info.c&#039;&#039;&lt;br /&gt;
 &#039;&#039;(gdb) bt full&#039;&#039;&lt;br /&gt;
 #0  0xb7a965e8 in CDDAFormatTitle (p_access=0x842afe0, i_track=99 &#039;c&#039;) at&lt;br /&gt;
 info.c:630&lt;br /&gt;
         psz_name = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         config_varname = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         p_cdda = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         psz_mrl = 0x8277238 &amp;quot;cddax:///dev/sr0@T99&amp;quot;&lt;br /&gt;
 #1  0xb7a94b0f in CDDAReadBlocks (p_access=0x842afe0) at access.c:264&lt;br /&gt;
         psz_title = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         go_on = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         p_block = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         p_cdda = (cdda_data_t *) 0x84323c0&lt;br /&gt;
         i_blocks = 20&lt;br /&gt;
         __func__ = &amp;quot;CDDAReadBlocks&amp;quot;&lt;br /&gt;
 [...]&lt;br /&gt;
 #6  0xb6acfe9c in Demux (p_demux=0x833dcb0) at ../../include/vlc_stream.h:189&lt;br /&gt;
         p_sys = (demux_sys_t *) 0x842eca8&lt;br /&gt;
         i_pos = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         p_block = (block_t *) 0x859f380&lt;br /&gt;
 #7  0xb7f34bae in MainLoop (p_input=0x8429c08) at input/input.c:538&lt;br /&gt;
         b_force_update = 0&lt;br /&gt;
         i_ret = &amp;lt;value optimized out&amp;gt;&lt;br /&gt;
         i_type = 138588128&lt;br /&gt;
         val = {i_int = 1064861644, b_b..........= 0 &#039;\0&#039;, h = 0 &#039;\0&#039;}}&lt;br /&gt;
         i_intf_update = 1214500117823853&lt;br /&gt;
 #8  0xb7f362b2 in Run (p_input=0x8429c08) at input/input.c:444&lt;br /&gt;
 No locals.&lt;br /&gt;
 #9  0xb7e7917b in start_thread () from /lib/libpthread.so.0&lt;br /&gt;
 No symbol table info available.&lt;br /&gt;
 #10 0xb7ddb09e in clone () from /lib/libc.so.6&lt;br /&gt;
 No symbol table info available.&lt;br /&gt;
&lt;br /&gt;
And here is a not debug-friendly backtrace, unuseful in fact.&lt;br /&gt;
 &#039;&#039;Program received signal SIGSEGV, Segmentation fault.&#039;&#039;&lt;br /&gt;
 &#039;&#039;[Switching to Thread -1342661712 (LWP 8792)]&#039;&#039;&lt;br /&gt;
 &#039;&#039;0xb7db65ab in __module_Need () from /usr/lib/libvlc.so.0&#039;&#039;&lt;br /&gt;
 &#039;&#039;(gdb) bt&#039;&#039;&lt;br /&gt;
 #0  0xb7db65ab in __module_Need () from /usr/lib/libvlc.so.0&lt;br /&gt;
 #1  0xb7ec5c34 in ?? () from /usr/lib/libvlc.so.0&lt;br /&gt;
 #2  0xb5487553 in ?? ()&lt;br /&gt;
    from /usr/lib/vlc/stream_out/libstream_out_transcode_plugin.so&lt;br /&gt;
 #3  0x00000009 in ?? ()&lt;br /&gt;
 #4  0xb7ec3c74 in ?? () from /usr/lib/libvlc.so.0&lt;br /&gt;
 #5  0x0854bef8 in ?? ()&lt;br /&gt;
 #6  0x08525a00 in ?? ()&lt;br /&gt;
 #7  0xb7efaf04 in ?? () from /usr/lib/libvlc.so.0&lt;br /&gt;
 #8  0xb7dce493 in __vlc_object_release () from /usr/lib/libvlc.so.0&lt;br /&gt;
 #9  0x0000006f in ?? ()&lt;br /&gt;
 #10 0x00000003 in ?? ()&lt;br /&gt;
 #11 0x00000000 in ?? ()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As you can see, developers can&#039;t cope with last backtrace.&lt;br /&gt;
&lt;br /&gt;
=== Is a backtrace enough to debug? ===&lt;br /&gt;
&lt;br /&gt;
It is not enough for someone else than you to fix a bug.&lt;br /&gt;
At least, you really should describe what you were doing, how to reproduce the bug if you can, etc.&lt;br /&gt;
&lt;br /&gt;
If you try to fix a bug with someone else or if you are asking help on your backtrace, better is really to use an up-to-date VLC source-code. Otherwise, say so and maybe give the commit ID/VLC tag you are working on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Report Bugs]]&lt;br /&gt;
* [[Tutorial for gdb debug under Win32|Tutorial for GDB with Win32]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Coding]]&lt;/div&gt;</summary>
		<author><name>Stephane-gourichon-lpad</name></author>
	</entry>
</feed>