Results 1 to 3 of 3

Thread: redirecting ASSERTs

  1. #1
    Join Date
    Jan 2006
    Location
    Knivsta, Sweden
    Posts
    153
    Thanks
    30
    Thanked 13 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default redirecting ASSERTs

    I have setup my application so that if there is an uncaught exception or a segfault, it will call a special function that will save the data the user was working on and startup gdb to produce a stacktrace. This works fine, but sometimes the program dies because of an ASSERT (within the Qt library, I have none in my own code).

    Is there a way to have assert cause a segfault or call one of my functions so the program can save user data and print a stacktrace before it dies?

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: redirecting ASSERTs

    install an event handler for SIGABRT

  3. The following user says thank you to caduel for this useful post:

    drhex (24th July 2009)

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: redirecting ASSERTs

    Q_ASSERT only works in debug mode so when you deploy the application to your users, Q_ASSERT will never cause an abort.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 0
    Last Post: 23rd October 2008, 12:43
  2. Replies: 5
    Last Post: 17th July 2008, 13:12
  3. QT4 HTTP Example and Redirecting
    By jiveaxe in forum Qt Programming
    Replies: 3
    Last Post: 4th June 2008, 16:42
  4. Back tracing asserts with gdb
    By ucomesdag in forum Qt Programming
    Replies: 8
    Last Post: 30th July 2007, 21:59
  5. Redirecting qDebug()
    By hardgeus in forum Qt Programming
    Replies: 1
    Last Post: 23rd December 2006, 01:39

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.