Changeset 119:e0f1b4de6c6c in rrlib_util


Ignore:
Timestamp:
17.06.2014 16:44:10 (5 years ago)
Author:
Michael Arndt <m_arndt@…>
Branch:
default
Children:
120:1bc446ce2c5a, 124:1b0a9b51bae7
Phase:
public
Message:

Only attempt to create backtraces if running on Linux

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exception/tTraceableExceptionBase.cpp

    r107 r119  
    3838#include <cstring> 
    3939#include <vector> 
     40 
     41#if __linux__ 
    4042#include <execinfo.h> 
    4143#include <unistd.h> 
     44#endif 
    4245 
    4346//---------------------------------------------------------------------- 
     
    8184//---------------------------------------------------------------------- 
    8285 
     86#if __linux__ 
    8387namespace 
    8488{ 
     
    241245} 
    242246 
     247#endif 
     248 
    243249//---------------------------------------------------------------------- 
    244250// tTraceableExceptionBase constructors 
    245251//---------------------------------------------------------------------- 
    246252tTraceableExceptionBase::tTraceableExceptionBase() : 
    247 #ifdef NDEBUG 
     253#if defined(NDEBUG) || !__linux__ 
    248254  stack_trace_depth(0) 
    249255{} 
     
    274280  } 
    275281 
     282#if __linux__ 
    276283  if (this->buffered_backtrace.empty()) 
    277284  { 
     
    306313  } 
    307314  return this->buffered_backtrace.c_str(); 
     315#else 
     316  // just to suppress warnings, should never be reached 
     317  return "<No backtrace available>"; 
     318#endif 
    308319} 
    309320 
Note: See TracChangeset for help on using the changeset viewer.