Skip to content

Instantly share code, notes, and snippets.

@thefloweringash
Created August 22, 2013 12:38
Show Gist options
  • Save thefloweringash/6306621 to your computer and use it in GitHub Desktop.
Save thefloweringash/6306621 to your computer and use it in GitHub Desktop.
Minified pure gtk threads test and gdb session
[lorne@xenon ~]$ cat crashme.c
#include <gtk/gtk.h>
int main() {
gdk_threads_init();
gtk_main();
}
[lorne@xenon ~]$ cc -g `pkg-config --cflags --libs gtk+-2.0` -o crashme crashme.c
[lorne@xenon ~]$ gdb ./crashme
GNU gdb 6.1.1 [FreeBSD]
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 "amd64-marcel-freebsd"...
(gdb) run
Starting program: /usr/home/lorne/crashme
[New LWP 100107]
[New Thread 808007400 (LWP 100107/crashme)]
GLib (gthread-posix.c): Unexpected error from C library during 'pthread_mutex_unlock': Operation not permitted. Aborting.
Program received signal SIGABRT, Aborted.
[Switching to Thread 808007400 (LWP 100107/crashme)]
0x000000080478824c in thr_kill () from /lib/libc.so.7
(gdb) up
#1 0x000000080482a85b in abort () from /lib/libc.so.7
(gdb) up
#2 0x0000000803bc572e in g_thread_abort (status=Could not find the frame base for "g_thread_abort".
) at gthread-posix.c:76
76 abort ();
(gdb) list
71 g_thread_abort (gint status,
72 const gchar *function)
73 {
74 fprintf (stderr, "GLib (gthread-posix.c): Unexpected error from C library during '%s': %s. Aborting.\n",
75 function, strerror (status));
76 abort ();
77 }
78
79 /* {{{1 GMutex */
80
(gdb) up
#3 0x0000000803bc58d5 in g_mutex_unlock (mutex=0x808068320)
at gthread-posix.c:230
230 g_thread_abort (status, "pthread_mutex_unlock");
(gdb) list
225 g_mutex_unlock (GMutex *mutex)
226 {
227 gint status;
228
229 if G_UNLIKELY ((status = pthread_mutex_unlock (g_mutex_get_impl (mutex))) != 0)
230 g_thread_abort (status, "pthread_mutex_unlock");
231 }
232
233 /**
234 * g_mutex_trylock:
(gdb) up
#4 0x0000000800f801d2 in gdk_threads_impl_unlock () at gdk.c:437
437 g_mutex_unlock (gdk_threads_mutex);
(gdb) list
432
433 static void
434 gdk_threads_impl_unlock (void)
435 {
436 if (gdk_threads_mutex)
437 g_mutex_unlock (gdk_threads_mutex);
438 }
439
440 /**
441 * gdk_threads_init:
(gdb) up
#5 0x00000008009b2513 in IA__gtk_main () at gtkmain.c:1256
1256 GDK_THREADS_LEAVE ();
(gdb) list
1251 }
1252 g_list_free (functions);
1253
1254 if (g_main_loop_is_running (main_loops->data))
1255 {
1256 GDK_THREADS_LEAVE ();
1257 g_main_loop_run (loop);
1258 GDK_THREADS_ENTER ();
1259 gdk_flush ();
1260 }
(gdb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment