2015-04-09 14:01:54 +02:00
|
|
|
#ifndef CLIB_EXCEPTION_PARSER_H
|
|
|
|
|
#define CLIB_EXCEPTION_PARSER_H
|
2014-11-01 22:59:09 +01:00
|
|
|
|
2014-11-01 23:21:44 +01:00
|
|
|
#include <string>
|
2014-11-01 22:59:09 +01:00
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
namespace Pol
|
|
|
|
|
{
|
|
|
|
|
namespace Clib
|
|
|
|
|
{
|
2014-11-01 22:59:09 +01:00
|
|
|
class ExceptionParser
|
|
|
|
|
{
|
|
|
|
|
public:
|
2016-02-19 19:26:35 +01:00
|
|
|
ExceptionParser();
|
|
|
|
|
virtual ~ExceptionParser();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Returns a string containing the current stack trace
|
|
|
|
|
* @return the stack trace as multi-line string
|
|
|
|
|
*/
|
|
|
|
|
static std::string getTrace();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Reports a program abort to the program devs
|
|
|
|
|
* @param stackTrace the stack trace of the abort
|
|
|
|
|
* @param reason a descriptive text about the reason for the abort
|
|
|
|
|
*/
|
2016-12-15 16:59:58 +01:00
|
|
|
static void reportProgramAbort( const std::string& stackTrace, const std::string& reason );
|
2016-02-19 19:26:35 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Logs stack traces of all threads to stdout and error output
|
|
|
|
|
*/
|
|
|
|
|
static void logAllStackTraces();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Initiates globally the exception catching (signal handlers for Linux)
|
|
|
|
|
*/
|
|
|
|
|
static void initGlobalExceptionCatching();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Configures the bug reporting system
|
|
|
|
|
*/
|
|
|
|
|
static void configureProgramAbortReportingSystem( bool active, std::string server,
|
|
|
|
|
std::string url, std::string reporter );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Returns true if the bug reporting is active
|
|
|
|
|
*/
|
|
|
|
|
static bool programAbortReporting();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Handles exceptions
|
|
|
|
|
*/
|
|
|
|
|
static void handleExceptionSignal( int signal );
|
2015-09-15 22:50:07 +02:00
|
|
|
|
|
|
|
|
private:
|
2016-02-19 19:26:35 +01:00
|
|
|
static bool m_programAbortReporting;
|
|
|
|
|
static std::string m_programAbortReportingServer;
|
|
|
|
|
static std::string m_programAbortReportingUrl;
|
|
|
|
|
static std::string m_programAbortReportingReporter;
|
|
|
|
|
static std::string m_programStart;
|
2014-11-01 22:59:09 +01:00
|
|
|
};
|
2016-02-19 19:26:35 +01:00
|
|
|
}
|
|
|
|
|
} // namespaces
|
2014-11-01 22:59:09 +01:00
|
|
|
|
|
|
|
|
#endif
|