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