17#if !defined(__APPLE__) || defined(MAC_OS_X_VERSION_10_5)
27#if defined(R__GNU) && (defined(R__LINUX) || defined(R__HURD) || (defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_5)))
28#define SUPPORTS_MEMSTAT
31#if defined(__GNUC__) && !defined(__clang__)
33#pragma GCC diagnostic ignored "-Wframe-address"
41#if defined(SUPPORTS_MEMSTAT)
52#define G__builtin_return_address(N) \
53 ((__builtin_frame_address(N) == NULL) || \
54 (__builtin_frame_address(N) >= g_global_stack_end) || \
55 (__builtin_frame_address(N) < __builtin_frame_address(0))) ? \
56 NULL : __builtin_return_address(N)
60#define _RET_ADDR(x) case x: return G__builtin_return_address(x);
72#if defined(SUPPORTS_MEMSTAT)
126 _container[i] = addr;
140#if defined(SUPPORTS_MEMSTAT)
141 if(_bUseGNUBuiltinBacktrace) {
145 return backtrace(_trace, _size);
147 if(_trace || _size || _bUseGNUBuiltinBacktrace) { }
158#if defined(SUPPORTS_MEMSTAT)
160 if(0 == dladdr(_pAddr, &info)) {
163 if(NULL != info.dli_sname) {
165 char *ch = abi::__cxa_demangle(info.dli_sname, 0, 0, &status);
167 _strSymbol = (0 == status) ? ch : info.dli_sname;
172 if(NULL != info.dli_fname)
173 _strLib = info.dli_fname;
190#if defined(SUPPORTS_MEMSTAT)
194 int res =
getSymbols(_pAddr, strInfo, strLib, strFun);
198 *_retInfo += strInfo;
199 *_retInfo += _separator;
201 *_retInfo += _separator;
204 if(_pAddr || _separator) { }
213#if defined(SUPPORTS_MEMSTAT)
215 char *ch = abi::__cxa_demangle(_codeInfo, 0, 0, &status);
void * g_global_stack_end
int getSymbols(void *_pAddr, TString &_strInfo, TString &_strLib, TString &_strSymbol)
get the name of the function and library
size_t builtin_return_address(void **_container, size_t _limit)
void getSymbolFullInfo(void *_pAddr, TString *_retInfo, const char *const _seporator=" | ")
size_t getBacktrace(void **_trace, size_t _size, Bool_t _bUseGNUBuiltinBacktrace=kFALSE)
Get the backtrace _trace - array of pointers _size - maximal deepness of stack information _bUseGNUBu...
void demangle(char *_codeInfo, TString &_str)
demangle symbols
static void * return_address(int _frame)
we have a limit on the depth = 35