2021-04-20 21:33:02 +02:00
|
|
|
// Copyright (c) 2014-2021 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>
|
|
|
|
|
|
|
|
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
|