GNOME Bugzilla – Bug 159288
Problem with gnome-vfs when using gdb and using gnome-vfs in a GThread
Last modified: 2005-07-17 21:42:56 UTC
[freax@lort test]$ rpm -q gnome-vfs gnome-vfs-1.0.5-21 [freax@lort test]$ [freax@lort test]$ cat test.c #include <glib.h> #include <libgnomevfs/gnome-vfs.h> static gpointer thread_main_func (gpointer data) { GnomeVFSURI *uri = NULL; const gchar *source = "ftp://ftp.gnome.org/welcome.msg"; if (!gnome_vfs_init ()) { g_print ("WARNING: GNOME VFS problems\n"); } uri = gnome_vfs_uri_new (source); gnome_vfs_uri_unref (uri); g_thread_exit (0); return 0; } int main (int argc, char **argv) { GThread *thread = NULL; g_thread_init (NULL); thread = g_thread_create (thread_main_func, NULL, TRUE, NULL); g_thread_set_priority (thread, G_THREAD_PRIORITY_NORMAL); g_thread_join (thread); } [freax@lort test]$ gcc test.c `pkg-config gnome-vfs-2.0 --libs --cflags` -ggdb [freax@lort test]$ ./a.out [freax@lort test]$ (No problems) However.. in gdb: [freax@lort test]$ gdb ./a.out GNU gdb Red Hat Linux (6.1post-1.20040607.43rh) 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 "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1". (gdb) run Starting program: /home/freax/test/a.out [Thread debugging using libthread_db enabled] [New Thread -151132480 (LWP 15158)] [New Thread -151135312 (LWP 15161)] Program received signal SIG33, Real-time event 33. [Switching to Thread -151132480 (LWP 15158)] 0x005277a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 (gdb) thread apply all bt
+ Trace 52578
Thread 2 (Thread -151135312 (LWP 15161))
Thread 1 (Thread -151132480 (LWP 15158))
The program is running. Exit anyway? (y or n) y [freax@lort test]$
It doesn't matter wheter or not the gnome_vfs_init () is called in the second thread or in the main-thread. I've tested this, it's showing the same behaviour.
Putting handle SIG33 nostop noprint in your ~/.gdbinit is a hackaround this issue
Closing this bug then, reopen it if you disagree with it being closed
I don't think that, because there is a workaround the problem, it's nolonger a bug. Either it's a bug in gdb or it's a bug in GnomeVfs. Yet, IMHO, it should be resolved in a proper way. It's not even a solution unless, of course, the GnomeVfs developers-documentation clearly states that you need to apply this workaround on your debugging-environment.
I found http://www.gnome.org/~veillard/gamin/debug.html « It is perfectly possible to also run the client under a debugger, for the server it works too except the dnotify kernel interface uses a signal SIG33 which is trapped by gdb. To avoid this use the handle gdb instruction: handle SIG33 nostop » while googling around, but even if gnome-vfs usually links to libfam, I fail to see why it would get something from dnotify. Dunno if this has something to do with the current issue or not, but this is the only vaguely relevant page I found on goole.
Note that I had to add add the noprint option mentioned above too, to get a successful debugging-session. With handle SIG33 nostop noprint : (gdb) run Starting program: /home/freax/test/a.out [Thread debugging using libthread_db enabled] [New Thread -151132480 (LWP 1689)] [New Thread -151135312 (LWP 1692)] [Thread -151135312 (zombie) exited] Program exited normally. (gdb) With handle SIG33 nostop: (gdb) run Starting program: /home/freax/test/a.out [Thread debugging using libthread_db enabled] [New Thread -151132480 (LWP 1655)] [New Thread -151135312 (LWP 1658)] Program received signal SIG33, Real-time event 33. Program received signal SIG33, Real-time event 33. Program received signal SIG33, Real-time event 33. Program received signal SIG33, Real-time event 33. [Thread -151135312 (zombie) exited] Program exited normally. (gdb)
I'm not sure why gdb is stopping on SIG33, or why a SIG33 is created when you use threads. However, this is not a gnome-vfs bug, but a gdb bug or perhaps a libc bug. Gnome-vfs doesn't really use signals in any way appart from how libc might use them to implement things, so its likely you'll have this problem with any other app using threads too.
this is not a GNOME issue, I'm closing it as NOTGNOME. Feel free to reopen if you still get the issue