Results 1 to 6 of 6

Thread: How to debug random crashes?

  1. #1
    Join Date
    Sep 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11
    Wiki edits
    1

    Default How to debug random crashes?

    My current application ALMOST works. I seem to get random crashes. The application just dies. Sometimes after a few seconds, sometimes after 30 minutes. I have no clue why.

    I use Ubuntu 11.10 and qt-creator but I have no idea on how to debug this problem.

    Can anyone help me with detailed debug instructions? I guess my first option is to get a core dump?
    Perhaps this is something for the wiki? I will try to update this page http://www.qtcentre.org/wiki/index.php?title=Debuging with advices and help written here.

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to debug random crashes?

    instead of running it stand alone. run it in debug mode and leave it running inside qt-creator(debbuger).

  3. #3
    Join Date
    Sep 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11
    Wiki edits
    1

    Default Re: How to debug random crashes?

    Great.
    I changed to debug mode, started debugger and it said in the application output window:
    &"warning: GDB: Failed to set controlling terminal: Invalid argument\n"

    The application starts and after a while a dialog pops up and says:
    "The inferior stopped because it received a signal from the Operating System

    Signal Name: SIGSEGV
    Signal Meaning: Segmentation fault"

    In one of the debug windows I see

    0 DBusMenuExporter::setStatus(QString const&) /usr/lib/x86_64-linux-gnu/libdbusmenu-qt.so.2 0 0x7fffe2718210
    1 AppMenuPlatformMenuBar::setAltPressed(bool) /usr/lib/x86_64-linux-gnu/qt4/plugins/menubar/libappmenu-qt.so 0 0x7fffe294836e
    2 AppMenuPlatformMenuBar::menuBarEventFilter(QObject *, QEvent*) /usr/lib/x86_64-linux-gnu/qt4/plugins/menubar/libappmenu-qt.so 0 0x7fffe2948783
    3 QMenuBar::eventFilter(QObject*, QEvent*) /usr/lib/x86_64-linux-gnu/libQtGui.so.4 0 0x7ffff773c1cd
    4 QCoreApplicationPrivate::sendThroughObjectEventFil ters(QObject*, QEvent*) /usr/lib/x86_64-linux-gnu/libQtCore.so.4 0 0x7ffff6dc8c88
    5 QApplicationPrivate::notify_helper(QObject*, QEvent*) /usr/lib/x86_64-linux-gnu/libQtGui.so.4 0 0x7ffff72f93ef
    6 QApplication::notify(QObject*, QEvent*) /usr/lib/x86_64-linux-gnu/libQtGui.so.4 0 0x7ffff72fe985
    7 QCoreApplication::notifyInternal(QObject*, QEvent*) /usr/lib/x86_64-linux-gnu/libQtCore.so.4 0 0x7ffff6dc8afc
    8 ?? /usr/lib/x86_64-linux-gnu/libQtGui.so.4 0 0x7ffff732c8e9
    9 QApplication::notify(QObject*, QEvent*) /usr/lib/x86_64-linux-gnu/libQtGui.so.4 0 0x7ffff72ffb12
    10 QCoreApplication::notifyInternal(QObject*, QEvent*) /usr/lib/x86_64-linux-gnu/libQtCore.so.4 0 0x7ffff6dc8afc
    11 ?? /usr/lib/x86_64-linux-gnu/libQtGui.so.4 0 0x7ffff739cf99
    12 ?? /usr/lib/x86_64-linux-gnu/libQtGui.so.4 0 0x7ffff739d40b
    13 QApplication::x11ProcessEvent(_XEvent*) /usr/lib/x86_64-linux-gnu/libQtGui.so.4 0 0x7ffff7378347
    14 ?? /usr/lib/x86_64-linux-gnu/libQtGui.so.4 0 0x7ffff73a1412
    15 g_main_context_dispatch /lib/x86_64-linux-gnu/libglib-2.0.so.0 0 0x7ffff5a82a5d
    16 ?? /lib/x86_64-linux-gnu/libglib-2.0.so.0 0 0x7ffff5a83258
    17 g_main_context_iteration /lib/x86_64-linux-gnu/libglib-2.0.so.0 0 0x7ffff5a83429
    18 QEventDispatcherGlib:rocessEvents(QFlags<QEventLoop::ProcessEventsFlag> ) /usr/lib/x86_64-linux-gnu/libQtCore.so.4 0 0x7ffff6df3ed6
    19 ?? /usr/lib/x86_64-linux-gnu/libQtGui.so.4 0 0x7ffff73a107e
    20 QEventLoop:rocessEvents(QFlags<QEventLoop::ProcessEventsFlag> ) /usr/lib/x86_64-linux-gnu/libQtCore.so.4 0 0x7ffff6dc7cf2
    21 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsF lag>) /usr/lib/x86_64-linux-gnu/libQtCore.so.4 0 0x7ffff6dc7ef7
    22 QCoreApplication::exec() /usr/lib/x86_64-linux-gnu/libQtCore.so.4 0 0x7ffff6dcc789
    23 main 0 0x405089


    Sorry for the formatting

  4. #4
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to debug random crashes?

    Now you see a call stack.
    If your bug is not very fishy, just click first entry in call stack which is pointing to your code. At this point you can try check variables of your program and see if some values are wrong.

  5. #5
    Join Date
    Sep 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11
    Wiki edits
    1

    Default Re: How to debug random crashes?

    Well, I've clicked all 23 entries above but all I see is assembler code. So I did a rebuild-all and now I got nr 23 to point to
    the line return a.exec(); in the default main function

    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication a(argc, argv);
    4. MainWindow w;
    5. w.show();
    6.  
    7. return a.exec();
    8. }
    To copy to clipboard, switch view to plain text mode 


    That doesn't sound very helpful to me. Is the system trying to send some kind of signal to my application that I can't handle?
    On the first line I see
    0 DBusMenuExporter::setStatus(QString const&) /usr/lib/x86_64-linux-gnu/libdbusmenu-qt.so.2 0 0x7fffe2718210

    and I have not done any thing knowingly to include any DBus in my application. Any more suggestions?

    Btw. the code is here
    https://github.com/GunnarLindholm/SimpleTimeTracker
    (sorry for the poor quality of the code I haven't been using Qt for a long time now)

  6. #6
    Join Date
    Sep 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11
    Wiki edits
    1

    Default Re: How to debug random crashes?

    I did some googling on the DBus error and found some ubuntu related issue in programs that don't have a Menubar.
    I added one and the program has not crashed, yet! :-)

Similar Threads

  1. QT 4.7.1 Win 7 x64 VS 2010: Debug works, Release crashes
    By new_voodoo in forum Qt Programming
    Replies: 2
    Last Post: 28th November 2010, 19:14
  2. Replies: 2
    Last Post: 24th August 2010, 16:47
  3. Replies: 1
    Last Post: 7th April 2010, 16:26
  4. Release ok, debug crashes [compilable code]
    By Raccoon29 in forum Qt Programming
    Replies: 8
    Last Post: 16th December 2009, 15:48
  5. Replies: 5
    Last Post: 5th October 2008, 05:12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.