diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2016-02-09 15:47:48 -0500 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2016-02-10 11:26:47 -0500 |
commit | dad1e14a3d8ed6f17525f27ef823891a1836b8a6 (patch) | |
tree | 4abdab314dcbd93007ddeb1dda38421f92abaf05 /src/mongo/util | |
parent | 0df1eabb730f54c72dd545fc2b5f5c7f630e7f3c (diff) | |
download | mongo-dad1e14a3d8ed6f17525f27ef823891a1836b8a6.tar.gz |
SERVER-16496 Define BOOST assert handler
Diffstat (limited to 'src/mongo/util')
-rw-r--r-- | src/mongo/util/assert_util.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/mongo/util/assert_util.cpp b/src/mongo/util/assert_util.cpp index c460bfb410d..b89dac1ed1b 100644 --- a/src/mongo/util/assert_util.cpp +++ b/src/mongo/util/assert_util.cpp @@ -303,4 +303,24 @@ string ExceptionInfo::toString() const { ss << "exception: " << code << " " << msg; return ss.str(); } -} +} // namespace mongo + +// When BOOST_ENABLE_ASSERT_DEBUG_HANDLER is defined, we can add our own callbacks for BOOST & ASIO +namespace boost { +void assertion_failed(char const* expr, char const* function, char const* file, long line) { + mongo::log() << "Boost assert failure " << expr << ' ' << function << ' ' << file << ' ' << dec + << line << endl; + mongo::breakpoint(); + mongo::log() << "\n\n***aborting after boost assert() failure\n\n" << endl; + mongo::quickExit(mongo::EXIT_ABRUPT); +} + +void assertion_failed_msg( + char const* expr, char const* msg, char const* function, char const* file, long line) { + mongo::log() << "Boost assert failure " << expr << ' ' << msg << ' ' << function << ' ' << file + << ' ' << dec << line << endl; + mongo::breakpoint(); + mongo::log() << "\n\n***aborting after boost assert() failure\n\n" << endl; + mongo::quickExit(mongo::EXIT_ABRUPT); +} +} // namespace boost |