erste version, test vor configure

This commit is contained in:
Marc Wäckerlin
2004-04-21 06:39:20 +00:00
parent 564c1f4ef3
commit c456fa7006
19 changed files with 2577 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
#include <mrw/stacktrace.hpp>
#include <mrw/exception.hpp>
#include <exception>
#include <iostream>
namespace mrw {
/// @todo integrate it into the distribution and document it
void unexpected() {
std::cerr<<"UNEXPECTED EXCEPTION: ----------------------------"<<std::endl;
try {
throw;
} catch (const mrw::exception& x) {
StackTrace::createSymtable();
std::cerr<<"---------- Reason:"<<std::endl
<<x.what()<<std::endl
<<"---------- Stack:"<<std::endl
<<x.stacktrace()<<std::endl;
} catch (const std::exception& x) {
std::cerr<<"---------- Reason:"<<std::endl
<<x.what()<<std::endl
<<"---------- Stack: **** not available ****"<<std::endl;
} catch (...) {
std::cerr<<"---------- Reason: **** not available ****"<<std::endl
<<"---------- Stack: **** not available ****"<<std::endl;
}
std::cerr<<"-------------------------------------------------"<<std::endl;
throw std::bad_exception();
}
class AutoStackTrace {
public:
AutoStackTrace() {
std::set_unexpected(&mrw::unexpected);
}
};
// initialize stack traces (load symbols)
static AutoStackTrace _autoStackTrace;
}