2019-06-11 13:46:07 +02:00
|
|
|
// Copyright (c) 2014-2019 The Dash Core developers
|
2019-02-21 19:37:16 +01:00
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2018-04-02 00:30:17 +02:00
|
|
|
#ifndef BITCOIN_STACKTRACES_H
|
|
|
|
#define BITCOIN_STACKTRACES_H
|
2019-02-21 19:37:16 +01:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <sstream>
|
|
|
|
#include <exception>
|
|
|
|
|
|
|
|
#include <cxxabi.h>
|
|
|
|
|
2020-03-19 23:46:56 +01:00
|
|
|
#include <tinyformat.h>
|
2019-02-21 19:37:16 +01:00
|
|
|
|
|
|
|
std::string DemangleSymbol(const std::string& name);
|
|
|
|
|
|
|
|
std::string GetPrettyExceptionStr(const std::exception_ptr& e);
|
2019-07-02 06:16:11 +02:00
|
|
|
std::string GetCrashInfoStrFromSerializedStr(const std::string& ciStr);
|
2019-02-21 19:37:16 +01:00
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
std::string GetExceptionWhat(const T& e);
|
|
|
|
|
|
|
|
template<>
|
|
|
|
inline std::string GetExceptionWhat(const std::exception& e)
|
|
|
|
{
|
|
|
|
return e.what();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Default implementation
|
|
|
|
template<typename T>
|
|
|
|
inline std::string GetExceptionWhat(const T& e)
|
|
|
|
{
|
|
|
|
std::ostringstream s;
|
|
|
|
s << e;
|
|
|
|
return s.str();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RegisterPrettyTerminateHander();
|
|
|
|
void RegisterPrettySignalHandlers();
|
|
|
|
|
2018-04-02 00:30:17 +02:00
|
|
|
#endif//BITCOIN_STACKTRACES_H
|