我怎样才能找出导致GLib-GObject-CRITICAL的代码在哪里?

时间:2010-03-15 19:49:22

标签: linux gtk

如果C / C ++应用程序因以下重要信息而失败,您能否告诉我如何找出导致错误的代码在哪里?

我试图在调试器中运行它,尝试在程序失败时执行'bt'。但它没有显示导致CRITICAL的代码在哪里:

(process:3155): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.22.3/gobject/gtype.c:2458: initialization assertion failed, use IA__g_type_init() prior to this function

(process:3155): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed

(process:3155): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.22.3/gobject/gtype.c:2458: initialization assertion failed, use IA__g_type_init() prior to this function

(process:3155): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.22.3/gobject/gtype.c:2458: initialization assertion failed, use IA__g_type_init() prior to this function

(process:3155): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.22.3/gobject/gtype.c:2458: initialization assertion failed, use IA__g_type_init() prior to this function

(process:3155): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:3155): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.22.3/gobject/gtype.c:2458: initialization assertion failed, use IA__g_type_init() prior to this function

3 个答案:

答案 0 :(得分:4)

在gdb中运行时,应将--g-fatal-warnings传递给应用程序。

答案 1 :(得分:3)

您可以暂停g_log,然后从那里进行回溯。

答案 2 :(得分:2)

我认为它确实显示了导致问题的位置(堆栈跟踪更深):

(gdb) bt
#0  0x00da5422 in __kernel_vsyscall ()
#1  0x00c70e15 in pthread_cond_wait@@GLIBC_2.3.2 ()
    at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:122
#2  0x008a5800 in g_once_init_enter_impl () from /lib/libglib-2.0.so.0
#3  0x00800e36 in g_initially_unowned_get_type ()
   from /usr/lib/libgobject-2.0.so.0
#4  0x00271f15 in gtk_object_get_type () from /usr/lib/libgtk-x11-2.0.so.0
#5  0x0036aa4c in gtk_widget_get_type () from /usr/lib/libgtk-x11-2.0.so.0
#6  0x001b8485 in gtk_container_get_type () from /usr/lib/libgtk-x11-2.0.so.0
#7  0x0031b3b5 in gtk_toolbar_get_type () from /usr/lib/libgtk-x11-2.0.so.0
#8  0x0031d717 in gtk_toolbar_new () from /usr/lib/libgtk-x11-2.0.so.0