ClickHouse/dbms/src/Common/StackTrace.h

23 lines
367 B
C++
Raw Normal View History

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
StackTrace();
2015-10-05 01:11:12 +00:00
2017-05-07 20:25:26 +00:00
/// Print to string
std::string toString() const;
2015-10-05 01:11:12 +00:00
private:
using Frame = void*;
Frame frames[STACK_TRACE_MAX_DEPTH];
size_t frames_size;
2015-10-05 01:11:12 +00:00
};