Changeset 180:82182c74c2f8 in rrlib_util


Ignore:
Timestamp:
01.11.2021 09:07:55 (8 months ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Children:
181:7210a3afd95f, 182:0b6dd2a6f91c
Parents:
179:e465981ca4f6 (diff), 176:aec9d144ecb1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

Merge of parallel development

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • exception/tTraceableExceptionBase.cpp

    r176 r180  
    6868// Forward declarations / typedefs / enums 
    6969//---------------------------------------------------------------------- 
     70namespace 
     71{ 
     72 
    7073struct tMapEntry 
    7174{ 
     
    8790#endif 
    8891 
     92#ifndef NDEBUG 
     93bool tracing_enabled = true; 
     94#else 
     95bool tracing_enabled = false; 
     96#endif 
     97 
    8998#ifndef RRLIB_UTIL_EXCEPTION_DISABLE_TRACING 
    90 namespace 
    91 { 
    9299std::string LookupSelf() 
    93100{ 
     
    223230} 
    224231 
    225 #ifndef NDEBUG 
    226232std::terminate_handler original_terminate = nullptr; 
    227233 
     
    246252  abort(); 
    247253} 
    248 #endif 
    249  
    250 } 
    251  
    252 #endif 
     254 
     255#endif 
     256 
     257} // anonymous namespace 
     258 
     259void SetExceptionTracingEnabled(bool enabled) 
     260{ 
     261  tracing_enabled = enabled; 
     262 
     263#ifdef RRLIB_UTIL_EXCEPTION_DISABLE_TRACING 
     264  if (enabled) 
     265  { 
     266    std::cerr << "Exception tracing is not available in this build." << std::endl;; 
     267  } 
     268#endif 
     269} 
    253270 
    254271//---------------------------------------------------------------------- 
     
    256273//---------------------------------------------------------------------- 
    257274tTraceableExceptionBase::tTraceableExceptionBase() : 
    258 #if defined(NDEBUG) || defined(RRLIB_UTIL_EXCEPTION_DISABLE_TRACING) 
    259275  stack_trace_depth(0) 
    260 {} 
    261 #else 
    262   stack_trace_depth(backtrace(this->stack_trace, cMAX_STACK_TRACE_DEPTH)) 
    263 { 
    264   if (!original_terminate) 
    265   { 
    266     original_terminate = std::set_terminate(terminate); 
    267   } 
    268 } 
    269 #endif 
     276{ 
     277#ifndef RRLIB_UTIL_EXCEPTION_DISABLE_TRACING 
     278  if (tracing_enabled) 
     279  { 
     280    stack_trace_depth = backtrace(this->stack_trace, cMAX_STACK_TRACE_DEPTH); 
     281 
     282    if (!original_terminate) 
     283    { 
     284      original_terminate = std::set_terminate(terminate); 
     285    } 
     286  } 
     287#endif 
     288} 
    270289 
    271290//---------------------------------------------------------------------- 
  • exception/tTraceableExceptionBase.cpp

    r179 r180  
    232232std::terminate_handler original_terminate = nullptr; 
    233233 
    234 void terminate() noexcept 
     234__attribute__((__noreturn__)) void terminate() noexcept 
    235235{ 
    236236  try 
Note: See TracChangeset for help on using the changeset viewer.