Page 1 of 1

GDB libVLC

Posted: 28 Sep 2009 20:43
by MCyr
Hi all,
I'm having troubles debugging a libVLC module (invmem). I compiled VLC from git with --enable-debug. When I run my program, I have a segfault and I don't know how to debug it.

Code: Select all

[0x7fffe800a870] mux_ts mux debug: adding input codec=mpgv pid=68 [0x7fffe800a870] mux_ts mux debug: new PCR PID is 68 Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffee9ca910 (LWP 7340)] 0x0000000000000021 in ?? () (gdb) info stack #0 0x0000000000000021 in ?? () #1 0x00007fffee6c9047 in DecodeBlock () from /usr/lib64/vlc/codec/libinvmem_plugin.so #2 0x00007fffefdfba6e in Send () from /usr/lib64/vlc/stream_out/libstream_out_transcode_plugin.so
How can I load the source associated with libinvmem_plugin.so (invmem.c in modules/codec) so I can add breaks, and even see what line number is giving me a segfault (0x21 isn't obvious to me...)?

Thanks

Re: GDB libVLC

Posted: 29 Sep 2009 17:23
by RĂ©mi Denis-Courmont
The plugin is loaded already...

Re: GDB libVLC

Posted: 29 Sep 2009 18:06
by MCyr
Yeah sorry, I seem to have made a stupid mistake. I had conflicting libs installed, a set with --enable-debug and another one without. I forgot to put --libdir=/usr/lib64, so my debug enabled libs were in /usr/lib, and thus not loaded.

Btw, if anyone stumbles on something similar, as a general answer, check if the configure script supports something like --enable-debug. You can check if your libs include all the necessary debugging symbols using nm. Something like nm -l /usr/lib64/libsomething.so should show what source files and lines match a given function. If the lib do include those debugging symbols, then simply doing break sourcefile.c:line # will tell gdb to break, when it loads the associated library, on the equivalent of the source line number.