20 #include <glog/logging.h>
31 std::ostream &o = *ptr;
43 for (uint16_t stack_index = 0; stack_index <
get_stack_depth(); ++stack_index) {
46 if (
get_func(stack_index) !=
nullptr) {
51 o << std::endl <<
" .. and more. Increase kMaxStackDepth to see full stacktraces";
62 std::stringstream str;
63 str <<
"foedus::ErrorStack::dump_and_abort: " << abort_message << std::endl << *
this << std::endl;
66 static_recent_dump_and_abort += str.str();
67 LOG(FATAL) << str.str();
std::string static_recent_dump_and_abort
Leaves recent dump information in a static global variable so that a signal handler can pick it...
static std::string get_recent_dump_and_abort()
Signal handler can get the dump information via this.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Brings error stacktrace information as return value of functions.
const char * get_error_name(ErrorCode code)
Returns the names of ErrorCode enum defined in error_code.xmacro.
std::ostream & operator<<(std::ostream &o, const Epoch &v)
const char * get_filename(uint16_t stack_index) const
Returns the file name of the given stack position.
Maximum stack trace depth.
uint16_t get_stack_depth() const
Returns the depth of stack this error code has collected.
void dump_and_abort(const char *abort_message) const
Describe this object to std::cerr and then abort.
uint32_t get_linenum(uint16_t stack_index) const
Returns the line number of the given stack position.
const char * get_custom_message() const
Returns the custom error message.
std::string os_error()
Thread-safe strerror(errno).
const char * get_func(uint16_t stack_index) const
Returns the function name of the given stack position.
void output(std::ostream *ptr) const
Describe this object to the given stream.
const char * get_message() const
Returns the error message inferred by the error code.
std::string print_backtrace()
Prints out backtrace.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
bool is_error() const
Returns if this return code is not kErrorCodeOk.