Results 1 to 5 of 5

Thread: How to catch segfaults?

  1. #1
    Join Date
    Jun 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question How to catch segfaults?

    Hi!

    I'm a Qt-beginer. I'm developing a Linux/Windows application, and I mainly programmed in Windows VStudio 6 until now.
    How can I catch "segfaults"? I have a lot of buffers code and plugin access, and I need to try-catch the errors (read/write memory, etc; like I did in my Windows VStudio projects).

    Thx!

    PD: Sorry for my bad english...

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to catch segfaults?

    SEGFAULT is not an exception, but a signal, so you can't catch it with try-catch statement.

  3. #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: How to catch segfaults?

    You can provide a signal handler for SIGSEGV although catching it has a very limited use and you have to know what you are doing.

  4. #4
    Join Date
    Jun 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to catch segfaults?

    Quote Originally Posted by wysota View Post
    You can provide a signal handler for SIGSEGV although catching it has a very limited use and you have to know what you are doing.
    An example, please?

  5. #5
    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: How to catch segfaults?

    man signal
    man sigaction

Similar Threads

  1. Replies: 2
    Last Post: 24th November 2008, 16:19
  2. Replies: 6
    Last Post: 13th May 2008, 14:19
  3. Can't catch key_down and some keys
    By anafor2004 in forum Newbie
    Replies: 5
    Last Post: 27th February 2008, 10:00
  4. Replies: 2
    Last Post: 4th August 2007, 05:31
  5. Anyone an idea why this code segfaults?
    By Kumosan in forum Qt Programming
    Replies: 4
    Last Post: 28th April 2007, 06:53

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.