GithubHelp home page GithubHelp logo

darrenflexxu / nocoredump Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xiaobazhang/nocoredump

0.0 2.0 0.0 26 KB

可以捕获指针异常,内存溢出等错误的代码

CMake 5.63% Makefile 2.32% C++ 82.67% C 9.38%

nocoredump's Introduction

nocoredump

(1) nocoredump介绍

nocoredump是一个可用于捕捉程序中出现严重的错误的程序,它能够捕捉到如下引起程序崩溃的严重bug,同时能够跳过出问题的程序,继续运行程序。 同时在出问题的地方会打印出问题堆栈帮助调试:

(2) nocoredump能够处理的bug

nocoredump能够处理的严重崩溃问题如下,按照bug所触发的信号分为三类如下:

信号 动作 说明
SIGILL 4 Core 非法指令(程序错误、试图执行数据段、栈溢出等)
SIGFPE 8 Core 算术运行错误(浮点运算错误、除数为零等)
SIGSEGV 11 Core 无效内存引用(试图访问不属于自己的内存空间、对只读内存空间进行写操作)

(3) nocoredump的使用

首先下载该项目,由于项目程序全是以头文件提供,所以只需将该项目头文件包含到工程项目中即可,使用也非常简单,如下所示:

    #include "srv/catch_exceptions.h" //头文件
    
    Try("bug_name") //此处名字是所要标记try这段代码的名字,可以任意取,但是一定要记住不能和其他Try块的名字重复!!!
        bug();      //有可能引起异常的的程序段
    EndTry          //EndTry一定要加上
    CatchExceptions //假如出现了bug,catch到bug后所要运行的代码
        cout << "catch the bug bug_name!!!" << endl;
    EndCatch        //EndCatch 一定要加上

注意:当前还不支持Try块的嵌套,所以不能在一个Try块中包含另一个Try块,后一个版本支持嵌套!!!!!!

(4) nocoredump的线程安全问题

经过测试,多线程下nocoredump是线程安全的,可以在多个线程中安全运行,并且打印的堆栈是当前出问题的堆栈,非常好用。

维护和问题反馈

[email protected]

nocoredump's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.