/** * Copyright - See the COPYRIGHT that is included with this distribution. * EPICS pvDataCPP is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. */ #include "epicsException.h" #include #include #include namespace epics{namespace pvData{ void ExceptionMixin::print(FILE *fp) const { fprintf(fp, "On line %d of %s\n",m_line,m_file); #if defined(EXCEPT_USE_BACKTRACE) if(m_depth>0) { fflush(fp); // must flush before using raw handle backtrace_symbols_fd(m_stack, m_depth, fileno(fp)); fprintf(fp, "To translate run 'addr2line -e execname 0xXXXXXXX ...'\n" " Note: Must be compiled with debug symbols\n"); } #endif } std::string ExceptionMixin::show() const { std::ostringstream out; out<<"On line "<0) { char **symbols=backtrace_symbols(m_stack, m_depth); for(int i=0; i(this); if(info) { stack=info->show(); } out.reserve(strlen(base)+1+stack.size()+1); out+=base; out+="\n"; if(info) { out+=stack; out+="\n"; } base_msg.swap(out); } return base_msg.c_str(); } catch(std::bad_alloc&) { return "BaseException::what - Insufficient memory to construct message"; } catch(...) { return "BaseException::what - Unknown error when constructing message"; } } }}