Page 1 of 1

Debugging vlc in cygwin/gdb

Posted: 13 Oct 2006 07:15
by wizard_ct
Hello,

I have vlc-truck compiled against contrib-20060730-win32-bin-gcc-3.4.5-only.tar.bz2 in a cygwin environment.

Configure line is the default suggested one:
./bootstrap && \
PKG_CONFIG_PATH=/usr/win32/lib/pkgconfig \
CPPFLAGS="-I/usr/win32/include -I/usr/win32/include/ebml" \
LDFLAGS=-L/usr/win32/lib \
CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin" \
./configure \
--disable-gtk \
--enable-nls --enable-sdl --with-sdl-config-path=/usr/win32/bin \
--enable-ffmpeg --with-ffmpeg-mp3lame --with-ffmpeg-faac \
--with-ffmpeg-zlib --enable-faad --enable-flac --enable-theora \
--with-wx-config-path=/usr/win32/bin \
--with-freetype-config-path=/usr/win32/bin \
--with-fribidi-config-path=/usr/win32/bin \
--enable-live555 --with-live555-tree=/usr/win32/live.com \
--enable-caca --with-caca-config-path=/usr/win32/bin \
--with-xml2-config-path=/usr/win32/bin \
--with-dvdnav-config-path=/usr/win32/bin \
--disable-cddax --disable-vcdx --enable-goom \
--enable-twolame --enable-dvdread \
--enable-debug

The problem is, when I go to run it in gdb, I get the following:
wizard_ct@meijin ~/sw/vlc-trunk
$ gdb ./vlc.exe
GNU gdb 6.5.50.20060706-cvs (cygwin-special)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) run
Starting program: /cygdrive/c/cache/sw_local/vlc-trunk/vlc.exe
Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/msvcrt.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/user32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/gdi32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/winmm.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/ws2_32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/ws2help.dll
...but vlc never actually loads. Additionally, my cygwin console is unresponsive at this point and must be killed. I've also tried to attach to the running process, but when I do that it's unable to break in.

Also worth noting is that running "./vlc.exe -vvv clip.mpg" will not produce any printfs to the console, when I assume it should?

Am I missing something required to make vlc debuggable?

Thanks

Posted: 13 Oct 2006 21:00
by Quovodis
this issue is documented in the INSTALL.win32 in the source tree

Posted: 14 Oct 2006 14:57
by Trax
Revert GDB to a previous version, 20060706-2 is known to be broken (see the cygwin howto http://developers.videolan.org/vlc/cygwin-compile.txt). Also beware the current version of Cygwin has problems for compilation too so be very careful only to downgrade GDB and not anything else. See viewtopic.php?t=27162

Posted: 02 Nov 2006 03:39
by frankwang
I have the same problem with the gdb.

I am pretty sure that I am using the gdb with 20041228-3 version, using the binutils with 20050610-01 version, and using the gcc 3.3.3-3.

After executing the "run", it seems stop somewhere.

===================
Frankg@FRANKWANG ~/vlc-0.8.4a
$ gdb ./vlc
GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) run
Starting program: /home/Frankg/vlc-0.8.4a/vlc.exe


Frank

Posted: 02 Nov 2006 10:02
by frankwang
Hello.

After setting a breakpoint in the __vlc_thread_create function in the Threads.c, I can use the gdb to launch the vlc program. Does anyone could tell me why should I set these breakpoints? (Otherwise, I can't launch the vlc program with gdb.)

==============================
Frankg@FRANKWANG ~/vlc-0.8.4a
$ gdb ./vlc.exe
GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) break Threads.c:528
Breakpoint 1 at 0x41b2fe: file src/misc/threads.c, line 528.
(gdb) run
Starting program: /home/Frankg/vlc-0.8.4a/vlc.exe

Breakpoint 1, __vlc_thread_create (p_this=0x3e73b0,
psz_file=0x962bc1 "src/playlist/playlist.c", i_line=183,
psz_name=0x962bb8 "playlist", func=0x413a30 <RunThread>, i_priority=0,
b_wait=1) at src/misc/threads.c:545
545 p_this->thread_id =
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: /home/Frankg/vlc-0.8.4a/vlc.exe

Breakpoint 1, __vlc_thread_create (p_this=0x3e73b0,
psz_file=0x962bc1 "src/playlist/playlist.c", i_line=183,
psz_name=0x962bb8 "playlist", func=0x413a30 <RunThread>, i_priority=0,
b_wait=1) at src/misc/threads.c:545
545 p_this->thread_id =
(gdb) continue
Continuing.

Breakpoint 1, __vlc_thread_create (p_this=0x19e5a50,
psz_file=0x962bc1 "src/playlist/playlist.c", i_line=205,
psz_name=0x962bd9 "preparser", func=0x414020 <RunPreparse>, i_priority=0,
b_wait=1) at src/misc/threads.c:545
545 p_this->thread_id =
(gdb)
Continuing.

Breakpoint 1, __vlc_thread_create (p_this=0x18df250,
psz_file=0x9647c1 "src/interface/interface.c", i_line=211,
psz_name=0x9646b0 "interface", func=0x421c10 <RunInterface>,
i_priority=0, b_wait=0) at src/misc/threads.c:545
545 p_this->thread_id =
(gdb)
Continuing.

Breakpoint 1, __vlc_thread_create (p_this=0x3e6ac0,
psz_file=0x9647c1 "src/interface/interface.c", i_line=196,
psz_name=0x9647b9 "manager", func=0x422160 <Manager>, i_priority=0,
b_wait=0) at src/misc/threads.c:545
545 p_this->thread_id =
(gdb)
Continuing.

Program exited normally.
(gdb) run
Starting program: /home/Frankg/vlc-0.8.4a/vlc.exe

Breakpoint 1, __vlc_thread_create (p_this=0x3e73b0,
psz_file=0x962bc1 "src/playlist/playlist.c", i_line=183,
psz_name=0x962bb8 "playlist", func=0x413a30 <RunThread>, i_priority=0,
b_wait=1) at src/misc/threads.c:545
545 p_this->thread_id =
(gdb) continue
Continuing.

Breakpoint 1, __vlc_thread_create (p_this=0x19e5a50,
psz_file=0x962bc1 "src/playlist/playlist.c", i_line=205,
psz_name=0x962bd9 "preparser", func=0x414020 <RunPreparse>, i_priority=0,
b_wait=1) at src/misc/threads.c:545
545 p_this->thread_id =
(gdb) continue
Continuing.

Breakpoint 1, __vlc_thread_create (p_this=0x18df250,
psz_file=0x9647c1 "src/interface/interface.c", i_line=211,
psz_name=0x9646b0 "interface", func=0x421c10 <RunInterface>,
i_priority=0, b_wait=0) at src/misc/threads.c:545
545 p_this->thread_id =
(gdb) continue
Continuing.

Breakpoint 1, __vlc_thread_create (p_this=0x3e6920,
psz_file=0x9647c1 "src/interface/interface.c", i_line=196,
psz_name=0x9647b9 "manager", func=0x422160 <Manager>, i_priority=0,
b_wait=0) at src/misc/threads.c:545
545 p_this->thread_id =
(gdb) continue
Continuing.

Program exited normally.
(gdb)


Best,
Frank