1

When running my program, I am getting Gtk-CRITICAL error on the Terminal, which I'd like to fix.

I found this link through Google, but turns out there is no such option in gdb:

igor@IgorReinCloud ~/dbhandler/Debug/dbhandler $ gdb --g-fatal-warnings dbhandler
gdb: unrecognized option '--g-fatal-warnings'
Use `gdb --help' for a complete list of options.

I also tried to set a breakpoint on the g_log() function, but the execution didn't stop there.

What am I missing?

Thank you.

2 Answers 2

5

you can use G_DEBUG=fatal-criticals, so that the application execution breaks at the first location where a critical is emitted.

To run inside gdb, run G_DEBUG=fatal-criticals gdb my-app, and as usual, do run inside gdb to run your application.

You may also set the G_DEBUG environment variable with export (if in bash). Thus you could do export G_DEBUG=fatal-criticals, and then run your app as gdb my-app, which will have the same effect.

See https://docs.gtk.org/glib/running.html for more details

Sign up to request clarification or add additional context in comments.

Comments

1

What am I missing?

Looks like that after reading the link, you were confused that gdb should have --g-fatal-warnings option for debugging Gtk applications. This is not the case because gdb is not Gtk application, but your program is. So you should run your program with --g-fatal-warnings option inside gdb like this:

gdb --args dbhandler --g-fatal-warnings

See also related question How do I run a program with commandline args using gdb within a bash script?.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.