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 given any more information about where this assertion is. Is there a way to get GDB to break on such a failure?
You can also set breakpoints on function names. To do this, just type "break [functionname]". gdb will stop your program just before that function is called. Breakpoints stay set when your program ends, so you do not have to reset them unless you quit gdb and restart it.
If GLib has been configured with --enable-debug=yes , this variable can be set to a list of debug options, which cause GLib to print out different types of debugging information. Causes GLib to abort the program at the first call to g_warning() or g_critical().
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With