Loading...
Searching...
No Matches
Go to the documentation of this file.
5#ifndef BALL_COMMON_DEBUG_H
6#define BALL_COMMON_DEBUG_H
8#ifndef BALL_CONFIG_CONFIG_H
9# include <BALL/CONFIG/config.h>
12#ifdef BALL_NO_INLINE_FUNCTIONS
15# define BALL_INLINE inline
23# define BALL_PRECONDITION_EXCEPTION(condition, message)\
26 Exception::Precondition e(__FILE__, __LINE__, #condition);\
27 if (strcmp(message, "") != 0)\
29 ::std::string tmp(e.getMessage());\
30 tmp += ::std::string(message);\
36# define BALL_POSTCONDITION_EXCEPTION(condition, message)\
39 Exception::Postcondition e(__FILE__, __LINE__, #condition);\
40 if (strcmp(message, "") != 0)\
42 std::string tmp(e.getMessage());\
43 tmp += std::string(message);\
49# if defined(BALL_COMPILER_GXX) || defined(BALL_COMPILER_LLVM)
53# define BALL_PRINT_BACKTRACE()\
55 void *bt_addresses[100];\
58 int bt_size = backtrace(bt_addresses, 100);\
59 bt = backtrace_symbols(bt_addresses, bt_size);\
62 size_t num_demangled;\
64 std::vector<String> split;\
66 for(int i = 0; i < bt_size; i++)\
68 String mangled(bt[i]);\
70 Log.warn() << i << ": " << bt[i] << " ";\
71 mangled = mangled.getField(1, "()");\
72 mangled = mangled.getField(0, "+");\
74 char* out = abi::__cxa_demangle(mangled.c_str(), demangled, &num_demangled, &status);\
75 if (status == 0) Log.warn() << "demangled: " << String(out);\
76 if (num_demangled > 0) free(demangled);\
78 Log.warn() << std::endl;\
84# define BALL_PRINT_BACKTRACE()
89# define BALL_PRECONDITION_EXCEPTION(condition, message)
90# define BALL_POSTCONDITION_EXCEPTION(condition, message)
91# define BALL_PRINT_BACKTRACE()