Debugging in the Qt Event Loop?

  • Every now and then when debugging in gdb or Visual Studio we come across something that is purely in the Qt Event Loop ie comes from main then QApplication::Exec() normally these issues are still our fault however from the debugger we struggle to work out the issue the latest listed below is a wait in a delete. Does anyone have any suggestions for debugging such issues? We normally run Multi threaded code but using internal threads rather then Qt as some code must run on embedded hardware that cannot support Qt.

    @#0 0xf7773430 in __kernel_vsyscall ()
    #1 0xf6569423 in __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/lowlevellock.S:95
    #2 0xf64fe527 in _L_lock_9667 () from /lib32/
    #3 0xf64fcd56 in __libc_free (mem=0xa180770) at malloc.c:3736
    #4 0xf66dd7b1 in operator delete(void*) () from /usr/lib32/
    #5 0xf68f47b2 in QEvent::~QEvent (this=0xa180770, __in_chrg=<value optimised out>) at kernel/qcoreevent.cpp:296
    #6 0xf68ef900 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x9fede70) at kernel/qcoreapplication.cpp:1389
    #7 0xf68ef505 in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1266
    #8 0xf6cd8e4c in QCoreApplication::sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:220
    #9 0xf6927470 in postEventSourceDispatch (s=0x9ff0d10) at kernel/qeventdispatcher_glib.cpp:277
    #10 0xf632e855 in g_main_context_dispatch () from /lib32/
    #11 0xf6332668 in ?? () from /lib32/
    #12 0xf6332848 in g_main_context_iteration () from /lib32/
    #13 0xf69284a2 in QEventDispatcherGlib::processEvents (this=0x9fee930, flags=...) at kernel/qeventdispatcher_glib.cpp:415
    #14 0xf6ce55aa in QGuiEventDispatcherGlib::processEvents (this=0x9fee930, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
    #15 0xf68ebb43 in QEventLoop::processEvents (this=0xffba60bc, flags=...) at kernel/qeventloop.cpp:149
    #16 0xf68ebc88 in QEventLoop::exec (this=0xffba60bc, flags=...) at kernel/qeventloop.cpp:201
    #17 0xf68eee75 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1009
    #18 0xf6c05e26 in QApplication::exec () at kernel/qapplication.cpp:3719
    #19 0x080b81b2 in main (argc=2, argv=0xffba6214) at /users/leess/ws/91-00250/var/PC/src/main.cpp:74@

  • You could set a conditional breakpoint on "QCoreApplication::postEvent": checking for receiver=0, event_type=0, etc. . If you need more information as to what exactly happened, you could have a look at "reverse debugging":

    EDIT: fixed second link

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.