I am trying to debug my GTK3 application with the gdb command, but I can't seem to get it to work. When I run the command gdb ./myapp, it loads all the debug symbols successfully. However, when I then call the run command in gdb, the app window doesn't open and this is displayed:
Starting program: /home/user/build/GTKapp/myapp
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe3fff6c0 (LWP 146369)]
[New Thread 0x7fffe37fe6c0 (LWP 146370)]
[New Thread 0x7fffdaffd6c0 (LWP 146371)]
[New Thread 0x7fffca3ff6c0 (LWP 146372)]
[New Thread 0x7fffc9bfe6c0 (LWP 146373)]
[New Thread 0x7fffc93fd6c0 (LWP 146374)]
[Thread 0x7fffc93fd6c0 (LWP 146374) exited]
[New Thread 0x7fffc93fd6c0 (LWP 146375)]
[New Thread 0x7fffbbfff6c0 (LWP 146376)]
[Thread 0x7fffc93fd6c0 (LWP 146375) exited]
[New Thread 0x7fffc93fd6c0 (LWP 146377)]
[New Thread 0x7fffbb7fe6c0 (LWP 146378)]
[Thread 0x7fffc93fd6c0 (LWP 146377) exited]
[Thread 0x7fffbbfff6c0 (LWP 146376) exited]
[Thread 0x7fffbb7fe6c0 (LWP 146378) exited]
[New Thread 0x7fffbb7fe6c0 (LWP 146379)]
[New Thread 0x7fffbbfff6c0 (LWP 146380)]
[New Thread 0x7fffc93fd6c0 (LWP 146381)]
[New Thread 0x7fffbaffd6c0 (LWP 146384)]
[New Thread 0x7fffba7fc6c0 (LWP 146385)]
[New Thread 0x7fffb9ffb6c0 (LWP 146386)]
[New Thread 0x7fffb97fa6c0 (LWP 146387)]
[New Thread 0x7fffb8ff96c0 (LWP 146388)]
[Thread 0x7fffba7fc6c0 (LWP 146385) exited]
[Thread 0x7fffbaffd6c0 (LWP 146384) exited]
[Thread 0x7fffc93fd6c0 (LWP 146381) exited]
[Thread 0x7fffbbfff6c0 (LWP 146380) exited]
[Thread 0x7fffbb7fe6c0 (LWP 146379) exited]
The app window opens fine if I run it without the debugger, and I can run the app beforehand and then attach gdb to it, but it would be nice if I could start the app from inside gdb.
This is the code I use to start the app
int main(int argc, char **argv)
{
auto app = Gtk::Application::create(argc, argv, APPID);
Glib::MainContext::get_default()->push_thread_default();
System system(argc, argv);
return app->run(system.getWindow() );
}