开发者

How do I get GDB to break on a GLib assertion failure?

Somewhere in a mass of code that I did not write (but I am trying to debug), an assertion fails in the GLib library:

(process:31987): GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed

However, GDB and the code keeps on going. I would like GDB to break where this assertion fails so that I can find out why it is failing. I am not g开发者_开发问答iven any more information about where this assertion is. Is there a way to get GDB to break on such a failure?


You should add an environment variable like this:

G_DEBUG=fatal_warnings gdb ...


Break on g_log(). This covers all cases like g_warning(), g_critical(), etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜