Rosetta
Macros | Functions
backtrace.hh File Reference

Programmatic backtrace whenever you want it. More...

#include <cassert>
#include <string>
#include <assert.h>

Macros

#define MY__has_include(x)   1
 
#define debug_assert(condition)   assert( ( condition ) || handle_assert_failure( #condition, __FILE__, __LINE__ ) )
 

Functions

void set_throw_on_next_assertion_failure ()
 Function for unit testing only – if an assertion failure is hit, throw an exception instead of exiting. Don't let me catch you calling this function from anywhere besides a unit test. Punishment will be swift. More...
 
bool maybe_throw_on_next_assertion_failure (char const *condition)
 Throw an exception if set_throw_on_next_assertion_failure was called since the last time this function was called. More...
 
std::string backtrace_string (int skip=0)
 
bool print_backtrace (char const *)
 
bool handle_assert_failure (char const *condition, std::string const &file, int const line)
 

Detailed Description

Programmatic backtrace whenever you want it.

Author
Rhiju Das

Macro Definition Documentation

◆ debug_assert

#define debug_assert (   condition)    assert( ( condition ) || handle_assert_failure( #condition, __FILE__, __LINE__ ) )

◆ MY__has_include

#define MY__has_include (   x)    1

Function Documentation

◆ backtrace_string()

std::string backtrace_string ( int  skip = 0)
inline

◆ handle_assert_failure()

bool handle_assert_failure ( char const *  condition,
std::string const &  file,
int const  line 
)

◆ maybe_throw_on_next_assertion_failure()

bool maybe_throw_on_next_assertion_failure ( char const *  condition)

Throw an exception if set_throw_on_next_assertion_failure was called since the last time this function was called.

References CREATE_EXCEPTION, and throw_the_next_time_an_assertion_failure_is_hit().

Referenced by utility::exit_handler(), and handle_assert_failure().

◆ print_backtrace()

bool print_backtrace ( char const *  )
inline

◆ set_throw_on_next_assertion_failure()

void set_throw_on_next_assertion_failure ( )

Function for unit testing only – if an assertion failure is hit, throw an exception instead of exiting. Don't let me catch you calling this function from anywhere besides a unit test. Punishment will be swift.

References throw_the_next_time_an_assertion_failure_is_hit().