Results 1 to 4 of 4

Thread: How to debug a QT application which hangs after some time of run

  1. #1
    Join Date
    Sep 2007
    Posts
    17
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default How to debug a QT application which hangs after some time of run

    Hi,

    I have an application which uses QProcess to talk to a gdb. The program runs for some time and the application hangs after it. There is a thread which reads the output periodically from the process and application sends next command only after receiving output for the previous command. How to debug this kind of problem ?

    Thanks in advance,
    Subbarao

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to debug a QT application which hangs after some time of run

    Run the application in a debugger.
    Once it "hangs" press pause in the debugger, and continue to step through, and see what the code is doing which it is not supposed to do.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Sep 2007
    Posts
    17
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to debug a QT application which hangs after some time of run

    Hi,

    Thanks for the suggestion.

    I attached the gdb to the process when the application got hanged. At the top of the callstack I can see __pthread_read_nocancel followed by ::read call in socketRead function of QProcess class. Have you ever seen this kind of problem ?

    Regards,
    Subbarao

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to debug a QT application which hangs after some time of run

    This is too general to be able to be answered.
    Why don't you debug the way I suggested?
    Then you can step through and know where you are in the code.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Can't debug QT application
    By corrado.calzoni in forum Newbie
    Replies: 0
    Last Post: 18th March 2011, 10:48
  2. Debug QT4 Gui Application
    By cae in forum Newbie
    Replies: 11
    Last Post: 22nd November 2009, 13:10
  3. Application Hangs in QTcpConnection
    By navi1084 in forum Qt Programming
    Replies: 1
    Last Post: 24th June 2009, 05:21
  4. qt4 application debug
    By tsemer in forum Qt Programming
    Replies: 5
    Last Post: 9th November 2007, 17:58
  5. Qtopia example execution error(application hangs)
    By devendra in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 17th October 2006, 09:11

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.