[Linux]segvcatch Simple use

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.