BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Backtrace.h
1 #pragma once
2 
3 #include <string>
4 
5 #if defined(__GLIBC__) && !defined(__UCLIBC__)
6 #define BEEEON_BACKTRACE_GLIBC(name, size) \
7  void *name[16]; \
8  unsigned int size;
9 #else
10 #define BEEEON_BACKTRACE_GLIBC(name, size)
11 #endif
12 
13 namespace BeeeOn {
14 
15 class Backtrace {
16 public:
17  enum {
18 #if defined(__GLIBC__) && !defined(__UCLIBC__)
19  supported = 1
20 #else
21  supported = 0
22 #endif
23  };
24 
25  Backtrace(bool empty = false);
26  ~Backtrace();
27 
28  unsigned int size() const;
29 
30  std::string operator[] (unsigned int i) const
31  {
32  return at(i);
33  }
34 
35  std::string at(unsigned int i) const;
36  std::string toString(const std::string &indent = "") const;
37 
44  void dump(int fd) const;
45 
46 protected:
47  void fatal() const;
48 
49 private:
50 BEEEON_BACKTRACE_GLIBC(m_backtrace, m_backtrace_size)
51 };
52 
53 }
void dump(int fd) const
Definition: Backtrace.cpp:91
Definition: Backtrace.h:15