34#if defined(__GLIBC__) || defined(__APPLE__)
53 bool return_value=
false;
57 std::string::size_type start=
working.rfind(
'(');
58 std::string::size_type end=
working.find(
'+', start);
60 if(start!=std::string::npos &&
61 end!=std::string::npos &&
64 std::string::size_type length=end-(start+1);
74 out <<
working.substr(0, start+1)
91#if defined(__GLIBC__) || defined(__APPLE__)
92 void * stack[50] = {};
94 std::size_t entries=backtrace(stack,
sizeof(stack) /
sizeof(
void *));
95 std::unique_ptr<char*, freert> description(
98 for(std::size_t i=0; i<entries; i++)
101 out << description.get()[i];
102 out <<
'\n' << std::flush;
127 out << std::setw(3) << i;
128 out <<
" 0x" << std::hex << std::setw(8) << symbol->Address;
129 out <<
' ' << symbol->Name;
130 out <<
'\n' << std::flush;
135 out <<
"Backtraces not supported\n" << std::flush;
143 std::ostringstream
ostr;
151 std::cerr <<
"--- begin invariant violation report ---\n";
152 std::cerr << reason.
what() <<
'\n';
153 std::cerr <<
"--- end invariant violation report ---\n";
158 std::ostringstream out;
159 out <<
"Invariant check failed\n"
162 <<
"Reason: " <<
reason <<
'\n'
163 <<
"Backtrace:" <<
'\n'
172 if(!s.empty() && s.back() !=
'\n')
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
A logic error, augmented with a distinguished field to hold a backtrace.
const std::string backtrace
const std::string condition
virtual std::string what() const noexcept
const std::string function
virtual std::string what() const noexcept
const std::string diagnostics
std::string get_backtrace()
Returns a backtrace.
void report_exception_to_stderr(const invariant_failedt &reason)
Dump exception report to stderr.
void print_backtrace(std::ostream &out)
Prints a back trace to 'out'.
bool cbmc_invariants_should_throw
Set this to true to cause invariants to throw a C++ exception rather than abort the program.
void * calloc(__CPROVER_size_t nmemb, __CPROVER_size_t size)