https://code.google.com/p/segvcatch/
This is a crossplatform C + + library designed to convert a hardware exceptions, such as segmentation fault, or floating poi NT errors, into a software language exceptions, which can is handled later with a try/catch construction.
Other words, it ' s a crossplatform structured exception handling (SEH).
Sometimes we have a mistake, we want to catch this anomaly and segvcatch can help us do it.
Download good segvcatch-0.9.1.zip After the decompression look inside the doc.h steps can, here we extract files under separate test
: Http://pan.baidu.com/s/16ViuM
1. Extracting Relevant documents
The extracted files are all of the. cpp and. h files above, Makefile is later written,. So is a running script that is later generated,. sh
2. Edit Makefile
CXX = g++TARGET = mainsources = main.cpplibs = -L. /-Lsegvcatchcxxflags= -wall-fexceptions-fnon-call-exceptionsrm = RM- rf$ (TARGET): $ (SOURCES) $ (CXX)$ ^ $ (LIBS)-o [email protected] $ (cxxflags). Phony:cleanclean: *. So. PHONY:liblib:segvcatch.cpp $ (CXX) $^-fpic-shared-o libsegvcatch.so
3. Compile test (ok!)
#make Lib
#make
#./main
Exception Catched:my SEGV
Exception Catched:my FPE
We are living yet!
[Linux]segvcatch Simple use