2019-02-25 14:48:22 +01:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2013-03-07 15:00:26 +01:00
|
|
|
|
|
|
|
#ifndef STACKTRACE_H
|
|
|
|
#define STACKTRACE_H
|
|
|
|
|
2014-05-25 16:23:35 +02:00
|
|
|
#include "base/i2-base.hpp"
|
2018-01-04 18:24:45 +01:00
|
|
|
#include <iosfwd>
|
2013-03-15 18:21:29 +01:00
|
|
|
|
2013-03-07 15:00:26 +01:00
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A stacktrace.
|
|
|
|
*
|
|
|
|
* @ingroup base
|
|
|
|
*/
|
2017-12-31 07:22:16 +01:00
|
|
|
class StackTrace
|
2013-03-07 15:00:26 +01:00
|
|
|
{
|
|
|
|
public:
|
2018-01-04 04:25:35 +01:00
|
|
|
StackTrace();
|
2013-03-07 15:00:26 +01:00
|
|
|
#ifdef _WIN32
|
2013-03-14 23:52:52 +01:00
|
|
|
explicit StackTrace(PEXCEPTION_POINTERS exi);
|
2013-03-07 15:00:26 +01:00
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
2013-03-16 21:18:53 +01:00
|
|
|
void Print(std::ostream& fp, int ignoreFrames = 0) const;
|
2013-03-07 15:00:26 +01:00
|
|
|
|
2018-01-04 04:25:35 +01:00
|
|
|
static void StaticInitialize();
|
2014-03-30 01:18:30 +01:00
|
|
|
|
2013-03-07 15:00:26 +01:00
|
|
|
private:
|
|
|
|
void *m_Frames[64];
|
|
|
|
int m_Count;
|
|
|
|
};
|
|
|
|
|
2017-12-31 07:22:16 +01:00
|
|
|
std::ostream& operator<<(std::ostream& stream, const StackTrace& trace);
|
2013-03-07 19:44:39 +01:00
|
|
|
|
2013-03-07 15:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* UTILITY_H */
|