/usr/include/BALL/COMMON/debug.h is in libball1.4-dev 1.4.1+20111206-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | // -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_COMMON_DEBUG_H
#define BALL_COMMON_DEBUG_H
#ifndef BALL_CONFIG_CONFIG_H
# include <BALL/CONFIG/config.h>
#endif
#ifdef BALL_NO_INLINE_FUNCTIONS
# define BALL_INLINE
#else
# define BALL_INLINE inline
#endif
#include <string>
#include <cstring>
#ifdef BALL_DEBUG
# define BALL_PRECONDITION_EXCEPTION(condition, message)\
if (!(condition))\
{\
Exception::Precondition e(__FILE__, __LINE__, #condition);\
if (strcmp(message, "") != 0)\
{\
::std::string tmp(e.getMessage());\
tmp += ::std::string(message);\
e.setMessage(tmp);\
}\
throw e;\
}\
# define BALL_POSTCONDITION_EXCEPTION(condition, message)\
if (!(condition))\
{\
Exception::Postcondition e(__FILE__, __LINE__, #condition);\
if (strcmp(message, "") != 0)\
{\
std::string tmp(e.getMessage());\
tmp += std::string(message);\
e.setMessage(tmp);\
}\
throw e;\
}\
# ifdef BALL_COMPILER_GXX
# include <execinfo.h>
# include <cxxabi.h>
# define BALL_PRINT_BACKTRACE()\
{\
void *bt_addresses[100];\
char **bt;\
\
int bt_size = backtrace(bt_addresses, 100);\
bt = backtrace_symbols(bt_addresses, bt_size);\
\
char* demangled=0;\
size_t num_demangled;\
int status;\
std::vector<String> split;\
\
for(int i = 0; i < bt_size; i++)\
{\
String mangled(bt[i]);\
\
Log.warn() << i << ": " << bt[i] << " ";\
mangled = mangled.getField(1, "()");\
mangled = mangled.getField(0, "+");\
\
char* out = abi::__cxa_demangle(mangled.c_str(), demangled, &num_demangled, &status);\
if (status == 0) Log.warn() << "demangled: " << String(out);\
if (num_demangled > 0) free(demangled);\
demangled = 0;\
Log.warn() << std::endl;\
}\
free(bt);\
}\
# else
# define BALL_PRINT_BACKTRACE()
# endif
#else
# define BALL_PRECONDITION_EXCEPTION(condition, message)
# define BALL_POSTCONDITION_EXCEPTION(condition, message)
# define BALL_PRINT_BACKTRACE()
#endif // BALL_DEBUG
#endif // BALL_COMMON_DEBUG_H
|