PDA

View Full Version : How to catch segfaults?



Daliphant
18th June 2008, 10:56
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...

jacek
26th June 2008, 01:02
SEGFAULT is not an exception, but a signal, so you can't catch it with try-catch statement.

wysota
26th June 2008, 18:29
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.

Daliphant
3rd July 2008, 14:38
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?

wysota
3rd July 2008, 15:17
man signal
man sigaction