eis/mix_cc/stacktrace/stacktrace.h

37 lines
879 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file mix_cc/stacktrace/stacktrace.h
* @brief 异常处理类
* @author Cat (null.null.null@qq.com)
* @version 0.1
* @date 2021-05-10
*
* Copyright: Baosight Co. Ltd.
* DO NOT COPY/USE WITHOUT PERMISSION
*
*/
#pragma once
#include <signal.h>
#include <boost/filesystem.hpp>
#include <boost/exception/all.hpp>
#include <boost/stacktrace.hpp>
#include <boost/assert.hpp>
namespace mix_cc {
typedef boost::error_info<struct tag_stacktrace, boost::stacktrace::stacktrace>
ErrorTraced;
void mix_cc_signal_handler(int signum);
std::string auto_check_dump();
/**
* @brief 使用USE_MIX_CC_STACK_TRACE宏放在程序开始运行处即可
*/
#define USE_MIX_CC_STACK_TRACE \
::signal(SIGSEGV, &mix_cc::mix_cc_signal_handler); \
::signal(SIGABRT, &mix_cc::mix_cc_signal_handler); \
mix_cc::auto_check_dump();
} // namespace mix_cc