2015-10-05 01:11:12 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#define STACK_TRACE_MAX_DEPTH 32
|
|
|
|
|
|
|
|
|
2017-05-07 20:25:26 +00:00
|
|
|
/// Lets you get a stacktrace
|
2015-10-05 01:11:12 +00:00
|
|
|
class StackTrace
|
|
|
|
{
|
|
|
|
public:
|
2017-05-07 20:25:26 +00:00
|
|
|
/// The stacktrace is captured when the object is created
|
2017-04-01 07:20:54 +00:00
|
|
|
StackTrace();
|
2015-10-05 01:11:12 +00:00
|
|
|
|
2017-05-07 20:25:26 +00:00
|
|
|
/// Print to string
|
2017-04-01 07:20:54 +00:00
|
|
|
std::string toString() const;
|
2015-10-05 01:11:12 +00:00
|
|
|
|
|
|
|
private:
|
2017-04-01 07:20:54 +00:00
|
|
|
using Frame = void*;
|
|
|
|
Frame frames[STACK_TRACE_MAX_DEPTH];
|
|
|
|
size_t frames_size;
|
2015-10-05 01:11:12 +00:00
|
|
|
};
|