OpenSDN source code
backtrace.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  * Copyright Contributors to the OpenSDN project
4  */
5 
6 #ifndef BASE_BACKTRACE_H__
7 #define BASE_BACKTRACE_H__
8 
9 #include <string>
10 #include <unistd.h>
11 
12 //
13 // Utility routines to retrieve and log back trace from stack at run time in
14 // human readable form
15 //
16 class BackTrace {
17 private:
18  static ssize_t ToString(void * const* callstack, int frames, char *buf,
19  size_t buf_len);
20 
21 public:
22  static void Log(const std::string &msg);
23  static void Log(void * const* callstack, int frames,
24  const std::string &msg);
25  static int Get(void * const* &callstack);
26 };
27 
28 #endif // BASE_BACKTRACE_H__
static int Get(void *const *&callstack)
Definition: backtrace.cc:63
static ssize_t ToString(void *const *callstack, int frames, char *buf, size_t buf_len)
Definition: backtrace.cc:14
static void Log(const std::string &msg)
Definition: backtrace.cc:78